 <table class ="tablefixed" width="100%"  style="height:100%" border="0" cellpadding="2px">
  <tbody>
    <tr>
      <td id="pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list_td" class="td420">
		<div id="container_pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list" style="height:100%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
			<div class="pane-header ui-state-active" id="pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list_bar" >CUSTOMER LIST
			</div>
			<table id="pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list"></table> <div id="ppasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list"></div>
		</div>  
      </td> 
      <td>  
	  <div id="container_pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list" style="height:100%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
 	   <div class="pane-header ui-state-active" id="pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list_bar" > SA AVAILABLE  
		</div>
			<table id="pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list"></table> <div id="ppasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list"></div>
		</div>  
      </td>
    </tr>
  </tbody>
</table> 

<script type="text/javascript">
    
    $(document).ready(function(){ 
		var ceisa_bc_out<?php echo $bc_prefix;  ?>_cust_code='<?php echo $cust_code;  ?>';
		$(window).bind('resize', function() {  
			setTimeout(function(){
				setGridHight($("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list"),$("#container_pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list"),$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list_bar")); 
				setGridHight($("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list"),$("#container_pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list"),$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list_bar")); 
			},10); 
		}); 
		
		// if ('<?php echo $cust_code;  ?>'ceisa_bc_out<?php echo $bc_prefix;  ?>_cust_code !=''){
			// $("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list_td").hide();
		// }
 
			jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_barang").click(function(){
			var mark_id = jQuery('#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_invoice').jqGrid('getGridParam','selrow');   
			if(!mark_id){ alert("Select SA ");} 
			else {
				var ret = jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_invoice").jqGrid('getRowData',mark_id);    
				var $dialog = jQuery('<div \>')
				 .load('<?php echo base_url().'pasi_ceisa_bc_out/ct_pasi_sa_item'; ?>',{sa_id :ret.rID})
				 .dialog({
					modal:true,
					width : 970,
					height : 555,
					title :'LIST INVOICE',
						buttons: {
							"CLOSE": function(){
								$dialog.dialog("close");  
							} 
						},
						close : function(){
							$dialog.dialog('destroy').remove();
							$('#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_invoice').trigger('reloadGrid');
						},
						open: function(){
							$("body").unblock(); 
						}
					});
			}
			 
		});  
			
	jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").jqGrid({
			url:'<?php echo base_url().'pasi_ceisa_bc_out/ct_pasi_ceisa_bc_out_from_sa/loaddata_cust'; ?>',
			mtype : "post",
			postData:{'q':'1'},
			datatype: "local",
			colNames:[
			'tbl_master_supplier_code_id_master_supp_code','CODE','NAME','SA','ADDRESS','ADDRESS2','CITY'
			,'NPWP'
			]
			,colModel:[
			{name:'rID',index:'rID', width:80, hidden:true, align :'left'}
			,{name:'r1',index:'r1', width:60, hidden:false, align :'left'}
			,{name:'r2',index:'r2', width:250, hidden:false, align :'left'}
			,{name:'r7',index:'r7', width:40, hidden:false, align :'right'}
			,{name:'r3',index:'r3', width:300, hidden:false, align :'left'}
			,{name:'r4',index:'r4', width:250, hidden:true, align :'left'}
			,{name:'r5',index:'r5', width:120, hidden:false, align :'left'}

			,{name:'r6',index:'r6', width:120, hidden:false, align :'left'}

			],
			rowNum:30,
			rowList:[10,20,30,50,100],
			pager: '#ppasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list',
			sortname: 'r1',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height: 100,
			//width: 950,
			//height:300,
			jsonReader: { repeatitems : false },
			rownumbers: true,
			loadonce: false,
			shrinkToFit: false,
			multiselect: false,
			afterInsertRow: function(rowid, aData){
				/*switch (aData.statusdok) {
					case 'DATA SENT':
						jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").jqGrid('setCell',rowid,'statusdok','',{color:'green'});
					break;
					case '2':
						jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").jqGrid('setCell',rowid,'statusdok','',{color:'red'});
					break;
					case '1':
						jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").jqGrid('setCell',rowid,'statusdok','',{color:'blue'});
					break;
					
				} */
			},
			onSelectRow: function(id){ 
			 
			    if(id){  
                  var stret = jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").jqGrid('getRowData',id);
				  var postData={cust_code:stret.r1}
					$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").jqGrid('setGridParam',{postData:postData,datatype:'json'});
					$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").trigger("reloadGrid"); 
					 
               }else{
				 
			   };
			                   
				st_prosses_from_supply=0;
		
            },
			gridComplete: function(){
				var rowIDs = jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").getDataIDs(); 
				var rowData = $("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list'));
				   
					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("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").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("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").jqGrid('navGrid','#ppasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
 		
		jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").jqGrid({
			url:'<?php echo base_url().'pasi_ceisa_master/ct_pasi_sa/loaddata'; ?>',
			datatype: "local",
			mtype : "post",
			postData:{'q':'1'},
	 		colNames:[
					'dt_sa_sa_id','SA','CUST CODE','Invoice\'S','Item\'S','dt_sa_file_data_id'
			  		]
			,colModel:[
					{name:'rID',index:'rID', width:80, hidden:true, align :'right'}
					,{name:'r1',index:'r1', width:220, hidden:false, align :'right'}
					,{name:'r2',index:'r2', width:80, hidden:false, align :'right'}
					,{name:'r3',index:'r3', width:70, hidden:false, align :'right'}
					,{name:'r4',index:'r4', width:55, hidden:false, align :'right'}
					,{name:'r5',index:'r5', width:65, hidden:true, align :'right'} 

					],
		//	rowNum:-1,
			multiselect: true, 
			rowNum:100,
		 	rowList:[10,20,30,50,100,200],
	 		pager: '#ppasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list',
			sortname: 'r1',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height: 100,
			//width: 950,
			//height:300,
			jsonReader: { repeatitems : false }, 
			rownumbers: true,
			loadonce: false,
			shrinkToFit: false, 
			afterInsertRow: function(rowid, aData){
				/*switch (aData.statusdok) {
					case 'DATA SENT':
						jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").jqGrid('setCell',rowid,'statusdok','',{color:'green'});
					break;
					case '2':
						jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").jqGrid('setCell',rowid,'statusdok','',{color:'red'});
					break;
					case '1':
						jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").jqGrid('setCell',rowid,'statusdok','',{color:'blue'});
					break;
					
				} */
			},
			gridComplete: function(){
				var rowIDs = jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").getDataIDs(); 
				var rowData = $("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list'));
				   
					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("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").jqGrid('navGrid','#ppasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		if (ceisa_bc_out<?php echo $bc_prefix;  ?>_cust_code ==''){
			$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").jqGrid('setGridParam',{postData:postData,datatype:'json'});
			$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list").trigger("reloadGrid"); 
	
		}else{
			$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list_td").hide();
			var postData={cust_code:ceisa_bc_out<?php echo $bc_prefix;  ?>_cust_code};
			$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").jqGrid('setGridParam',{postData:postData,datatype:'json'});
			$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list").trigger("reloadGrid"); 
		}
	
	setTimeout(function(){
			setGridHight($("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list"),$("#container_pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list"),$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_cust_list_bar")); 
			setGridHight($("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list"),$("#container_pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list"),$("#pasi_ceisa_bc_out<?php echo $bc_prefix;  ?>_sa_tbl_sa_list_bar")); 
	},100); 
	});
		  	
</script>

	
	