 <table class ="tablefixed" width="100%"   border="0" cellpadding="2px">  
    <tr class="trauto" >
      <td  class="td450" id="container_ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier">
	 		<div class="pane-header ui-state-active" id="ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier_bar" >SUPPLIER LIST</div>
			<table id="ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier"></table> <div id="pms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier"></div>
	     </td> 
      <td class="tdauto" id="container_ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice" valign="top">  
	  				<div class="pane-header ui-state-active" id="ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice_bar" > 
	  				  <table width="100%" border="0"  cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="56%">INVOICE READY</td>
                          <td width="11%">:</td>
                          <td width="33%" align="right">KURS :
                            <input  id="ms_in_<?php echo $bc_prefix; ?>_import_invoice_manual_valuta"
																						   style="width: 40px;"
																						   type="text" /></td>
                        </tr>
                      </table>
	  				</div>
		<table id="ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice"></table> <div id="pms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice"></div>
      </td>
    </tr>  
</table> 
<style>
 
</style> 

<script type="text/javascript">
    setTimeout(function(){
			setGridHight($("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier"),$("#container_ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier"),$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier_bar")); 
		},50); 
 
    $(document).ready(function(){ 
		var ms_in<?php echo $bc_prefix;  ?>_import_molt_ms_supplier_customer_id='-1';
		  
			
	jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid({
			url:'<?php echo base_url().'ms_in/ct_ms_in/loaddata_supplier_invoice'; ?>',
			mtype : "post",
			postData:{invoice_prefix_id:'<?php echo $invoice_prefix_id;  ?>'
					,mode_source:'1'
					},
			datatype: "local",
			colNames:[
			'ms_supplier_customer_id','Code','Name','CN','Ready','Total'
			,'Address','CN Name'
			]
			,colModel:[
			{name:'rID',index:'rID', width:80, hidden:true, align :'left'}
			,{name:'r1',index:'r1', width:80, hidden:false, align :'left'}
			,{name:'r2',index:'r2', width:180, hidden:false, align :'left'} 
			,{name:'r7',index:'r7', width:30, hidden:false, align :'left'}
			,{name:'r4',index:'r4', width:50, hidden:false, align :'right'}
			,{name:'r5',index:'r5', width:50, hidden:false, align :'right'}

			,{name:'r6',index:'r6', width:300, hidden:false, align :'left'}
			,{name:'r3',index:'r3', width:80, hidden:false, align :'left'} 
	
			],
			rowNum:30,
			rowList:[10,20,30,50,100,200,300,500],
			pager: '#pms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier',
			sortname: 'r1',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height: 100,
	 		jsonReader: { repeatitems : false },
			rownumbers: true,
			loadonce: false,
			shrinkToFit: false,
			multiselect: false,
			afterInsertRow: function(rowid, aData){
				/*switch (aData.statusdok) {
					case 'DATA SENT':
						jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('setCell',rowid,'statusdok','',{color:'green'});
					break;
					case '2':
						jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('setCell',rowid,'statusdok','',{color:'red'});
					break;
					case '1':
						jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('setCell',rowid,'statusdok','',{color:'blue'});
					break;
					
				} */
			},
			onSelectRow: function(id){  
			    if(id){  
                  var stret = jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('getRowData',id);
				  var postData={ms_supplier_customer_id:stret.rID}
					$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('setGridParam',{postData:postData,datatype:'json'});
					$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").trigger("reloadGrid");  
               }else{
				  var postData={ms_supplier_customer_id:'-1'}
					$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('setGridParam',{postData:postData,datatype:'json'});
					$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").trigger("reloadGrid");  
			   };
			                   
				// st_prosses_from_supply=0;
		
            },
			gridComplete: function(){
				// var rowIDs = jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").getDataIDs(); 
				// var rowData = $("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").getRowData();
			
				// for (var i = 0; i < rowData.length; i++) 
				// {
				   // var trElement = jQuery("#"+ rowIDs[i],jQuery('#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier'));
				   
					// switch (rowData[i].status_2) {
						// case 'DATA PROCESSED':
						   // trElement.css({"color":"green"});
						// break;
						
						// case 'SENT TO INVENTORY CANCELED':
						   // trElement.css({"color":"green"});
						// break;
						
						// case 'DATA SENT TO INVENTORY':
						   // trElement.css({"color":"purple"});
						// break;
						// case 'DATA PROCESSED INVENTORY':
						   // trElement.css({"color":"blue"});
						// break;
						// case 'APPROVED INVENTORY':
						   // trElement.css({"color":"red"});
						// break;
					// }
				// }
			},
		}); 
		// jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('setGroupHeaders', 
            // { useColSpanStyle: true, groupHeaders:[
			// {startColumnName: 'BC23No', numberOfColumns: 2, titleText: '<em><center>C</center></em>'},
			// {startColumnName: 'PasokNama', numberOfColumns: 3, titleText: '<em><center>Supplier</center></em>'},
			// {startColumnName: 'UsahaNama', numberOfColumns: 2, titleText: '<em><center>Buyer</center></em>'},
			
			// {startColumnName: 'Cif', numberOfColumns: 3, titleText: '<em><center>Valuta</center></em>'},
			// {startColumnName: 'status_2', numberOfColumns: 3, titleText: '<em><center>Log Status</center></em>'},
			// {startColumnName: 'update_date', numberOfColumns: 2, titleText: '<em><center>Log Modify</center></em>'}
        // ] });

		jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('navGrid','#pms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
 		
		jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid({
			url:'<?php echo base_url().'ms_in/ct_ms_in/loaddata_supplier_list_invoice'; ?>',
			datatype: "local",
			mtype : "post",
			postData:{
				invoice_prefix_id:'<?php echo $invoice_prefix_id;  ?>'
				,mode_source:'1'
				},
	 		colNames:[
			'dt_ms_invoice_manual_invoice_ms_invoice_manual_invoice_id','Invoice No','Invoice Date','REC DATE','ETA'
			]
			,colModel:[
			{name:'rID',index:'rID', width:80, hidden:true, align :'right'}
			,{name:'r1',index:'r1', width:120, hidden:false, align :'left'}
			,{name:'r2',index:'r2', width:80, hidden:false, align :'left', searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#table_name")[0].triggerToolbar();},changeMonth: true,changeYear: true,dateFormat:'dd/mm/yy', showButtonPanel: true, beforeShow: function(input) {  setTimeout(function() { var buttonPane = $(input).datepicker("widget").find( ".ui-datepicker-buttonpane" );   var btn = $('<button class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" type="button">Clear</button>');   btn.unbind("click").bind("click", function () {   $.datepicker._clearDate( input );   });   btn.appendTo( buttonPane );  }, 1 );  }  });}}}
			,{name:'r3',index:'r3', width:80, hidden:false, align :'left', searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#table_name")[0].triggerToolbar();},changeMonth: true,changeYear: true,dateFormat:'dd/mm/yy', showButtonPanel: true, beforeShow: function(input) {  setTimeout(function() { var buttonPane = $(input).datepicker("widget").find( ".ui-datepicker-buttonpane" );   var btn = $('<button class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" type="button">Clear</button>');   btn.unbind("click").bind("click", function () {   $.datepicker._clearDate( input );   });   btn.appendTo( buttonPane );  }, 1 );  }  });}}}
			,{name:'r4',index:'r4', width:80, hidden:false, align :'left', searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#table_name")[0].triggerToolbar();},changeMonth: true,changeYear: true,dateFormat:'dd/mm/yy', showButtonPanel: true, beforeShow: function(input) {  setTimeout(function() { var buttonPane = $(input).datepicker("widget").find( ".ui-datepicker-buttonpane" );   var btn = $('<button class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" type="button">Clear</button>');   btn.unbind("click").bind("click", function () {   $.datepicker._clearDate( input );   });   btn.appendTo( buttonPane );  }, 1 );  }  });}}}

			],
		//	rowNum:-1,
			multiselect: true, 
			rowNum:100,
		 	rowList:[10,20,30,50,100,200],
	 		pager: '#pms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice',
			sortname: 'r1',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height: 100,
	 		jsonReader: { repeatitems : false }, 
			rownumbers: true,
			loadonce: false,
			shrinkToFit: false, 
			afterInsertRow: function(rowid, aData){
				/*switch (aData.statusdok) {
					case 'DATA SENT':
						jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('setCell',rowid,'statusdok','',{color:'green'});
					break;
					case '2':
						jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('setCell',rowid,'statusdok','',{color:'red'});
					break;
					case '1':
						jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('setCell',rowid,'statusdok','',{color:'blue'});
					break;
					
				} */
			},
			gridComplete: function(){
				var rowIDs = jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").getDataIDs(); 
				var rowData = $("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice'));
				   
					switch (rowData[i].status_2) {
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						
						case 'SENT TO INVENTORY CANCELED':
						   trElement.css({"color":"green"});
						break;
						
						case 'DATA SENT TO INVENTORY':
						   trElement.css({"color":"purple"});
						break;
						case 'DATA PROCESSED INVENTORY':
						   trElement.css({"color":"blue"});
						break;
						case 'APPROVED INVENTORY':
						   trElement.css({"color":"red"});
						break;
					}
				}
			}, 
		}); 
 			               
		jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('navGrid','#pms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		if (ms_in<?php echo $bc_prefix;  ?>_import_molt_ms_supplier_customer_id =='-1'){
			$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('setGridParam',{datatype:'json'});
			$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").trigger("reloadGrid"); 
	
		}else{
			$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier_td").hide();
			var postData={ms_supplier_customer_id:ms_in<?php echo $bc_prefix;  ?>_import_molt_ms_supplier_customer_id,mode:'<?php echo $mode;  ?>',id_header:'<?php echo $id_header;  ?>'};
			$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('setGridParam',{postData:postData,datatype:'json'});
			$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").trigger("reloadGrid"); 
		}
		
		$("#ms_in_<?php echo $bc_prefix; ?>_import_invoice_manual_valuta").autocomplete('<?php echo base_url() . 'ms_master/ct_ms_find/find_valuta'; ?>', {
			dataType: 'json',
			parse: function (data) {
				var rows = new Array();
				if (data != null) {
					data = data.rows;
					for (var i = 0; i < data.length; i++) {
						rows[i] = {data: data[i], value: data[i].rID, result: data[i].r1};
					}
				}
				return rows;
			},
			formatItem: function (row, i, n) {
				return (row.r1 == '') ? row.rID : row.rID + ', ' + row.r1;
			},
			extraParams: {
				findtext: function () {
					return $("#ms_in_<?php echo $bc_prefix; ?>_import_invoice_manual_valuta").val()
				}
			},
			max: 10,
			width: 300
		}).result(function(event, row, formatted) { 
			$("#ms_in_<?php echo $bc_prefix; ?>_import_invoice_manual_valuta").val(row.rID); 
		}).bind( "change", function(event, ui) {  
			$("#ms_in_<?php echo $bc_prefix; ?>_import_invoice_manual_valuta").val('');   
		});	 

		
		
		
		
		
		setTimeout(function(){
			setGridHight($("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice"),$("#container_ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice"),$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice_bar")); 
		},50); 
		setTimeout(function(){
			setGridHight($("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier"),$("#container_ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier"),$("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier_bar")); 
		},50); 
 
	});
		  	
</script>

	
	