<div id="tabdocbc23_dtl" style="height:440px">
	<ul>
		<li><a id="idtabitemsbc23hdr_dtl" href="#divtabitemsbc23hdr_dtl">Header Dokumen</a></li>
		<li><a id="idtabitemsbc23_dtl" href="#divtabitemsbc23_dtl">Detil Barang</a></li>
		<li><a id="idtabdocumentsbc23_dtl" href="#divtabdocumentsbc23_dtl">Dokumen</a></li>
		<li><a id="idtabcontainernc23_dtl" href="#divtabcontainernc23_dtl">Peti Kemas</a></li>
		<!--<li><a id="idtabharga_dtl" href="#divtabharga_dtl">Harga</a></li>
		<li><a id="idtabkemasan_dtl" href="#divtabkemasan_dtl">Jml dan Jns Kemasan</a></li>-->
	</ul>
	<div id="divtabitemsbc23hdr_dtl" >
		<button id="btnviewhdrbc23_dtl" >View Form</button>
		<div style="height:10px"></div>
		<table id="tblbc23hdr_dtl"></table> <!-- <div id="ptblbc23hdr_dtl"></div> -->
		<br />
		Pilih datanya dahulu sebelum update:
		<table>
			<tr>
				<td>Masukan Nomor CAR</td><td>:</td><td><input type="text" id="txtcarbc23hdr" style="width:200px"/></td>
			</tr>
			<tr>
				<td>Masukan Nomor Daftar</td><td>:</td><td><input type="text" id="txtnodaftarbc23hdr" style="width:100px" maxlength=6/></td>
			</tr>
			<tr>
				<td>Masukan Tanggal Daftar</td><td>:</td><td><input type="text" id="txttgldaftarbc23hdr" style="width:100px"/></td>
			</tr>
			<tr>
				<td></td><td></td><td><button id="btnupdaprosesbc23manual" >Update</button></td>
			</tr>
		</table>
		<div style="position:absolute;left:360px;top:148px">
			<table >
			   <tr>
				<td style="text-align:center;" >No. BL</td><td>:</td><td><?php echo $nobl; ?></td><td><input type="text" id="txtviewnoblbc23hdr" style="width:140px;text-transform:uppercase;" /><button id="btnupdatenobl_bc23">Update BL</button></td>
			   </tr>
			   <tr>
				<td style="text-align:center;" >CAR </td><td>:</td><td><?php echo $car; ?></td><td><input type="text" id="txtupdatecarbc23hdr" style="width:190px;text-transform:uppercase;" maxlength="26"/><button id="btnupdatecar_bc23">Update CAR</button></td>
			   </tr>
			</table>
		</div>
		<?php if($this->session->userdata('DX_username') == 'admin' || $this->session->userdata('DX_username') == 'yayan' || $this->session->userdata('DX_username') == 'nurhadi'){ ?>
			<button id="btnupdatetglnobc">Update Tgl/No BC </button>
		<?php }; ?>
	</div>
	<div id="divtabitemsbc23_dtl" >
		<button id="btnviewitembc23_dtl" >View Form</button>
		<button id="btnviewpartitembc23_dtl" >Data Part</button>
		<button id="btnupdateitembc23_dtl_frommodul" >Update Part Kosong</button>
		<button id="btnupdateitembc23_dtl_cekmodul" >Check Detil Modul</button>
		<div style="height:10px"></div>
		<table id="tblbc23detilitems"></table> <div id="ptblbc23detilitems"></div>
	</div>
	<div id="divtabdocumentsbc23_dtl" >
		<button id="btnviewdokbc23_dtl" >View Form</button>
		<button id="btnupdatedokbc23_dtl" >Update Dokumen</button>
		<button id="btncekdokbc23_dtl" >Cek Invoice</button>
		<button id="btncancel_bc23" >Cancel DATA!</button>
		<div style="height:10px"></div>
		<table id="tblbc23dok"></table> <div id="ptblbc23dok"></div>
	</div>
	<div id="divtabcontainernc23_dtl" >
		<div style="height:10px"></div>
		<table id="tblbc23con"></table> <div id="ptblbc23con"></div>
	</div>
	<div id="divtabharga_dtl" ></div>
	<div id="divtabkemasan_dtl" ></div>
</div>	
<input type="hidden" id="idhdrbc23" value="<?php echo $idhdrbc23; ?>" />
<input type="hidden" id="inv_hdr_idbc23" value="<?php echo $inv_hdr_idbc23; ?>" />
<input type="hidden" id="bc23noinv" value="<?php echo $noinv; ?>" />
<input type="hidden" id="hdnbc23dtl_car" value="<?php echo $car; ?>" />
<script type="text/javascript">
    $(document).ready(function(){
		$( "#tabdocbc23_dtl" ).tabs();
		$( "#btnviewdokbc23_dtl" ).button();
		$( "#btnupdatedokbc23_dtl" ).button();
		
		var datesetopt = {
			showOn: "button",
			buttonImageOnly: true,
			buttonImage: "<?php echo base_url()."assets/images/icons/16x16/timespan.png"  ?>",
			buttonText: "Tanggalan",
			dateFormat: 'mm/dd/yy'
		};
		
		$("#txtviewnoblbc23hdr").focusout(function(){
			var value = $("#txtviewnoblbc23hdr").val(); 
			value = value.replace(/\s/g, '');
			$("#txtviewnoblbc23hdr").val(value);
			
		});
		
		$("#btnupdatenobl_bc23").click(function(){
					
			
			var form_data_bl_baru = {
				
				nobl_baru:$.trim($("#txtviewnoblbc23hdr").val().toUpperCase()),
				idbc23:$("#idhdrbc23").val()  
			
			};
			
			
			$("#update_nobl_bc23_manual").dialog( "destroy" );
			$(".update_nobl_bc23_manualcl").remove();
			$(".update_nobl_bc23_manualcl").html('');
			$("body").append('<div id="update_nobl_bc23_manual" title="Warning" class="update_nobl_bc23_manualcl"><p>Apakah anda akan melakukan Update Terhadap no BL ini?</p><br /> -> '+ $("#txtviewnoblbc23hdr").val().toUpperCase() +'<br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');
			$("#update_nobl_bc23_manual").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_bc23/updatenobl'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data_bl_baru,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#update_nobl_bc23_manual").dialog("close");
								$('#update_nobl_bc23_manual').dialog("destroy"); 
								$(".update_nobl_bc23_manualcl").remove(); 
								$(".update_nobl_bc23_manualcl").html('');
								$('#tblbc23hdr').trigger('reloadGrid');
							
							} else { 
								alert(msg.sts+msg.desc);
								$("#update_nobl_bc23_manual").dialog("close");
								$('#update_nobl_bc23_manual').dialog("destroy"); 
								$(".update_nobl_bc23_manualcl").remove(); 		

							}
						}
					});
				},
				"CANCEL": function() {
						$( "#update_nobl_bc23_manual" ).dialog( "close" );

					}
				},
				close : function(){
					$('#update_nobl_bc23_manual').dialog("destroy"); 
					$(".update_nobl_bc23_manualcl").remove(); 
					$("body").append('<div id="update_nobl_bc23_manual" title="Warning" class="update_nobl_bc23_manualcl"><p>Apakah anda akan melakukan Update Terhadap no BL ini?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');     
					$(".update_nobl_bc23_manualcl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});		
		
		
		});
		
		$("#btnupdatecar_bc23").click(function(){
			var form_data_car_baru = {
				
				nocar_baru:$.trim($("#txtupdatecarbc23hdr").val().toUpperCase()),
				idbc23:$("#idhdrbc23").val()  
			
			};
			
			
			$("#update_nocar_bc23_manual").dialog( "destroy" );
			$(".update_nocar_bc23_manualcl").remove();
			$(".update_nocar_bc23_manualcl").html('');
			$("body").append('<div id="update_nocar_bc23_manual" title="Warning" class="update_nocar_bc23_manualcl"><p>Apakah anda akan melakukan Update Terhadap no CAR ini?</p><br /> -> '+ $("#txtupdatecarbc23hdr").val().toUpperCase() +'<br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');
			$("#update_nocar_bc23_manual").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_bc23/updatenocar'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data_car_baru,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#update_nocar_bc23_manual").dialog("close");
								$('#update_nocar_bc23_manual').dialog("destroy"); 
								$(".update_nocar_bc23_manualcl").remove(); 
								$(".update_nocar_bc23_manualcl").html('');
								$('#tblbc23hdr').trigger('reloadGrid');
							
							} else { 
								alert(msg.sts+msg.desc);
								$("#update_nocar_bc23_manual").dialog("close");
								$('#update_nocar_bc23_manual').dialog("destroy"); 
								$(".update_nocar_bc23_manualcl").remove(); 		

							}
						}
					});
				},
				"CANCEL": function() {
						$( "#update_nocar_bc23_manual" ).dialog( "close" );

					}
				},
				close : function(){
					$('#update_nocar_bc23_manual').dialog("destroy"); 
					$(".update_nocar_bc23_manualcl").remove(); 
					$("body").append('<div id="update_nocar_bc23_manual" title="Warning" class="update_nocar_bc23_manualcl"><p>Apakah anda akan melakukan Update Terhadap no CAR ini?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');     
					$(".update_nocar_bc23_manualcl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});		
		
		
		});
		
		$("#btncekdokbc23_dtl").button().click(function(){
			var grididpr = jQuery("#tblbc23dok").jqGrid('getGridParam','selrow');
			 if(grididpr){
				 var stret = jQuery("#tblbc23dok").jqGrid('getRowData',grididpr);
				 var form_data =  {
					dokno:stret.DokNo,doktg:stret.DokTg};
				$.ajax({
						url :"<?php echo base_url().'exim/ct_inv_draft/ceknocarnobl'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								
							} else { 
								alert(msg.sts+msg.desc);
								
							}
						}
					});
				
			} else {  
			
				alert("Please Select Row"); 
				return false; 
			}
				
		});
		
		$("#txttgldaftarbc23hdr").datepicker(datesetopt);
		
		$("#btnupdaprosesbc23manual").button().click(function(){
			
			var id = jQuery("#tblbc23hdr_dtl").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblbc23hdr_dtl").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};	
			
			/*var xxxcar = ret.CAR;
			alert(xxxcar);
			if (ret.CAR != '-' || ret.CAR != ''){
				alert('car sudah ada!');
			    return false;
			} */
			
			
			
			var form_data = {
				
				id_bc_in_hdr:ret.id_bc_in_hdr,
				car:$("#txtcarbc23hdr").val(),
				nodaft:$("#txtnodaftarbc23hdr").val(),
				tgdaft:$("#txttgldaftarbc23hdr").val()
			};
						
			$("#update_car_bc23_manual").dialog( "destroy" );
			$(".update_car_bc23_manualcl").remove();
			$(".update_car_bc23_manualcl").html('');
			$("body").append('<div id="update_car_bc23_manual" title="Warning" class="update_car_bc23_manualcl"><p>Apakah anda akan Memproses Data ini Menjadi Data BC23?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');
			$("#update_car_bc23_manual").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_inv_draft/sendtomodulbc23manual'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#update_car_bc23_manual").dialog("close");
								$('#update_car_bc23_manual').dialog("destroy"); 
								$(".update_car_bc23_manualcl").remove(); 
								$(".update_car_bc23_manualcl").html('');
								$('#tblbc23hdr').trigger('reloadGrid');
								$('#tblbc23hdr_dtl').trigger('reloadGrid');
							} else { 
								alert(msg.sts+msg.desc);
								$("#update_car_bc23_manual").dialog("close");
								$('#update_car_bc23_manual').dialog("destroy"); 
								$(".update_car_bc23_manualcl").remove(); 		

							}
						}
					});
				},
				"CANCEL": function() {
						$( "#update_car_bc23_manual" ).dialog( "close" );

					}
				},
				close : function(){
					$('#update_car_bc23_manual').dialog("destroy"); 
					$(".update_car_bc23_manualcl").remove(); 
					$("body").append('<div id="update_car_bc23_manual" title="Warning" class="update_car_bc23_manualcl"><p>Apakah anda akan Memproses Data ini Menjadi Data BC23?</p></div>');     
					$(".update_car_bc23_manualcl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});	
		
		});
		
		$("#btnupdatetglnobc").click(function(){
			var id = jQuery("#tblbc23hdr_dtl").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblbc23hdr_dtl").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};	
			
			/*var xxxcar = ret.CAR;
			alert(xxxcar);
			if (ret.CAR != '-' || ret.CAR != ''){
				alert('car sudah ada!');
			    return false;
			} */
			
			
			
			var form_data = {
				
				id_bc_in_hdr:ret.id_bc_in_hdr,
				car:$("#txtcarbc23hdr").val(),
				nodaft:$("#txtnodaftarbc23hdr").val(),
				tgdaft:$("#txttgldaftarbc23hdr").val()
			};
						
			$("#update_tgl_no_car_bc23_manual").dialog( "destroy" );
			$(".update_tgl_no_car_bc23_manualcl").remove();
			$(".update_tgl_no_car_bc23_manualcl").html('');
			$("body").append('<div id="update_tgl_no_car_bc23_manual" title="Warning" class="update_tgl_no_car_bc23_manualcl"><p>PAK YAYAN/PAK NUR Apakah anda akan Memproses Data ini Menjadi Data BC23?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');
			$("#update_tgl_no_car_bc23_manual").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_bc23/update_no_tgl_bc23_manual'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#update_tgl_no_car_bc23_manual").dialog("close");
								$('#update_tgl_no_car_bc23_manual').dialog("destroy"); 
								$(".update_tgl_no_car_bc23_manualcl").remove(); 
								$(".update_tgl_no_car_bc23_manualcl").html('');
								$('#tblbc23hdr').trigger('reloadGrid');
								$('#tblbc23hdr_dtl').trigger('reloadGrid');
							} else { 
								alert(msg.sts+msg.desc);
								$("#update_tgl_no_car_bc23_manual").dialog("close");
								$('#update_tgl_no_car_bc23_manual').dialog("destroy"); 
								$(".update_tgl_no_car_bc23_manualcl").remove(); 		

							}
						}
					});
				},
				"CANCEL": function() {
						$( "#update_tgl_no_car_bc23_manual" ).dialog( "close" );

					}
				},
				close : function(){
					$('#update_tgl_no_car_bc23_manual').dialog("destroy"); 
					$(".update_tgl_no_car_bc23_manualcl").remove(); 
					$("body").append('<div id="update_tgl_no_car_bc23_manual" title="Warning" class="update_tgl_no_car_bc23_manualcl"><p>Apakah anda akan Memproses Data ini Menjadi Data BC23?</p></div>');     
					$(".update_tgl_no_car_bc23_manualcl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});	
		
		});
		
		
		$("#btnupdateitembc23_dtl_cekmodul").button().click(function(){
			var form_data = {parmeter:'parameter', car_modul_detil:$("#hdnbc23dtl_car").val()};
			$("#cekmoduldetil_dlg").load('<?php echo base_url().'exim/ct_bc23_view_dtl/view_bc23_modul_detil'; ?>',  form_data , function() {
				$("#cekmoduldetil_dlg").dialog({
					modal:true,
					width : 800,
					height : 500,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#cekmoduldetil_dlg').dialog("destroy"); 
					    $(".cekmoduldetil_dlg_cl").remove(); 
					    $("body").append('<div id="cekmoduldetil_dlg" title="DATA MODUL DETAIL" class="cekmoduldetil_dlg_cl"></div>'); 
	
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		
		
		});
		$( "#btnviewitembc23_dtl" ).button().click(function(){
			$("#frmformdtlbc23_dlg").load('<?php echo base_url().'exim/ct_bc23_view_dtl/viewformbc23dtl'; ?>',  {parmeter:'parameter', id_inv_hdr:$("#inv_hdr_idbc23").val()}, function() {
				$("#frmformdtlbc23_dlg").dialog({
					modal:true,
					width : 1000,
					height : 530,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#frmformdtlbc23_dlg').dialog("destroy"); 
					    $(".frmformdtlbc23_dlg_cl").remove(); 
					    $("body").append('<div id="frmformdtlbc23_dlg" title="FORM DETAIL" class="frmformdtlbc23_dlg_cl"></div>'); 
	
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		
		});
		
		
		
		$( "#btnupdateitembc23_dtl_frommodul" ).button().click(function(){
			var id = jQuery("#tblbc23hdr_dtl").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblbc23hdr_dtl").jqGrid('getRowData',id);
				
			} else {
				
				alert("Silahkan Pilih Data yang di <TAB> Header");
				$('#tabdocbc23_dtl').tabs({ selected: 0 });
				return false;
			};	
			
			var form_data = {
				
				id_bc_in_hdr:ret.id_bc_in_hdr
			};
			
			$("#update_part_yang_kosong").dialog( "destroy" );
			$(".update_part_yang_kosongcl").remove();
			$(".update_part_yang_kosongcl").html('');
			$("body").append('<div id="update_part_yang_kosong" title="Warning" class="update_part_yang_kosongcl"><p>Apakah anda akan Memproses Update Data Part Yang Kosong?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');
			$("#update_part_yang_kosong").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_bc23_view_dtl/update_part_kosong'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#update_part_yang_kosong").dialog("close");
								$('#update_part_yang_kosong').dialog("destroy"); 
								$(".update_part_yang_kosongcl").remove(); 
								$(".update_part_yang_kosongcl").html('');
								$('#tblbc23hdr').trigger('reloadGrid');
								$('#tblbc23hdr_dtl').trigger('reloadGrid');
							} else { 
								alert(msg.sts+msg.desc);
								$("#update_part_yang_kosong").dialog("close");
								$('#update_part_yang_kosong').dialog("destroy"); 
								$(".update_part_yang_kosongcl").remove(); 		

							}
						}
					});
				},
				"CANCEL": function() {
						$( "#update_part_yang_kosong" ).dialog( "close" );

					}
				},
				close : function(){
					$('#update_part_yang_kosong').dialog("destroy"); 
					$(".update_part_yang_kosongcl").remove(); 
					$("body").append('<div id="update_part_yang_kosong" title="Warning" class="update_part_yang_kosongcl"><p>Apakah anda akan Memproses Update Data Part Yang Kosong?</p></div>');     
					$(".update_part_yang_kosongcl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});	
		
		});
		
		$("#btncancel_bc23").button().click(function(){
			var id = jQuery("#tblbc23hdr_dtl").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblbc23hdr_dtl").jqGrid('getRowData',id);
				
			} else {
				
				alert("Silahkan Pilih Data yang di <TAB> Header");
				$('#tabdocbc23_dtl').tabs({ selected: 0 });
				return false;
			};	
			
			var form_data = {
				
				id_bc_in_hdr:ret.id_bc_in_hdr
			};
			
			$("#cancel_car_bc23").dialog( "destroy" );
			$(".cancel_car_bc23cl").remove();
			$(".cancel_car_bc23cl").html('');
			$("body").append('<div id="cancel_car_bc23" title="Warning" class="cancel_car_bc23cl"><p>Apakah anda akan Memproses CANCEL CAR!!!!??????</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');
			$("#cancel_car_bc23").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_bc23_view_dtl/cancel_car'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#cancel_car_bc23").dialog("close");
								$('#cancel_car_bc23').dialog("destroy"); 
								$(".cancel_car_bc23cl").remove(); 
								$(".cancel_car_bc23cl").html('');
								$('#tblbc23hdr').trigger('reloadGrid');
								$('#tblbc23hdr_dtl').trigger('reloadGrid');
							} else { 
								alert(msg.sts+msg.desc);
								$("#cancel_car_bc23").dialog("close");
								$('#cancel_car_bc23').dialog("destroy"); 
								$(".cancel_car_bc23cl").remove(); 		

							}
						}
					});
				},
				"CANCEL": function() {
						$( "#cancel_car_bc23" ).dialog( "close" );

					}
				},
				close : function(){
					$('#cancel_car_bc23').dialog("destroy"); 
					$(".cancel_car_bc23cl").remove(); 
					$("body").append('<div id="cancel_car_bc23" title="Warning" class="cancel_car_bc23cl"><p>Apakah anda akan Memproses CANCEL CAR!!!!??????</p></div>');     
					$(".cancel_car_bc23cl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});	
		
		
		
		});
		
		$( "#btnviewhdrbc23_dtl" ).button().click(function(){
			
			
			$("#frmformhdrbc23_dlg").load('<?php echo base_url().'exim/ct_bc23_view_dtl/viewformbc23hdr'; ?>',  {parmeter:'parameter', id_inv_hdr:$("#inv_hdr_idbc23").val()}, function() {
				$("#frmformhdrbc23_dlg").dialog({
					modal:true,
					width : 780,
					height : 550,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						},
						"Print":function() {  
							$("#iddivformheaderbc23").printElement();
							
						}
                    },
						
                    
					close : function(){
						$('#frmformhdrbc23_dlg').dialog("destroy"); 
					    $(".frmformhdrbc23_dlg_cl").remove(); 
					    $("body").append('<div id="frmformhdrbc23_dlg" title="FORM HEADER" class="frmformhdrbc23_dlg_cl"></div>'); 
	
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		});
		
		$( "#btnviewpartitembc23_dtl" ).button().click(function(){
						
			$("#frminvdtlbc23_dlg").load('<?php echo base_url().'exim/ct_bc23_view_dtl/loaddatapartnumberbc23'; ?>',  {parmeter:'parameter', id_inv_hdr:$("#inv_hdr_idbc23").val(), 'noinv':$("#bc23noinv").val(), idhdrbc23:$("#idhdrbc23").val()}, function() {
				$("#frminvdtlbc23_dlg").dialog({
					modal:true,
					width : 1000,
					height : 530,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#frminvdtlbc23_dlg').dialog("destroy"); 
					    $(".frminvdtlbc23_dlg_cl").remove(); 
					    $("body").append('<div id="frminvdtlbc23_dlg" title="INVOICE PART NUMBER" class="frminvdtlbc23_dlg_cl"></div>'); 
	
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});	
			
		});
		
		jQuery("#tblbc23detilitems").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc23_view_dtl/loaddata'; ?>',
			mtype : "post",
			postData:{'q':'1', idhdrbc23:$("#idhdrbc23").val()},
			datatype: "json",
			colNames:['ID', 'id_hdr', 'CAR','Serial', 'JnsBarangDtl', 'TujuanKirimDtl', 'NoHs', 'SeriTrp', 'BrgUrai'
					,'Merk','Tipe','SpfLain','KdBrg','Penggunaan','KemasJn','KemasJm','KdFasDtl','BrgAsal','DNilInv','KdSat','JmlSat','NettoDtl'
					,'SatBmJm','SatCukJm','DtlOk','create_date','create_by','update_date','update_by'
					],
			colModel:[
				{name:'id_bc_in_dtl',index:'id_bc_in_dtl', width:30, hidden:true},
				{name:'id_bc_in_hdr',index:'id_bc_in_hdr', width:30, hidden:true},
				{name:'CAR',index:'CAR', width:30, hidden:true},
				{name:'Serial',index:'Serial', width:30, hidden:false},
				{name:'JnsBarangDtl',index:'JnsBarangDtl', width:30, hidden:true},
				{name:'TujuanKirimDtl',index:'TujuanKirimDtl', width:30, hidden:true},
				{name:'NoHs',index:'NoHs', width:94, hidden:false},
				{name:'SeriTrp',index:'SeriTrp', width:30, hidden:true},
				{name:'BrgUrai',index:'BrgUrai', width:149, hidden:false},
				{name:'Merk',index:'Merk', width:30, hidden:true},
				{name:'Tipe',index:'Tipe', width:30, hidden:true},
				{name:'SpfLain',index:'SpfLain', width:30, hidden:true},
				{name:'KdBrg',index:'KdBrg', width:89, hidden:false},
				{name:'Penggunaan',index:'Penggunaan', width:30, hidden:true},
				{name:'KemasJn',index:'KemasJn', width:30, hidden:true},
				{name:'KemasJm',index:'KemasJm', width:30, hidden:true},
				{name:'KdFasDtl',index:'KdFasDtl', width:30, hidden:true},
				{name:'BrgAsal',index:'BrgAsal', width:30, hidden:true},
				{name:'DNilInv',index:'DNilInv', width:129, hidden:false, align:'right', formatter:'number'},
				{name:'KdSat',index:'KdSat', width:60, hidden:false},
				{name:'JmlSat',index:'JmlSat', width:91, hidden:false, align:'right', formatter:'number'},
				{name:'NettoDtl',index:'NettoDtl', width:30, hidden:true},
				{name:'SatBmJm',index:'SatBmJm', width:30, hidden:true},
				{name:'SatCukJm',index:'SatCukJm', width:30, hidden:true},
				{name:'DtlOk',index:'DtlOk', width:30, hidden:true},
				{name:'create_date',index:'create_date', width:30, hidden:true},
				{name:'create_by',index:'create_by', width:30, hidden:true},
				{name:'update_date',index:'update_date', width:30, hidden:true},
				{name:'update_by',index:'update_by', width:30, hidden:true},
				
			],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblbc23detilitems',
			sortname: 'id_bc_in_dtl',
			viewrecords: true,
			sortorder: "asc",
			width: 950,
			height:290,
			jsonReader: { repeatitems : false },
			caption:"Detil Barang",
			//rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			}	
		
		});
		
		jQuery("#tblbc23detilitems").jqGrid('navGrid','#ptblbc23detilitems',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		
		jQuery("#tblbc23hdr_dtl").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc23_view_dtl/loaddataheader'; ?>',
			mtype : "post",
			postData:{'q':'1',idhdrbc23:$("#idhdrbc23").val()},
			datatype: "json",
			colNames:['ID', 'No Inv','Tgl Inv','CAR' ,'KdKpbc' ,'Tujuan' ,'JnsBarang' ,'TujuanKirim' ,'PasokNama','PasokAlmt','PasokNeg' ,'UsahaId'
			,'UsahaNpwp' ,'KdTPB'  ,'Registrasi','UsahaNama','UsahaAlmt' ,'UsahaStatus' ,'ApiKd','ApiNo' ,'PpjkId','PpjkNpwp','PpjkNama' ,'PpjkAlmt'
			,'PpjkNo' ,'PpjkTg','IndId' ,'IndNpwp','IndNama','IndAlmt' ,'Moda' ,'AngkutNama' ,'AngkutNo','AngkutFl' ,'PelBkr','PelMuat' ,'PelTransit'
			,'BC23No' ,'BC23Tg','KdKpbcBongkar','KdKpbcAwas','DokTupKd' ,'DokTupNo','DokTupTg','PosNo' ,'PosSub' ,'TmpTbn' ,'KdVal','Ndpbm','NilInv'
			,'Freight' ,'BTambahan','Diskon','KdAss' ,'Asuransi' ,'KdHrg','Fob' ,'Cif','Bruto' ,'Netto','JmCont','JmBrg','TglTtd','KotaTtd','Namattd'
			,'ContakPerson' ,'NoPhone','NoFax','Email','Status' ,'Snrf' ,'Lengkap','PosSubSub','NoKontrak','TgKontrak' ,'HargaRp','TmpPeriksaFisik'
			,'AlmtPeriksaFisik','TgPeriksaFisik','WkPeriksaFisik','create_date','create_by','update_date' ,'update_by','typedok', 'status dok', 'inv_hdr_id'],
			colModel:[
				{name:'id_bc_in_hdr',index:'id_bc_in_hdr', width:60, hidden:true},
				{name:'noinv',index:'noinv', width:70, hidden:true},
				{name:'tglinv',index:'tglinv', width:95, hidden:true},
				{name:'CAR',index:'CAR', width:200},
				{name:'KdKpbc',index:'KdKpbc', width:67},
				{name:'Tujuan',index:'Tujuan', width:200, hidden:true},
				{name:'JnsBarang',index:'JnsBarang', width:200, hidden:true},
				{name:'TujuanKirim',index:'TujuanKirim', width:200, hidden:true}, 
				{name:'PasokNama',index:'PasokNama', width:124},
				{name:'PasokAlmt',index:'PasokAlmt', width:200, hidden:true},
				{name:'PasokNeg',index:'PasokNeg', width:200, hidden:true},
				{name:'UsahaId',index:'UsahaId', width:200, hidden:true},
				{name:'UsahaNpwp',index:'UsahaNpwp', width:200, hidden:true},
				{name:'KdTPB',index:'KdTPB', width:200, hidden:true},
				{name:'Registrasi',index:'Registrasi', width:200, hidden:true},
				{name:'UsahaNama',index:'UsahaNama', width:200, hidden:true},
				{name:'UsahaAlmt',index:'UsahaAlmt', width:200, hidden:true},
				{name:'UsahaStatus',index:'UsahaStatus', width:200, hidden:true},
				{name:'ApiKd',index:'ApiKd', width:200, hidden:true},
				{name:'ApiNo',index:'ApiNo', width:200, hidden:true},
				{name:'PpjkId',index:'PpjkId', width:200, hidden:true},
				{name:'PpjkNpwp',index:'PpjkNpwp', width:200, hidden:true},
				{name:'PpjkNama',index:'PpjkNama', width:200, hidden:true},
				{name:'PpjkAlmt',index:'PpjkAlmt', width:200, hidden:true},
				{name:'PpjkNo',index:'PpjkNo', width:200, hidden:true},
				{name:'PpjkTg',index:'PpjkTg', width:200, hidden:true},
				{name:'IndId',index:'IndId', width:200, hidden:true},
				{name:'IndNpwp',index:'IndNpwp', width:200, hidden:true},
				{name:'IndNama',index:'IndNama', width:200, hidden:true},
				{name:'IndAlmt',index:'IndAlmt', width:200, hidden:true},
				{name:'Moda',index:'Moda', width:200, hidden:true},
				{name:'AngkutNama',index:'AngkutNama', width:200, hidden:true},
				{name:'AngkutNo',index:'AngkutNo', width:200, hidden:true},
				{name:'AngkutFl',index:'AngkutFl', width:200, hidden:true},
				{name:'PelBkr',index:'PelBkr', width:200, hidden:true},
				{name:'PelMuat',index:'PelMuat', width:200, hidden:true},
				{name:'PelTransit',index:'PelTransit', width:200, hidden:true},
				{name:'BC23No',index:'BC23No', width:114},
				{name:'BC23Tg',index:'BC23Tg', width:95},
				{name:'KdKpbcBongkar',index:'KdKpbcBongkar', width:200, hidden:true},
				{name:'KdKpbcAwas',index:'KdKpbcAwas', width:200, hidden:true},
				{name:'DokTupKd',index:'DokTupKd', width:200, hidden:true},
				{name:'DokTupNo',index:'DokTupNo', width:200, hidden:true},
				{name:'DokTupTg',index:'DokTupTg', width:200, hidden:true},
				{name:'PosNo',index:'PosNo', width:200, hidden:true},
				{name:'PosSub',index:'PosSub', width:200, hidden:true},
				{name:'TmpTbn',index:'TmpTbn', width:200, hidden:true},
				{name:'KdVal',index:'KdVal', width:42, hidden:true},
				{name:'Ndpbm',index:'Ndpbm', width:93, align:'right'},
				{name:'NilInv',index:'NilInv', width:86, align:'right'},
				{name:'Freight',index:'Freight', width:200, hidden:true},
				{name:'BTambahan',index:'BTambahan', width:200, hidden:true},
				{name:'Diskon',index:'Diskon', width:200, hidden:true},
				{name:'KdAss',index:'KdAss', width:200, hidden:true},
				{name:'Asuransi',index:'Asuransi', width:200, hidden:true},
				{name:'KdHrg',index:'KdHrg', width:200, hidden:true},
				{name:'Fob',index:'Fob', width:200, hidden:true},
				{name:'Cif',index:'Cif', width:200, hidden:true},
				{name:'Bruto',index:'Bruto', width:200, hidden:true},
				{name:'Netto',index:'Netto', width:200, hidden:true},
				{name:'JmCont',index:'JmCont', width:200, hidden:true},
				{name:'JmBrg',index:'JmBrg', width:200, hidden:true},
				{name:'TglTtd',index:'TglTtd', width:200, hidden:true},
				{name:'KotaTtd',index:'KotaTtd', width:200, hidden:true},
				{name:'Namattd',index:'Namattd', width:200, hidden:true},
				{name:'ContakPerson',index:'ContakPerson', width:200, hidden:true},
				{name:'NoPhone',index:'NoPhone', width:200, hidden:true},
				{name:'NoFax',index:'NoFax', width:200, hidden:true},
				{name:'Email',index:'Email', width:200, hidden:true},
				{name:'Status',index:'Status', width:49, hidden:false},
				{name:'Snrf',index:'Snrf', width:200, hidden:true},
				{name:'Lengkap',index:'Lengkap', width:200, hidden:true},
				{name:'PosSubSub',index:'PosSubSub', width:200, hidden:true},
				{name:'NoKontrak',index:'NoKontrak', width:200, hidden:true},
				{name:'TgKontrak',index:'TgKontrak', width:200, hidden:true},
				{name:'HargaRp',index:'HargaRp', width:200, hidden:true},
				{name:'TmpPeriksaFisik',index:'TmpPeriksaFisik', width:200, hidden:true},
				{name:'AlmtPeriksaFisik',index:'AlmtPeriksaFisik', width:200, hidden:true},
				{name:'TgPeriksaFisik',index:'TgPeriksaFisik', width:200, hidden:true},
				{name:'WkPeriksaFisik',index:'WkPeriksaFisik', width:200, hidden:true},
				{name:'create_date',index:'create_date', width:200, hidden:true},
				{name:'create_by',index:'create_by', width:200, hidden:true},
				{name:'update_date',index:'update_date', width:200, hidden:true},
				{name:'update_by',index:'update_by', width:200, hidden:true},
				{name:'typedok',index:'typedok', width:200, hidden:true},
				{name:'statusdok',index:'statusdok', width:200, hidden:true},
				{name:'inv_hdr_id',index:'inv_hdr_id', width:200, hidden:true},
			],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblbc23hdr_dtl',
			sortname: 'id_bc_in_hdr',
			viewrecords: true,
			sortorder: "desc",
			width: 950,
			height:17,
			jsonReader: { repeatitems : false },
			caption:"List of BC23 Header",
			rownumbers: false,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},
			gridComplete: function(){
				
				
			},
			onSelectRow: function(id){
				var grididpr = jQuery("#tblbc23hdr_dtl").jqGrid('getGridParam','selrow');
				 if(grididpr){
					 var stret = jQuery("#tblbc23hdr_dtl").jqGrid('getRowData',grididpr);
					
					/*if (stret.CAR != '' && stret.CAR != '-'){
						$("#txtcarbc23hdr").attr('readonly', true);
					 
					 } else { $("#txtcarbc23hdr").attr('readonly', false); } */
					   $("#txtcarbc23hdr").val(stret.CAR);
					   $("#txtnodaftarbc23hdr").val(stret.BC23No);
					   $("#txttgldaftarbc23hdr").val(stret.BC23Tg);
				  
				 }
			}
		}); 
		                
		jQuery("#tblbc23hdr_dtl").jqGrid('navGrid','#ptblbc23hdr_dtl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		
		jQuery("#tblbc23dok").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc23_view_dtl/loaddatadok'; ?>',
			mtype : "post",
			postData:{'q':'1', idhdrbc23:$("#idhdrbc23").val()},
			datatype: "json",
			colNames:['ID', 'id_hdr', 'CAR','Dok Kd', 'Uraian', 'Dok No', 'Dok Tg'
					],
			colModel:[
				{name:'id_bc_in_dok',index:'id_bc_in_dok', width:30, hidden:true},
				{name:'id_bc_in_hdr',index:'id_bc_in_hdr', width:30, hidden:true},
				{name:'CAR',index:'CAR', width:171, hidden:false},
				{name:'DokKd',index:'DokKd', width:77, hidden:false},
				{name:'uraian',index:'uraian', width:183, hidden:false},
				{name:'DokNo',index:'DokNo', width:160, hidden:false},
				{name:'DokTg',index:'DokTg', width:104, hidden:false}				
				
			],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblbc23dok',
			sortname: 'id_bc_in_dok',
			viewrecords: true,
			sortorder: "asc",
			width: 950,
			height:290,
			jsonReader: { repeatitems : false },
			caption:"Dokumen",
			//rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			}	
		
		});
		
		jQuery("#tblbc23dok").jqGrid('navGrid','#ptblbc23dok',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		
		jQuery("#tblbc23con").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc23_view_dtl/loaddatacon'; ?>',
			mtype : "post",
			postData:{'q':'1', idhdrbc23:$("#idhdrbc23").val()},
			datatype: "json",
			colNames:['ID', 'id_hdr', 'CAR','ContNo', 'ContUkur', 'ContTipe'
					],
			colModel:[
				{name:'id_bc_in_con',index:'id_bc_in_con', width:30, hidden:true},
				{name:'id_bc_in_hdr',index:'id_bc_in_hdr', width:30, hidden:true},
				{name:'CAR',index:'CAR', width:171, hidden:false},
				{name:'ContNo',index:'ContNo', width:77, hidden:false},
				{name:'ContUkur',index:'ContUkur', width:183, hidden:false},
				{name:'ContTipe',index:'ContTipe', width:160, hidden:false},
				
			],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblbc23con',
			sortname: 'id_bc_in_con',
			viewrecords: true,
			sortorder: "asc",
			width: 950,
			height:290,
			jsonReader: { repeatitems : false },
			caption:"Container",
			//rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			}	
		
		});
		
		jQuery("#tblbc23con").jqGrid('navGrid','#ptblbc23con',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		

	});
</script>
<div id="frminvdtlbc23_dlg" title="INVOICE PART NUMBER" class="frminvdtlbc23_dlg_cl"></div>
<div id="frmformdtlbc23_dlg" title="FORM DETAIL" class="frmformdtlbc23_dlg_cl"></div>
<div id="frmformhdrbc23_dlg" title="FORM HEADER" class="frmformhdrbc23_dlg_cl"></div>
<div id="cekmoduldetil_dlg" title="DATA MODUL DETAIL" class="cekmoduldetil_dlg_cl"></div>
