 <table class ="tablefixed" width="100%"   border="0" cellpadding="2px"  id="container_ms_out<?php echo $bc_prefix;  ?>_import_memo">  
    <tr class="trauto" >
      <td  class="td450" id="container_ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer">
	    <div class="pane-header ui-state-active" id="ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo_bar" > 
 	 		CUSTOMER LIST
			  </div>
			<table id="ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer"></table> <div id="pms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer"></div>
	     </td> 
		<td class="tdauto" id="container_ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo" valign="top">  
	 	<div class="pane-header ui-state-active" id="ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer_bar" > MEMO READY </div>
		 				
	  				
		<table id="ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo"></table> <div id="pms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo"></div>
      </td>
    </tr>  
</table> 	 
	
<style>
 
</style> 

<script type="text/javascript">
    setTimeout(function(){
			setGridHight($("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo"),$("#container_ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo"),$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo_bar"), <?php echo $bc_prefix=='PEMUSNAHAN'?30:0;  ?>); 
			setGridHight($("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer"),$("#container_ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer"),$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer_bar")); 
		},50); 
 
    $(document).ready(function(){ 
		var ms_out<?php echo $bc_prefix;  ?>_import_molt_ms_supplier_customer_id='-1';
		  
			
	jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid({
			url:'<?php echo base_url().'ms_out/ct_ms_out/loaddata_customer_memo'; ?>',
			mtype : "post",
			postData:{memo_prefix_id:'<?php echo $memo_prefix_id;  ?>'
					,mode_source:'1'
					},
			datatype: "local",
			colNames:[
			'ms_supplier_customer_id','Code','Name','CN','Ready','Draft'
			,'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_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer',
			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_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid('setCell',rowid,'statusdok','',{color:'green'});
					break;
					case '2':
						jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid('setCell',rowid,'statusdok','',{color:'red'});
					break;
					case '1':
						jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid('setCell',rowid,'statusdok','',{color:'blue'});
					break;
					
				} */
			},
			onSelectRow: function(id){  
			    if(id){  
					if ('<?php echo $memo_prefix_id;  ?>'!='0'){
							var stret = jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid('getRowData',id);
							var postData={
							   ms_supplier_customer_id:stret.rID
							   ,memo_prefix_id:'<?php echo $memo_prefix_id;  ?>' 
							   ,bc_prefix:'<?php echo $bc_prefix;  ?>' 
							  }
							$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('setGridParam',{postData:postData,datatype:'json'});
							$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").trigger("reloadGrid");  
					}
				}else{
					  var postData={
							ms_supplier_customer_id:'-1'
							,memo_prefix_id:'<?php echo $memo_prefix_id;  ?>' 
						   ,bc_prefix:'<?php echo $bc_prefix;  ?>' 
							}
							
						$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('setGridParam',{postData:postData,datatype:'json'});
						$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").trigger("reloadGrid");  
			   }; 
				
  			                   
				// st_prosses_from_supply=0;
		
            },
			gridComplete: function(){
				// var rowIDs = jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").getDataIDs(); 
				// var rowData = $("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").getRowData();
			
				// for (var i = 0; i < rowData.length; i++) 
				// {
				   // var trElement = jQuery("#"+ rowIDs[i],jQuery('#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer'));
				   
					// 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_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid('setGroupHeaders', 
            // { useColSpanStyle: true, groupHeaders:[
			// {startColumnName: 'BC23No', numberOfColumns: 2, titleText: '<em><center>C</center></em>'},
			// {startColumnName: 'PasokNama', numberOfColumns: 3, titleText: '<em><center>customer</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_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid('navGrid','#pms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
 		
		jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid({
			url:'<?php echo base_url().'ms_out/ct_ms_out/loaddata_customer_memo_list'; ?>',
			datatype: "local",
			mtype : "post",
			postData:{
				memo_prefix_id:'<?php echo $memo_prefix_id;  ?>'
				,mode_source:'1'
				},
	 		colNames:[
			'ms_memo_header_id','Memo No','Memo Date','Item\'s','Info','ms_supplier_customer_id'

			]
			,colModel:[
			{name:'rID',index:'rID', width:80, hidden:true, align :'right'}
			,{name:'r1',index:'r1', width:200, 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:'r4',index:'r4', width:80, hidden:false, align :'right'}
		,{name:'r3',index:'r3', width:200, hidden:false, align :'right'}
			,{name:'r5',index:'r5', width:80, hidden:true, align :'right'}


			],
		//	rowNum:-1,
			multiselect: true, 
			rowNum:100,
		 	rowList:[10,20,30,50,100,200],
	 		pager: '#pms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo',
			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_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('setCell',rowid,'statusdok','',{color:'green'});
					break;
					case '2':
						jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('setCell',rowid,'statusdok','',{color:'red'});
					break;
					case '1':
						jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('setCell',rowid,'statusdok','',{color:'blue'});
					break;
					
				} */
			},
			gridComplete: function(){
				var rowIDs = jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").getDataIDs(); 
				var rowData = $("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo'));
				   
					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_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('navGrid','#pms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		if (ms_out<?php echo $bc_prefix;  ?>_import_molt_ms_supplier_customer_id =='-1'){
			$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").jqGrid('setGridParam',{datatype:'json'});
			$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer").trigger("reloadGrid"); 
	
		}else{
			$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer_td").hide();
			var postData={ms_supplier_customer_id:ms_out<?php echo $bc_prefix;  ?>_import_molt_ms_supplier_customer_id,mode:'<?php echo $mode;  ?>',id_header:'<?php echo $id_header;  ?>'};
			$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('setGridParam',{postData:postData,datatype:'json'});
			$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").trigger("reloadGrid"); 
		}
		
		$("#ms_out_<?php echo $bc_prefix; ?>_import_memo_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_out_<?php echo $bc_prefix; ?>_import_memo_valuta").val()
				}
			},
			max: 10,
			width: 300
		}).result(function(event, row, formatted) { 
			$("#ms_out_<?php echo $bc_prefix; ?>_import_memo_valuta").val(row.rID); 
		}).bind( "change", function(event, ui) {  
			$("#ms_out_<?php echo $bc_prefix; ?>_import_memo_valuta").val('');   
		});	  
		
		if ('<?php echo $memo_prefix_id;  ?>'=='0'){
					var postData={
					   ms_supplier_customer_id:'-1'
					   ,memo_prefix_id:'<?php echo $memo_prefix_id;  ?>' 
					   ,bc_prefix:'<?php echo $bc_prefix;  ?>' 
					  }
					$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").jqGrid('setGridParam',{postData:postData,datatype:'json'});
					$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo").trigger("reloadGrid");  
		} 
		
		setTimeout(function(){
			setGridHight($("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo"),$("#container_ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo"),$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_memo_bar"), <?php echo $bc_prefix=='PEMUSNAHAN'?30:0;  ?>); 
	 		setGridHight($("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer"),$("#container_ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer"),$("#ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer_bar")); 
		},50); 
		
	 if ('<?php echo $bc_prefix;  ?>'=='PEMUSNAHAN'){
		 $('#container_ms_out<?php echo $bc_prefix;  ?>_import_memo tr td').filter('#container_ms_out<?php echo $bc_prefix;  ?>_import_memo_tbl_customer').hide();
		 
	 }
			
 
	});
		  	
</script>

	
	