 <div id="container_ms_bc_in<?php echo $bc_prefix;  ?>_in" style="height:100%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
<div class="pane-header ui-state-active" id="ms_bc_in<?php echo $bc_prefix;  ?>_in_bar" >   
	<button type="button" id="ms_bc_in<?php echo $bc_prefix;  ?>_in_new">New</button>
	<button type="button" id="ms_bc_in<?php echo $bc_prefix;  ?>_in_edit">Edit</button> 
	
	<div id="ms_bc_in<?php echo $bc_prefix;  ?>_in_import">
			  <div id="launcherms_bc_in<?php echo $bc_prefix;  ?>_in_import_container">
				<button id="launcherms_bc_in<?php echo $bc_prefix;  ?>_in_import">Import</button>
			  </div>
			  <ul id="menums_bc_in<?php echo $bc_prefix;  ?>_in_import">
				<?php echo $bc_prefix=='23'?'<li id="menums_bc_in'.$bc_prefix.'_in_import_molts"><a href="javascript:void(0);">MOLTS</a></li>':'';  ?>
				<?php echo $bc_prefix!='271'?'<li id="menums_bc_in'.$bc_prefix.'_in_import_ceisa"><a href="javascript:void(0);">CEISA</a></li>':'';  ?>
 				<?php echo $bc_prefix!='262'?'<li id="menums_bc_in'.$bc_prefix.'_in_import_invoice_manual"><a href="javascript:void(0);">'.$invoice_manual_prefix.'</a></li>':'';  ?>
				<li id="menums_bc_in<?php echo $bc_prefix;  ?>_in_import_old"><a href="javascript:void(0);">OLD DATA</a></li>
 			  </ul>
	</div>  
 
	<div id="ms_bc_in<?php echo $bc_prefix;  ?>_in_view">
			  <div id="launcherms_bc_in<?php echo $bc_prefix;  ?>_in_view_container">
				<button id="launcherms_bc_in<?php echo $bc_prefix;  ?>_in_view">View</button>
			  </div>
			  <ul id="menums_bc_in<?php echo $bc_prefix;  ?>_in_view">
 				<li id="menums_bc_in<?php echo $bc_prefix;  ?>_in_view_ceisa"><a href="javascript:void(0);">ITEM</a></li>
  				<li id="menums_bc_in<?php echo $bc_prefix;  ?>_in_view_old"><a href="javascript:void(0);">DOCUMENT</a></li>
 			  </ul>
	</div>   
	
	<div id="ms_bc_in<?php echo $bc_prefix;  ?>_in_module">
			  <div id="launcherms_bc_in<?php echo $bc_prefix;  ?>_in_module_container">
				<button id="launcherms_bc_in<?php echo $bc_prefix;  ?>_in_module">Module</button>
			  </div>
			  <ul id="menums_bc_in<?php echo $bc_prefix;  ?>_in_module">
 				<li id="menums_bc_in<?php echo $bc_prefix;  ?>_in_module_send"><a href="javascript:void(0);">SEND</a></li>
  				<li id="menums_bc_in<?php echo $bc_prefix;  ?>_in_module_syncronize"><a href="javascript:void(0);">SNYCRONIZE</a></li>
 			  </ul>
	</div>  
 
	<button type="button" id="ms_bc_in<?php echo $bc_prefix;  ?>_in_cancel">Cancel</button> 
	<button type="button" id="ms_bc_in<?php echo $bc_prefix;  ?>_in_finish">Finish</button> 
	<button type="button" id="ms_bc_in<?php echo $bc_prefix;  ?>_in_map_supplier">Map Supplier</button> 
</div>
<table id="ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl"></table> <div id="pms_bc_in<?php echo $bc_prefix;  ?>_in_tbl"></div> 

</div>
<script type="text/javascript">
    
    $(document).ready(function(){
	
	$(window).bind('resize', function() {  
		setTimeout(function(){
			setGridHight($("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl"),$("#container_ms_bc_in<?php echo $bc_prefix;  ?>_in"),$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_bar")); 
		},10); 
	}); 
		 
	$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_new").button(); 
	$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_edit").button(); 
    $("#ms_bc_in<?php echo $bc_prefix;  ?>_in_cancel").button();   
	$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_finish").button();   
    $("#ms_bc_in<?php echo $bc_prefix;  ?>_in_map_supplier").button().hide();   


    jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_new").click(function(){  
		var $dialog = jQuery('<div \>')
		 .load('<?php echo base_url().'ms_in/ct_ms_in/new_document'; ?>',{bc_prefix:'<?php echo $bc_prefix;  ?>'})
		 .dialog({
			modal:true,
				width : 1100,
				height : 650,
				title :'CREATE BC <?php echo $bc_prefix;  ?>',
				buttons: {
						"CLOSE": function(){
							$dialog.dialog("close");  
						} 
						
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){
					$("body").unblock(); 
				}
			}); 
	}); 
	
	jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_edit").click(function(){ 
	
		var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
		if(!mark_id){ alert("Pililh data yang akan di edit");exit;}    
		var row_data = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
			
		var $dialog = jQuery('<div \>')
		 .load('<?php echo base_url().'ms_in/ct_ms_in/new_document'; ?>',{bc_prefix:'<?php echo $bc_prefix;  ?>',row_data:row_data})
		 .dialog({
			modal:true,
				width : 1100,
				height : 650,
				title :'EDIT BC <?php echo $bc_prefix;  ?>',
				buttons: {
						"CLOSE": function(){
							$dialog.dialog("close");  
						} 
						
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){
					$("body").unblock(); 
				}
			}); 
	}); 
	
		 
	$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_view").jui_dropdown({
			launcher_id: 'launcherms_bc_in<?php echo $bc_prefix;  ?>_in_view',
			launcher_container_id: 'launcherms_bc_in<?php echo $bc_prefix;  ?>_in_view_container',
			menu_id: 'menums_bc_in<?php echo $bc_prefix;  ?>_in_view',
			containerClass: 'container1',
			menuClass: 'menu1',
			onSelect: function(event, data) {
				if (data.id=='menums_bc_in<?php echo $bc_prefix;  ?>_in_import_molts'){ 
				}else if (data.id=='menums_bc_in<?php echo $bc_prefix;  ?>_in_import_ceisa'){ 
				
				
				
				}
			}
	});
			

			
		 
	$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_module").jui_dropdown({
			launcher_id: 'launcherms_bc_in<?php echo $bc_prefix;  ?>_in_module',
			launcher_container_id: 'launcherms_bc_in<?php echo $bc_prefix;  ?>_in_module_container',
			menu_id: 'menums_bc_in<?php echo $bc_prefix;  ?>_in_module',
			containerClass: 'container1',
			menuClass: 'menu1',
			onSelect: function(event, data) {
			if (data.id=='menums_bc_in<?php echo $bc_prefix;  ?>_in_module_send'){
					var $dialog =  $('<div />')
							.html(' <div class="ui-layout-content ui-widget-content-panel" style="margin-top:10px"> \
							</div>\
							<div class="pane-footer ui-state-default" />')
						 .dialog({
							modal:true,
							width : 500,
							height : 150,
							title :'SEND DOCUMENT BC <?php echo $bc_prefix;  ?>',
							buttons: {
								"CLOSE": function(){
									$dialog.dialog("close");  
								} ,
								"SEND TO CEISA": function(){ 
										var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
										if(!mark_id){ alert("Pililh dokumen yang akan di kirim ke module");exit;}    
											var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
										var form_edit = {      
												ID_HEADER  : ret.rID  
										}; 
										
										jQuery('.ui-dialog button:nth-child(2)').button('disable');  
										$.ajax({    
										url:'<?php echo base_url().'ms_in/ct_ms_in/send_to_module'; ?>',
										type : 'POST',
											data : form_edit,
											dataType: 'json',
											success: function(msg){
												if (msg.valid){
													alert(msg.stsmsg);  
													$dialog.dialog("close");  
												} else { alert(msg.stsno+msg.stsmsg);  }
											} 
										}).always(function() {
										jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
										}); 
										 
								} , 
							},
							close : function(){
								$dialog.dialog('destroy').remove();
								$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
							},
							open: function(){
							$("body").unblock(); 
							}
						}); 
				
			}else if (data.id=='menums_bc_in<?php echo $bc_prefix;  ?>_in_module_syncronize'){ 
					var $dialog =  $('<div />')
							.html(' <div class="ui-layout-content ui-widget-content-panel" style="margin-top:10px"> \
							</div>\
							<div class="pane-footer ui-state-default" />')
						 .dialog({
							modal:true,
							width : 500,
							height : 150,
							title :'SYNC FROM BC <?php echo $bc_prefix;  ?>',
							buttons: {
								"CLOSE": function(){
									$dialog.dialog("close");  
								} ,
								"SYNC FROM CEISA": function(){ 
										var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
										if(!mark_id){ alert("Pililh dokumen yang akan di syncronize");exit;}    
											var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
										var form_edit = {      
												ID_HEADER  : ret.rID  
										}; 
										
										jQuery('.ui-dialog button:nth-child(2)').button('disable');  
										$.ajax({    
										url:'<?php echo base_url().'ms_in/ct_ms_in/sync_data_from_module'; ?>',
										type : 'POST',
											data : form_edit,
											dataType: 'json',
											success: function(msg){
												if (msg.valid){
													alert(msg.stsmsg);  
													$dialog.dialog("close");  
												} else { alert(msg.stsno+msg.stsmsg);  }
											} 
										}).always(function() {
										jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
										}); 
										 
								} , 
							},
							close : function(){
								$dialog.dialog('destroy').remove();
								$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
							},
							open: function(){
							$("body").unblock(); 
							}
						}); 
				


			}
			}
	});
			
 
		   
		 
		 
	$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_import").jui_dropdown({
			launcher_id: 'launcherms_bc_in<?php echo $bc_prefix;  ?>_in_import',
			launcher_container_id: 'launcherms_bc_in<?php echo $bc_prefix;  ?>_in_import_container',
			menu_id: 'menums_bc_in<?php echo $bc_prefix;  ?>_in_import',
			containerClass: 'container1',
			menuClass: 'menu1',
			onSelect: function(event, data) {
				if (data.id=='menums_bc_in<?php echo $bc_prefix;  ?>_in_import_molts'){ 
					var $dialog = jQuery('<div \>')
					 .load('<?php echo base_url().'ms_in/ct_ms_in/view_import_molts'; ?>',{bc_prefix:'<?php echo $bc_prefix;  ?>'})
					 .dialog({
						modal:true,
						width : 950,
						height : 540,
							title :' BC <?php echo $bc_prefix;  ?>  Import From MOLTS',
							buttons: {
								"CLOSE": function(){
									$dialog.dialog("close");  
								} 
								,"CREATE BC <?php echo $bc_prefix;  ?>": function(){ 
								
									var selRowIds;
									 selRowIds =  $("#ms_in<?php echo $bc_prefix;  ?>_import_molts_tbl_molts_invoice").jqGrid('getGridParam','selarrrow'); 
									if (selRowIds.length ==0){
										 alert("Harus memiliki minimal 1 Invoice, Pilih Invoice");
										 exit;
									 } 
									var myArray = [];
									for (var i = 0; i < selRowIds.length; i++) 
									{
										var rowId = selRowIds[i];
										var idnya =  $('#ms_in<?php echo $bc_prefix;  ?>_import_molts_tbl_molts_invoice').getCell(rowId, 'rID'); 
										myArray.push(idnya);
									} 
									var mark_id = jQuery('#ms_in<?php echo $bc_prefix;  ?>_import_molts_tbl_supplier').jqGrid('getGridParam','selrow');   
									if(!mark_id){ alert("Select Supplier ");exit;}    
									var ret = jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_molts_tbl_supplier").jqGrid('getRowData',mark_id);    
									 
									var form_edit = {
											bc_prefix :'<?php echo $bc_prefix;  ?>',      
											supplier_id  : ret.rID,
											lst_id  : myArray  
									};  
									jQuery('.ui-dialog button:nth-child(2)').button('disable'); 
									$.ajax({    
										url:'<?php echo base_url().'ms_in/ct_ms_in/create_bc_molts'; ?>',
										type : 'POST',
											data : form_edit,
											dataType: 'json',
											success: function(msg){
												if (msg.valid){
													alert(msg.stsmsg);  
													$dialog.dialog("close");  
													} else { 
													alert(msg.stsno+msg.stsmsg);    
												}
											} 
										}).always(function() {
												jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
										});  
									
								} 
							},
							close : function(){
								$dialog.dialog('destroy').remove();
								$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
							},
							open: function(){
								$("body").unblock(); 
							}
						});  
						
				}else if (data.id=='menums_bc_in<?php echo $bc_prefix;  ?>_in_import_ceisa'){ 
					var $dialog = jQuery('<div \>')
					 .load('<?php echo base_url().'ms_in/ct_ms_in/view_import_ceisa'; ?>',{bc_prefix:'<?php echo $bc_prefix;  ?>'})
					 .dialog({
						modal:true,
						width : 970,
						height : 550,
							title :'IMPORT <?php echo $bc_prefix;  ?> FROM MODULE CEISA',
							buttons: {
								"CLOSE": function(){
									$dialog.dialog("close");  
								} ,
								"IMPORT DATA": function(){  
									var selRowIds;
									selRowIds =  $("#ms_in_<?php echo $bc_prefix; ?>_header_module_tbl").jqGrid('getGridParam','selarrrow');
									
									var myArray = [];
									for (var i = 0; i < selRowIds.length; i++) 
									{
										var rowId = selRowIds[i];
										var idnya =  $('#ms_in_<?php echo $bc_prefix; ?>_header_module_tbl').getCell(rowId, 'rID'); 
										myArray.push(idnya);
									} 
									
									if (selRowIds.length ==0){
										alert("must have  minimum 1 item ");
										exit;
									}
								 
									var form_edit = {
											bc_prefix :'<?php echo $bc_prefix;  ?>',     
											replace_if_exists        	: $('#replace_if_exist<?php echo $bc_prefix;  ?>').is(':checked')==true?'1':'0',    
											lst  : myArray  
									}; 
									
									jQuery('.ui-dialog button:nth-child(2)').button('disable'); 
									$.ajax({    
									url:'<?php echo base_url().'ms_in/ct_ms_in/import_data_from_module'; ?>',
									type : 'POST',
										data : form_edit,
										dataType: 'json',
										success: function(msg){
											if (msg.valid){
												alert(msg.stsmsg);  
												$dialog.dialog("close");  
											} else { alert(msg.stsno+msg.stsmsg);  }
										} 
									}).always(function() {
												jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
									}); 
									 
								} , 
							},
							close : function(){
								$dialog.dialog('destroy').remove();
								$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
							},
							open: function(){
								$("body").unblock(); 
							}
						}); 
				} else if (data.id=='menums_bc_in<?php echo $bc_prefix;  ?>_in_import_invoice_manual'){ 
					var $dialog = jQuery('<div \>')
					 .load('<?php echo base_url().'ms_in/ct_ms_in/view_import_invoice_manual'; ?>',{bc_prefix:'<?php echo $bc_prefix;  ?>',invoice_prefix_id:'<?php echo $invoice_prefix_id;  ?>',invoice_manual_prefix:'<?php echo $invoice_manual_prefix;  ?>'})
					 .dialog({
						modal:true,
						width : 950,
						height : 540,
							title :' BC <?php echo $bc_prefix;  ?>  Import From <?php echo $invoice_manual_prefix;  ?>',
							buttons: {
								"CLOSE": function(){
									$dialog.dialog("close");  
								} 
								,"CREATE BC <?php echo $bc_prefix;  ?>": function(){ 
								
									var selRowIds;
									 selRowIds =  $("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice").jqGrid('getGridParam','selarrrow'); 
									if (selRowIds.length ==0){
										 alert("Harus memiliki minimal 1 Invoice, Pilih Invoice");
										 exit;
									 } 
									var myArray = [];
									for (var i = 0; i < selRowIds.length; i++) 
									{
										var rowId = selRowIds[i];
										var idnya =  $('#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_invoice_manual_invoice').getCell(rowId, 'rID'); 
										myArray.push(idnya);
									} 
									var mark_id = jQuery('#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier').jqGrid('getGridParam','selrow');   
									if(!mark_id){ alert("Select Supplier ");exit;}    
									var ret = jQuery("#ms_in<?php echo $bc_prefix;  ?>_import_invoice_manual_tbl_supplier").jqGrid('getRowData',mark_id);    
									 
									var form_edit = {
											bc_prefix :'<?php echo $bc_prefix;  ?>',      
											supplier_id  : ret.rID,
											lst_id  : myArray  ,
											invoice_prefix_id :'<?php echo $invoice_prefix_id;  ?>', 
											KODE_VALUTA :$("#ms_in_<?php echo $bc_prefix; ?>_import_invoice_manual_valuta").val(), 
									};  
									jQuery('.ui-dialog button:nth-child(2)').button('disable'); 
									$.ajax({    
										url:'<?php echo base_url().'ms_in/ct_ms_in/create_bc_invoce'; ?>',
										type : 'POST',
											data : form_edit,
											dataType: 'json',
											success: function(msg){
												if (msg.valid){
													alert(msg.stsmsg);  
													$dialog.dialog("close");  
													} else { 
													alert(msg.stsno+msg.stsmsg);    
												}
											} 
										}).always(function() {
												jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
										});  
									
								} 
							},
							close : function(){
								$dialog.dialog('destroy').remove();
								$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
							},
							open: function(){
								$("body").unblock(); 
							}
					});   
				}
			}
		});
			

	 
	
  jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_view_po").click(function(){  
  
		var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
		if(!mark_id){ alert("Select Dokumen ");exit;}    
		var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
				 
		var field_data={bc_prefix:'<?php echo $bc_prefix;  ?>'
						,cust_code:ret.rc
						,id_header:ret.rID
						};
		
		var $dialog = jQuery('<div \>')
		 .load('<?php echo base_url().'ms_bc_in/ct_ms_in/view_sa'; ?>',field_data)
		 .dialog({
			modal:true,
			width : 600,
			height : 400,
				title :'LIST PO',
				buttons: {
					"CLOSE": function(){
						$dialog.dialog("close");  
					} ,
					
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){
					$("body").unblock(); 
				}
			}); 
	}); 
	
  jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_view").click(function(){  
  
		var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
							if(!mark_id){ alert("Select Dokumen ");exit;}    
							var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
				 
		var field_data={bc_prefix:'<?php echo $bc_prefix;  ?>'
						,cust_code:ret.rc
						,id_header:ret.rID
						};
		
		var $dialog = jQuery('<div \>')
		 .load('<?php echo base_url().'ms_bc_in/ct_ms_in/view_item'; ?>',field_data)
		 .dialog({
			modal:true,
			width : 950,
			height : 600,
				title :'LIST ITEM PO',
				buttons: {
					"CLOSE": function(){
						$dialog.dialog("close");  
					} ,
				
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){
					$("body").unblock(); 
				}
			}); 
	}); 
	
	
  jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_view_dokumen").click(function(){  
  
		var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
							if(!mark_id){ alert("Select Dokumen ");exit;}    
							var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
				 
		var field_data={bc_prefix:'<?php echo $bc_prefix;  ?>'
						,cust_code:ret.rc
						,id_header:ret.rID
						};
		
		var $dialog = jQuery('<div \>')
		 .load('<?php echo base_url().'ms_bc_in/ct_ms_in/view_dokumen'; ?>',field_data)
		 .dialog({
			modal:true,
			width : 900,
			height : 500,
				title :'LIST DOCUMENT',
				buttons: {
					"CLOSE": function(){
						$dialog.dialog("close");  
					} ,
				
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){
					$("body").unblock(); 
				}
			}); 
	}); 
	
	
	  jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_cancel").click(function(){  
			var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
			if(!mark_id){ alert("Pililh dokumen yang akan di cancel");exit;}    
						
			var $dialog =  $('<div />')
				.html(' <div class="ui-layout-content ui-widget-content-panel" style="margin-top:10px"> \
				<table class="tablefixed" > \
				<input type="hidden" id="doc_in_id23"> \
							<tr> \
							<td class="td100">Info Cancel</td> \
							  <td width="10"><div align="center">:</div></td> \
								<td colspan="3"><input name="txt_ciesa_bc_<?php echo $bc_prefix;  ?>_info_cancel" type="text" id="txt_ciesa_bc_<?php echo $bc_prefix;  ?>_info_cancel" style="width:100%;text-align:left;" /></td> \
							</tr> \
						</table> \
				</div>\
				<div class="pane-footer ui-state-default" />')
			 .dialog({
				modal:true,
				width : 500,
				height : 150,
				title :'CANCEL DOCUMENT <?php echo $bc_prefix;  ?>',
				buttons: {
					"CLOSE": function(){
						$dialog.dialog("close");  
					} ,
					"CANCEL DOCUMENT": function(){ 
								var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
						 	var form_edit = {      
									ID_HEADER  : ret.rID,
									info  : $('#txt_ciesa_bc_<?php echo $bc_prefix;  ?>_info_cancel').val()  
							}; 
							
							jQuery('.ui-dialog button:nth-child(2)').button('disable'); 
							$.ajax({    
							url:'<?php echo base_url().'ms_in/ct_ms_in/cancel_header'; ?>',
							type : 'POST',
								data : form_edit,
								dataType: 'json',
								success: function(msg){
									if (msg.valid){
										alert(msg.stsmsg);  
										$dialog.dialog("close");  
									} else { alert(msg.stsno+msg.stsmsg);  }
								} 
							}).always(function() {
										jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
							});
							 
					} , 
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){
				$("body").unblock(); 
				}
			}); 
	}); 
		 
	  jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_send_to_module").click(function(){  
			var $dialog =  $('<div />')
				.html(' <div class="ui-layout-content ui-widget-content-panel" style="margin-top:10px"> \
				Data Akan di kirim ke module? \
				</div>\
				 <div class="pane-header ui-state-active" id="ms_bc_in<?php echo $bc_prefix;  ?>_sa_tbl_sa_list_bar2" >TANDA TANGAN</div>\
				 <div class="ui-layout-content ui-widget-content-panel">\
			 	 <label class="lbfield55">NAME</label><label class="lbcolon">:</label><input id="ms_bc_in<?php echo $bc_prefix;  ?>_tdd_name"name="ms_bc_in_tdd_name"  style="width:185px"   type="text" /><br \>\
				 <label class="lbfield55">JABATAN</label><label class="lbcolon">:</label><input id="ms_bc_in<?php echo $bc_prefix;  ?>_tdd_jabatan"name="ms_bc_in_tdd_jabatan"   style="width:185px"  type="text" />\
				</div>\
				<div class="pane-footer ui-state-default" />')
			 .dialog({
				modal:true,
				width : 500,
				height : 250,
				title :'SEND DOCUMENT <?php echo $bc_prefix;  ?>',
				buttons: {
					"CLOSE": function(){
						$dialog.dialog("close");  
					} ,
					"SEND DOCUMENT": function(){ 
							var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
						 	if(!mark_id){ alert("Pililh dokumen yang akan di kirim ke module");exit;}    
								var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
						 	
							var form_edit = {      
									id_header  : ret.rID, 
					 				tdd_name  : $( "#ms_bc_in<?php echo $bc_prefix;  ?>_tdd_name" ).val(), 
									tdd_jabatan  : $( "#ms_bc_in<?php echo $bc_prefix;  ?>_tdd_jabatan" ).val(), 
							}; 
							
							jQuery('.ui-dialog button:nth-child(2)').button('disable'); 
							$.ajax({    
							url:'<?php echo base_url().'ms_bc_in/ct_ms_in/send_to_module'; ?>',
							type : 'POST',
								data : form_edit,
								dataType: 'json',
								success: function(msg){
									if (msg.valid){
										alert(msg.stsmsg);  
										$dialog.dialog("close");  
									} else { alert(msg.stsno+msg.stsmsg);  }
								} 
							}).always(function() {
										jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
							});
							 
					} , 
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){
				 			$.ajax({    
									url:'<?php echo base_url().'ms_bc_in/ct_ms_in/load_setting_default'; ?>',
									type : 'POST',
										data : {bc_prefix:'<?php echo $bc_prefix;  ?>'},
										dataType: 'json',
										success: function(msg){
											if (msg.valid){
												$( "#ms_bc_in<?php echo $bc_prefix;  ?>_tdd_name" ).val(msg.data['TDD_NAME']);
												$( "#ms_bc_in<?php echo $bc_prefix;  ?>_tdd_jabatan" ).val(msg.data['TDD_JABATAN']); 
											}  
										} 
							});
					$("body").unblock(); 
				}
			}); 
	}); 
	
	  jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_update_from_module").click(function(){  
			var $dialog =  $('<div />')
				.html(' <div class="ui-layout-content ui-widget-content-panel" style="margin-top:10px"> \
				Sync data from module? \
				<div class="pane-footer ui-state-default" />')
			 .dialog({
				modal:true,
				width : 500,
				height : 150,
				title :'SYNC DOCUMENT FROM MODULE <?php echo $bc_prefix;  ?>',
				buttons: {
					"CLOSE": function(){
						$dialog.dialog("close");  
					} ,
					"SYNC DOCUMENT": function(){ 
							var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
						 	if(!mark_id){ alert("Pililh dokumen yang akan di kirim ke module");exit;}    
								var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
						 	
							var form_edit = {      
									id_header  : ret.rID, 
				 			}; 
							
							jQuery('.ui-dialog button:nth-child(2)').button('disable'); 
							$.ajax({    
							url:'<?php echo base_url().'ms_bc_in/ct_ms_in/update_from_module'; ?>',
							type : 'POST',
								data : form_edit,
								dataType: 'json',
								success: function(msg){
									if (msg.valid){
										alert(msg.stsmsg);  
										$dialog.dialog("close");  
									} else { alert(msg.stsno+msg.stsmsg);  }
								} 
							}).always(function() {
										jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
							});
							 
					} , 
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){ 
					$("body").unblock(); 
				}
			}); 
	}); 
		

	  jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_map_supplier").click(function(){  
		var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
		if(!mark_id){ alert("Pililh dokumen");exit;}  
		var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
		var $dialog = jQuery('<div \>')
		 .load('<?php echo base_url().'pasi_ceisa_master/ct_pasi_map_customer'; ?>',{bc_prefix:'<?php echo $bc_prefix;  ?>',source_npwp:ret.r11,source_name:ret.r12,source_address:ret.r14})
		 .dialog({
			modal:true,
			width : 970,
			height : 550,
				title :'MAPPING SUPPLIER',
				buttons: {
					"CLOSE": function(){
						$dialog.dialog("close");  
					} ,
					"MAPPING": function(){  
						var mark_id_cust = jQuery('#pasi_ceimap_cust_master_<?php echo $bc_prefix;  ?>map_cust_tbl').jqGrid('getGridParam','selrow');   
						if(!mark_id_cust){ alert("Pililh Customer");exit;}  
						var ret_cust = jQuery("#pasi_ceimap_cust_master_<?php echo $bc_prefix;  ?>map_cust_tbl").jqGrid('getRowData',mark_id_cust);    

						var form_edit = {
								id_header :ret.rID,     
								cust_code :ret_cust.r1
						}; 
						
						jQuery('.ui-dialog button:nth-child(2)').button('disable'); 
						$.ajax({    
						url:'<?php echo base_url().'ms_bc_in/ct_ms_in/update_mapping_customer'; ?>',
						type : 'POST',
							data : form_edit,
							dataType: 'json',
							success: function(msg){
								if (msg.valid){
									alert(msg.stsmsg);  
									$dialog.dialog("close");  
								} else { alert(msg.stsno+msg.stsmsg);  }
							} 
						}).always(function() {
										jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
						});
						 
					} , 
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){
					jQuery('.ui-dialog button:nth-child(1)').attr('tabindex', jQuery('.ui-dialog button:nth-child(2)').attr('tabindex') +1);  
 				
					$("body").unblock(); 
				}
			}); 
	}); 

	  jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_finish").click(function(){  
				var mark_id = jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').jqGrid('getGridParam','selrow');   
						 	if(!mark_id){ alert("Pililh dokumen yang update status finish");exit;}    
 				var ret = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('getRowData',mark_id);    
				
				var $dialog =  $('<div />')
				.load('<?php echo base_url().'ms_in/ct_ms_in/view_finish'; ?>',{bc_prefix:'<?php echo $bc_prefix;  ?>',id_header:ret.rID})
				.dialog({
				modal:true,
				width : 500,
				height : 240,
				title :'FINISH DOCUMENT BC <?php echo $bc_prefix;  ?>',
				buttons: {
					"CLOSE": function(){
						$dialog.dialog("close");  
					} ,
					
					"FINISH": function(){ 
					
				 			var form_edit = {      
									ID_HEADER  	: ret.rID, 
									receive_no 	:  $( "#ms_bc_in<?php echo $bc_prefix;  ?>_receive_no" ).val(),
									receive_date:	$.datepicker.formatDate('yymmdd', new Date($("#ms_bc_in<?php echo $bc_prefix;  ?>_receive_date").datepicker( "getDate" ))),
 									ndpbm_usd 	:  $( "#ms_bc_in<?php echo $bc_prefix;  ?>_receive_ndpbm_usd" ).val(),
									ndpbm_hdr 	:  $( "#ms_bc_in<?php echo $bc_prefix;  ?>_receive_ndpbm_hdr" ).val(), 
									finish_date :	$.datepicker.formatDate('yymmdd', new Date($("#ms_bc_in<?php echo $bc_prefix;  ?>_finish_date").datepicker( "getDate" ))),
									finish_time	:  $( "#ms_bc_in<?php echo $bc_prefix;  ?>_finish_time" ).val(),
										
							}
	 
							jQuery('.ui-dialog button:nth-child(2)').button('disable'); 
							$.ajax({    
							url:'<?php echo base_url().'ms_in/ct_ms_in/finish_header'; ?>',
							type : 'POST',
								data : form_edit,
								dataType: 'json',
								success: function(msg){
									if (msg.valid){
										alert(msg.stsmsg);  
										$dialog.dialog("close");  
									} else { alert(msg.stsno+msg.stsmsg);  }
								} 
							}).always(function() {
										jQuery('.ui-dialog button:nth-child(2)').button('enable'); 
							}); 
							 
					} , 
				},
				close : function(){
					$dialog.dialog('destroy').remove();
					$('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl').trigger('reloadGrid');
				},
				open: function(){ 
					jQuery('.ui-dialog button:nth-child(1)').attr('tabindex', jQuery('.ui-dialog button:nth-child(2)').attr('tabindex') +1);  
 				
					$("body").unblock(); 
				}
			}); 
	}); 
	
	
	
	
jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid({
			url:'<?php echo base_url().'ms_in/ct_ms_in/loaddata'; ?>',
			mtype : "post",
			postData:{bc_prefix:'<?php echo $bc_prefix;  ?>'},
			datatype: "json"
			,colNames:[
'ID_HEADER','h_status_status_tpb_in_id','STATUS','mode_source_id','SOURCE','is_get'
,'KODE_DOKUMEN_PABEAN','CAR ( NO AJU )','PJT','NO','DATE'
,'KODE_STATUS','MODULE STATUS','KODE_TUJUAN_IN_OUT','TARGET','dt_ms_supplier_customer_id_type','CODE','NAME','ADDRESS'
,'dt_ms_supplier_customer_INTERNAL_KODE_NEGARA_PENGIRIM','COUNTRY','dt_ms_supplier_customer_api_type_id','IDENTITAS','API','SKEP'
,'dt_ms_supplier_customer_skep_date','IDENTITAS'
,'NAME','MODULE_KODE_ID_PENGIRIM','ADDRESS','MODULE_KODE_NEGARA_PENGIRIM','COUNTRY'
,'CODE','VALUE','TERM','TOTAL'
,'TYPE','VALUE','VALUE ADDED','DISCONT','FREIGHT'
,'BRUTO','NETTO','ITEM','PACKAGE','CONTAINER'
,'CODE','NAME','CODE','NAME','NO'
,'DATE','FINISH ENTRY','STUFFING','INFO','DATE'
,'BY','DATE','BY','DATE','BY'
,'ID_HEADER_ORI','r21id'
]
,colModel:[
{name:'rID',index:'rID', width:80, hidden:true, align :'right'}
,{name:'r1',index:'r1', width:80, hidden:true, align :'right'}
,{name:'r2',index:'r2', width:80, stype: 'select', search:true, searchoptions:{searchhidden: true, value: '-100:All;0:DRAFT;1:SEND TO MODULE;2:MAPPING;3:FINISH;-1:CANCEL'}}
,{name:'r3',index:'r3', width:80, hidden:true, align :'right'}
,{name:'r4',index:'r4', width:70, hidden:false, align :'left'}
,{name:'r5',index:'r5', width:80, hidden:true, align :'right'}

,{name:'r6',index:'r6', width:80, hidden:true, align :'right'}
,{name:'r7',index:'r7', width:230, hidden:false, align :'left'}
,{name:'r8',index:'r8', width:50, editable: false, formatter:'checkbox',  align: "center",stype: "select", searchoptions: { value: "-100:All;1:Yes;0:No" }}
,{name:'r10',index:'r10', width:80, hidden:false, align :'left'}
,{name:'r9',index:'r9', width:80, hidden:false, align :'left' , searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl")[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:'r11',index:'r11', width:80, hidden:true, align :'right'}
,{name:'r12',index:'r12', width:200, hidden:false, align :'left'}
,{name:'r13',index:'r13', width:80, hidden:true, align :'right'}
,{name:'r14',index:'r14', width:80, hidden:false, align :'left'}

,{name:'r21',index:'r21', width:80, hidden:true, align :'left'}
,{name:'r23',index:'r23', width:80, hidden:false, align :'left'}
,{name:'r24',index:'r24', width:200, hidden:false, align :'left'}
,{name:'r25',index:'r25', width:300, hidden:false, align :'left'}

,{name:'r26',index:'r26', width:80, hidden:true, align :'left'}
,{name:'r27',index:'r27', width:80, hidden:false, align :'left'}
,{name:'r28',index:'r28', width:80, hidden:true, align :'left'}
,{name:'r22',index:'r22', width:80, hidden:false, align :'left'}
,{name:'r29',index:'r29', width:80, hidden:false, align :'left'}
,{name:'r30',index:'r30', width:80, hidden:false, align :'left'}

,{name:'r31',index:'r31', width:80, hidden:true, align :'left' , searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl")[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:'r15',index:'r15', width:80, hidden:false, align :'left'}

,{name:'r16',index:'r16', width:200, hidden:false, align :'left'}
,{name:'r17',index:'r17', width:80, hidden:true, align :'left'}
,{name:'r18',index:'r18', width:300, hidden:false, align :'left'}
,{name:'r19',index:'r19', width:80, hidden:true, align :'left'}
,{name:'r20',index:'r20', width:80, hidden:false, align :'left'}

,{name:'r32',index:'r32', width:60, hidden:false, align :'left'}
,{name:'r33',index:'r33', width:80, hidden:false, align :'right'}
,{name:'r34',index:'r34', width:60, hidden:false, align :'left'}
,{name:'r35',index:'r35', width:80, hidden:false, align :'right'}

,{name:'r36',index:'r36', width:60, hidden:false, align :'left'}
,{name:'r37',index:'r37', width:80, hidden:false, align :'right'}
,{name:'r38',index:'r38', width:80, hidden:false, align :'right'}
,{name:'r39',index:'r39', width:80, hidden:false, align :'right'}
,{name:'r40',index:'r40', width:80, hidden:false, align :'right'}

,{name:'r41',index:'r41', width:80, hidden:false, align :'right'}
,{name:'r42',index:'r42', width:80, hidden:false, align :'right'}
,{name:'r43',index:'r43', width:80, hidden:false, align :'right'}
,{name:'r44',index:'r44', width:80, hidden:false, align :'right'}
,{name:'r45',index:'r45', width:80, hidden:false, align :'right'}

,{name:'r46',index:'r46', width:60, hidden:false, align :'left'}
,{name:'r47',index:'r47', width:150, hidden:false, align :'left'}
,{name:'r48',index:'r48', width:60, hidden:false, align :'left'}
,{name:'r49',index:'r49', width:150, hidden:false, align :'left'}
,{name:'r50',index:'r50', width:80, hidden:false, align :'left'}

,{name:'r51',index:'r51', width:80, hidden:false, align :'left' , searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl")[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:'r52',index:'r52', width:120, hidden:false, align :'left' , searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl")[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:'r53',index:'r53', width:80, hidden:true, align :'left'}
,{name:'r54',index:'r54', width:80, hidden:false, align :'left'}
,{name:'r55',index:'r55', width:80, hidden:false, align :'left' , searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl")[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:'r56',index:'r56', width:80, hidden:false, align :'left'}
,{name:'r57',index:'r57', width:80, hidden:false, align :'left' , searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl")[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:'r58',index:'r58', width:80, hidden:false, align :'left'}
,{name:'r59',index:'r59', width:80, hidden:false, align :'left' , searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl")[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:'r60',index:'r60', width:80, hidden:false, align :'left'}

,{name:'r61',index:'r61', width:80, hidden:true, align :'right'}
,{name:'r21id',index:'r21id', width:80, hidden:true, align :'right'}

],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#pms_bc_in<?php echo $bc_prefix;  ?>_in_tbl',
			sortname: 'r57',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height: 100,
			//width: 950,
			//height:300,
			jsonReader: { repeatitems : false },
			caption:"Data BC <?php echo $bc_prefix;  ?>",
			rownumbers: true,
			loadonce: false,
			shrinkToFit: false,
			multiselect: false,
			afterInsertRow: function(rowid, aData){
				/*switch (aData.statusdok) {
					case 'DATA SENT':
						jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('setCell',rowid,'statusdok','',{color:'green'});
					break;
					case '2':
						jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('setCell',rowid,'statusdok','',{color:'red'});
					break;
					case '1':
						jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('setCell',rowid,'statusdok','',{color:'blue'});
					break;
					
				} */
			},
		    onSelectRow: function(rowid){ 
				var rowData = $("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").getRowData(rowid); 
		 		if (rowData.rg == 'Yes' ){
					$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_map_supplier").show();
				}
				else{
					$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_map_supplier").hide();
			   }
	 
  		 	 },
			gridComplete: function(){
				var rowIDs = jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").getDataIDs(); 
				var rowData = $("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl'));
				   
					switch (rowData[i].r1) {
						case '1':
						   trElement.css({"color":"green"});
						break;
						
						case '2':
						   trElement.css({"color":"purple"});
						break;
						
						case '3':
						   trElement.css({"color":"blue"});
						break;
						case '-1':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
		
		jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('setGroupHeaders', 
            { useColSpanStyle: true, groupHeaders:[
			{startColumnName: 'r7', numberOfColumns: 4, titleText: '<em><center>REGISTER</center></em>'},
			{startColumnName: 'r15', numberOfColumns: 6, titleText: '<em><center>SOURCE SUPPLIER</center></em>'}, 
     		{startColumnName: 'r21', numberOfColumns: 11, titleText: '<em><center>INTERNAL SUPPLIER</center></em>'}, 
     		{startColumnName: 'r32', numberOfColumns: 2, titleText: '<em><center>VALUTA</center></em>'}, 
     		{startColumnName: 'r34', numberOfColumns: 2, titleText: '<em><center>PRICE</center></em>'}, 
     		{startColumnName: 'r36', numberOfColumns: 2, titleText: '<em><center>INSURANCE</center></em>'}, 
     		{startColumnName: 'r43', numberOfColumns: 3, titleText: '<em><center>COUNT</center></em>'}, 
      		{startColumnName: 'r46', numberOfColumns: 2, titleText: '<em><center>KPBC LOADING</center></em>'}, 
      		{startColumnName: 'r48', numberOfColumns: 2, titleText: '<em><center>PORT LOADING</center></em>'}, 
      		{startColumnName: 'r50', numberOfColumns: 2, titleText: '<em><center>RECEIVE</center></em>'}, 
       		{startColumnName: 'r54', numberOfColumns: 3, titleText: '<em><center>STATUS</center></em>'}, 
      		{startColumnName: 'r57', numberOfColumns: 2, titleText: '<em><center>CREATE</center></em>'}, 
      		{startColumnName: 'r59', numberOfColumns: 2, titleText: '<em><center>MODIFY</center></em>'}, 
         ] });
			               
		jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('navGrid','#pms_bc_in<?php echo $bc_prefix;  ?>_in_tbl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
	
	
		
	setTimeout(function(){
			setGridHight($("#ms_bc_in<?php echo $bc_prefix;  ?>_in_tbl"),$("#container_ms_bc_in<?php echo $bc_prefix;  ?>_in"),$("#ms_bc_in<?php echo $bc_prefix;  ?>_in_bar")); 
		},100); 
	});
		  	
</script>

	
	