<div style="height:15px;">
	<input type="hidden" id="idhdrbc25_data_out" value="<?php echo $idhdrbc25; ?>" /> 
</div>
<div id="add_progress" align="center" style="display:none"><?php echo $loading_indicator; ?></div>
<div id="idmainbc25" > 
<div id="tabbc25_dtl" style="height:420px">
	<ul>
		<li><a id="idtabbc25hdr_dtl" href="#divtabbc25hdr_dtl">Header Dokumen</a></li>
		<li><a id="idtabbc25sa_dtl" href="#divtabbc25assy_dtl">Assy</a></li>
		<li><a id="idtabbc25bb_dtl" href="#divtabbc25bb_dtl">Bahan Baku</a></li>
		<li><a id="idtabdocbc25_dtl" href="#divtabbc25doc_dtl">Dokumen</a></li>
	</ul>
	
	<div id="divtabbc25hdr_dtl" >
		<table id="tblbc25viewdtl_hdr"></table>
		<br />
		<table>
			<tr>
				<td>SA. NO.</td><td>:</td><td><?php echo $SA_NO; ?><td>
			</tr>
			<tr>
				<td>Nomor Pengajuan</td><td>:</td><td><?php echo $BC25NAJU; ?><td>
			</tr>
			<tr>
				<td>Tgl Pengajuan</td><td>:</td><td><?php echo $BC25TGAJU; ?><td>
			</tr>
			<tr>
				<td>NO BC25</td><td>:</td><td><input type="text" id="txtnobc25" value="<?php echo $BC25No; ?>" /><td>
			</tr>
			<tr>
				<td>TGL BC25</td><td>:</td><td><input type="text" id="txtnotglbc25" value="<?php echo $BC25Tg; ?>" /><td>
			</tr>
			<tr>
				<td></td><td></td><td><button id="updatenobc25">UPDATE DATA</button><button id="btnupdetpemasukanbc25manual" >Update Pengeluaran Barang</button></td>
			</tr>
			<tr>
				<td></td><td></td><td></td>
			</tr>
			<tr>
				<td></td><td></td><td></td>
			</tr>
			<tr>
				<td></td><td></td><td><button id="print_instruksi_pemeriksaan">Print I.P.</button><button id="print_ppb_bc25">Print PPB</button>
				<button id="print_sppb_bc25">Print SPPB</button><button id="print_lampiran_bc25">Print Lampiran </button>
				</td>
			</tr>
		</table>
		<br />
		<br />
		<table>
			<tr>
				<td>Tgl Pengeluaran</td><td>:</td><td><input type="text" id="txttglpemasukanbc25hdr" style="width:100px" value="<?php echo $doc_out_date; ?>"/>dd/mm/yyyy</td><td></td>
			</tr>
			<tr>
				<td>Tgl Pengeluaran Approved</td><td>:</td><td><input type="text" id="txttglpemasukanapprovedbc25hdr" style="width:100px" value="<?php echo $approve_date; ?>"/>dd/mm/yyyy</td>
				<td></td>
			</tr>
			<tr>
				<td></td><td></td><td><button id="btnapprovedpemasukanbc25manual" style="color:red">Approved Pengeluaran Barang</button></td><td></td>
			</tr>
		</table>
		
		<div style="height:40px; -moz-border-radius: 50px/50px;
			-webkit-border-radius: 50px 50px;
			border-radius: 4px/4px;;
			border:solid 1px #000000; 
			width:450px;
			height:110px;position:absolute;
			top:120px;;
			right:10px;
			">
			Pejabat BC:
			<br />
			Nama:<input type="text" id="txtnama_bc" value="<?php echo ''; ?>" style="width:170px" /> NIP:<input type="text" id="txtnip_bc" value="<?php echo '';   ?>" />
			<button id="btnupdatenama_bc" >Update</button>	
			<hr />
			NPWP Pembeli:<input type="text" id="txtupatenpwp_pembeli" value="<?php echo '';   ?>" style="width:210px" /><button id="btnupdatenpwp_pembeli" >Update</button>	
			<hr />
			Tgl INV:<input type="text" id="txtupatetglinv" value="<?php echo '';  ?>" style="width:80px" /><button id="btnupatetglinv" >Update</button>	
			
		</div>
			
	</div>
	<div id="divtabbc25assy_dtl" >
		<table id="tblassygetviewbc25_dtl"></table> <div id="ptblassygetviewbc25_dtl"></div>
	</div>
	<div id="divtabbc25bb_dtl" >
		<table id="tblbbgetviewbc25_dtl"></table> <div id="ptblbbgetviewbc25_dtl"></div>
	</div>
	<div id="divtabbc25doc_dtl" >
		<table id="tblsadok_dtl"></table> <div id="ptblsadok_dtl"></div>
	</div>
	
</div>

<input type="hidden" id="hdnid_sa_hdr_dtl" value="<?php echo  $id_sa_hdr; ?>" />
<input type="hidden" id="hdnBC25NAJU_sa_hdr_dtl" value="<?php echo  $BC25NAJU; ?>" />
<input type="hidden" id="hdnBC25TGAJU_sa_hdr_dtl" value="<?php echo  $BC25TGAJU; ?>" />
<input type="hidden" id="hdnBC25No_sa_hdr_dtl" value="<?php echo  $BC25No; ?>" />
<input type="hidden" id="hdnBC25Tg_sa_hdr_dtl" value="<?php echo  $BC25Tg; ?>" />
<input type="hidden" id="hdnsa_no_dtl" value="<?php echo  $SA_NO; ?>" />
<script type="text/javascript">
    
    $(document).ready(function(){
		$( "#tabbc25_dtl" ).tabs();
		var form_datax = {
			id_sa_hdr_dtl:$("#hdnid_sa_hdr_dtl").val()
		}
		
		$("#btnupdatenama_bc").button().click(function(){
		
		
		
		
		});
		
		$("#btnupdatenpwp_pembeli").button().click(function(){
		
		
		
		
		});
		$("#btnupatetglinv").button().click(function(){
		
		
		
		
		});
		
		
		
		
		var form_dataxx = {
		
		
		
		};
		var datesetopt = {
			showOn: "button",
			buttonImageOnly: true,
			buttonImage: "<?php echo base_url()."assets/images/icons/16x16/timespan.png"  ?>",
			buttonText: "Tanggalan",
			dateFormat: 'dd/mm/yy'
		};
		
		$("#txtnotglbc25").datepicker(datesetopt);
		$("#txtnotglbc25").datepicker(datesetopt);
		
		$("#txttglpemasukanbc25hdr").datepicker(datesetopt);
		$("#txttglpemasukanapprovedbc25hdr").datepicker(datesetopt);
		
		$("#idprintinstruksi_pemeriksaandlg").hide();
		$("#idprintppbidlg").hide();
		$("#idprintsppbidlg").hide();
		$("#idprintbc25lampirandlg").hide();
		
		$("#print_instruksi_pemeriksaan").button().click(function(){
			$("#add_progress").show();
			$("#idprintinstruksi_pemeriksaandlg").fadeIn();
			$("#idmainbc25").fadeOut();
			var sdata = "?id_sa_hdr_dtl=" + $("#hdnid_sa_hdr_dtl").val() + "&test=" + "test";
			$("#frameinstruksi_pemeriksaan").attr("src", "<?php echo base_url().'exim/ct_bc25/print_instruksi_pemeriksaan'; ?>"+sdata).load(function(){
			
				$("#add_progress").hide();
			
			});
			
			
			/* $("#instruksi_pemeriksaandlg").load('<?php echo base_url().'exim/ct_bc25/view_bc25_print'; ?>',  {parmeter:'parameter'}, function() {
				$("#instruksi_pemeriksaandlg").dialog({
					modal:true,
					width : 900,
					height : 508,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#instruksi_pemeriksaandlg').dialog("destroy"); 
					    $(".instruksi_pemeriksaandlg_cl").remove(); 
					    $("body").append('<div id="instruksi_pemeriksaandlg" title="Print Instruksi Pemeriksaan" class="instruksi_pemeriksaandlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			}); */
		
		});
		$("#print_ppb_bc25").button().click(function(){
			$("#add_progress").show();
			$("#idprintppbidlg").fadeIn();
			$("#idmainbc25").fadeOut();
			
			var sdata = "?id_sa_hdr_dtl=" + $("#hdnid_sa_hdr_dtl").val() + "&test=" + "test";
			$("#frameppbi").attr("src", "<?php echo base_url().'exim/ct_bc25/print_ppbi'; ?>"+sdata).load(function(){
			
				$("#add_progress").hide();
			
			});
			
		
		});
		
		$("#print_sppb_bc25").button().click(function(){
			$("#add_progress").show();
			$("#idprintsppbidlg").fadeIn();
			$("#idmainbc25").fadeOut();
			
			var sdata = "?id_sa_hdr_dtl=" + $("#hdnid_sa_hdr_dtl").val() + "&test=" + "test";
			$("#framesppbi").attr("src", "<?php echo base_url().'exim/ct_bc25/print_sppbi'; ?>"+sdata).load(function(){
			
				$("#add_progress").hide();
			
			});
			
		
		
		});
		$("#print_lampiran_bc25").button().click(function(){
			$("#add_progress").show();
			$("#idprintbc25lampirandlg").fadeIn();
			$("#idmainbc25").fadeOut();
			
			var sdata = "?id_sa_hdr_dtl=" + $("#hdnid_sa_hdr_dtl").val() + "&test=" + "test";
			$("#framebc25lampiran").attr("src", "<?php echo base_url().'exim/ct_bc25/print_bc25lampiran'; ?>"+sdata).load(function(){
			
				$("#add_progress").hide();
			
			});
		
		});
		
		
		$("#updatenobc25").button().click(function(){
			
			var form_update_bc25={
				id_sa_hdr:$("#hdnid_sa_hdr_dtl").val(),
				BC25NAJU_sa_hdr_dtl:$("#hdnBC25NAJU_sa_hdr_dtl").val(),
				BC25TGAJU_sa_hdr_dt:$("#hdnBC25TGAJU_sa_hdr_dtl").val(),
				BC25No:$.trim($("#txtnobc25").val()),
				BC25Tg:$("#txtnotglbc25").val(),
				
			};	
			 
			$("#dlgbc25dtl_hdr_update").dialog( "destroy" );
			$(".dlgbc25dtl_hdr_updatecl").remove();
			$(".dlgbc25dtl_hdr_updatecl").html('');
			$("body").append('<div id="dlgbc25dtl_hdr_update" title="Warning" class="dlgbc25dtl_hdr_updatecl"><p>Apakah anda akan melakukan Update BC25 ini?!?</p><br /> No SA = '+ $("#hdnsa_no_dtl").val() +'</div>');
			$("#dlgbc25dtl_hdr_update").dialog({
				height: 200,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'exim/ct_bc25/update_bc25_sa_hdr'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_update_bc25,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlgbc25dtl_hdr_update").dialog("close");
								$('#dlgbc25dtl_hdr_update').dialog("destroy"); 
								$(".dlgbc25dtl_hdr_updatecl").remove(); 
								$(".dlgbc25dtl_hdr_updatecl").html('');
								$("#tblassygetviewbc25_dtl").trigger("reloadGrid");
								$("#tblbc25hdr").trigger("reloadGrid");
								
							    
							} else { 
								alert(msg.sts+' '+msg.desc); 
								$("#dlgbc25dtl_hdr_update").dialog("close");
								$('#dlgbc25dtl_hdr_update').dialog("destroy"); 
								$(".dlgbc25dtl_hdr_updatecl").remove(); 

							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlgbc25dtl_hdr_update" ).dialog( "close" );
						
					}
				},
				close : function(){
					$('#dlgbc25dtl_hdr_update').dialog("destroy"); 
					$(".dlgbc25dtl_hdr_updatecl").remove(); 
					$("body").append('<div id="dlgbc25dtl_hdr_update" title="Warning" class="dlgbc25dtl_hdr_updatecl"><p>Apakah anda akan memproses file ini?!?</p></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
			
			
		
		
		});
		
		jQuery("#tblbc25viewdtl_hdr").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc25/loaddata_bc25_hdr'; ?>',
			mtype : "post",
			postData:form_datax,
			datatype: "json",
			colNames:[
			  'id_sa_hdr'
			  ,'SA_NO'
			  ,'status'
			  ,'NPWP_PEMBELI'
			  ,'NAMA_PEMBELI'
			  ,'BC25No'
			  ,'BC25Tg'
			  ,'KdKpbc'
			  ,'KdKpbcTujuan'
			  ,'JnBC25'
			  ,'JnBarang'
			  ,'Kondisi'
			  ,'Dari'
			  ,'Tujuan'
			  ,'TujuanKirim'
			  ,'UsahaID'
			  ,'UsahaNpwp'
			  ,'UsahaNama'
			  ,'UsahaAlmt'
			  ,'UsahaStatus'
			  ,'PenerimaID'
			  ,'PenerimaNpwp'
			  ,'PenerimaNama'
			  ,'PenerimaAlmt'
			  ,'PenerimaNiper'
			  ,'PenerimaStatus'
			  ,'TempatPenimbunan'
			  ,'TgKeluar'
			  ,'TglMusnah'
			  ,'BAMusnah'
			  ,'KdVal'
			  ,'Ndpbm'
			  ,'HargaRp'
			  ,'HargaBBRp'
			  ,'Bruto'
			  ,'Netto'
			  ,'JmBrg'
			  ,'JmBB'
			  ,'JmCont'
			  ,'KotaTtd'
			  ,'TglTtd'
			  ,'NamaTtd'
			  ,'KotattdPenerima'
			  ,'TglTtdPenerima'
			  ,'NamaTtdPenerima'
			  ,'TmpPeriksaFisik'
			  ,'AlmtPeriksaFisik'
			  ,'TgPeriksaFisik'
			  ,'WkPeriksaFisik'
			  ,'ContakPerson'
			  ,'NoPhone'
			  ,'jml_inv'
			  ,'typedok'
			  ,'nip_bc'
			  ,'nama_bc'
			  ,'create_date'
			  ,'create_by'
			  ,'update_date'
			  ,'update_by'
			],
			colModel:[
				{name:'id_sa_hdr',index:'id_sa_hdr', width:60, hidden:true},
				{name:'SA_NO', index:'status', width:200, hidden:false}, 
				{name:'status',index:'status', width:200, hidden:false},  
				{name:'NPWP_PEMBELI',index:'NPWP_PEMBELI', width:200, hidden:false},  
				{name:'NAMA_PEMBELI',index:'NAMA_PEMBELI', width:200, hidden:false},  
				{name:'BC25No',index:'BC25No', width:200, hidden:true},  
				{name:'BC25Tg',index:'BC25Tg', width:200, hidden:true,searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({changeYear: true,showButtonPanel: true,changeMonth: true,dateFormat:'yy-mm-dd'});} }},
				{name:'KdKpbc',index:'KdKpbc', width:200, hidden:true},  
				{name:'KdKpbcTujuan',index:'KdKpbcTujuan', width:200, hidden:true},  
				{name:'JnBC25',index:'JnBC25', width:200, hidden:true},  
				{name:'JnBarang',index:'JnBarang', width:200, hidden:true},  
				{name:'Kondisi',index:'Kondisi', width:200, hidden:true},  
				{name:'Dari',index:'Dari', width:200, hidden:true},  
				{name:'Tujuan',index:'Tujuan', width:200, hidden:true},  
				{name:'TujuanKirim',index:'TujuanKirim', width:200, hidden:true},  
				{name:'UsahaID',index:'UsahaID', width:200, hidden:true},  
				{name:'UsahaNpwp',index:'UsahaNpwp', 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:'PenerimaID',index:'PenerimaID', width:200, hidden:true},  
				{name:'PenerimaNpwp',index:'PenerimaNpwp', width:200, hidden:true},  
				{name:'PenerimaNama',index:'PenerimaNama', width:200, hidden:true},  
				{name:'PenerimaAlmt',index:'PenerimaAlmt', width:200, hidden:true},  
				{name:'PenerimaNiper',index:'PenerimaNiper', width:200, hidden:true},  
				{name:'PenerimaStatus',index:'PenerimaStatus', width:200, hidden:true},  
				{name:'TempatPenimbunan',index:'TempatPenimbunan', width:200, hidden:true},  
				{name:'TgKeluar',index:'TgKeluar', width:200, hidden:true},  
				{name:'TglMusnah',index:'TglMusnah', width:200, hidden:true},  
				{name:'BAMusnah',index:'BAMusnah', width:200, hidden:true},  
				{name:'KdVal',index:'KdVal', width:200, hidden:true},  
				{name:'Ndpbm',index:'Ndpbm', width:200, hidden:true},  
				{name:'HargaRp',index:'HargaRp', width:200, hidden:true},  
				{name:'HargaBBRp',index:'HargaBBRp', width:200, hidden:true},  
				{name:'Bruto',index:'Bruto', width:200, hidden:true},  
				{name:'Netto',index:'Netto', width:200, hidden:true},  
				{name:'JmBrg',index:'JmBrg', width:200, hidden:true},  
				{name:'JmBB',index:'JmBB', width:200, hidden:true},  
				{name:'JmCont',index:'JmCont', width:200, hidden:true},  
				{name:'KotaTtd',index:'KotaTtd', width:200, hidden:true},  
				{name:'TglTtd',index:'TglTtd', width:200, hidden:true, searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({changeYear: true,showButtonPanel: true,changeMonth: true,dateFormat:'yy-mm-dd'});} }},
				{name:'NamaTtd',index:'NamaTtd', width:200, hidden:true},  
				{name:'KotattdPenerima',index:'KotattdPenerima', width:200, hidden:true},  
				{name:'TglTtdPenerima',index:'TglTtdPenerima', width:200, hidden:true},  
				{name:'NamaTtdPenerima',index:'NamaTtdPenerima', 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:'ContakPerson',index:'ContakPerson', width:200, hidden:true},  
				{name:'NoPhone',index:'NoPhone', width:200, hidden:true},  
				{name:'jml_inv',index:'jml_inv', width:200, hidden:true},  
				{name:'typedok',index:'typedok', 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:'nip_bc',index:'nip_bc', width:200, hidden:true},  
				{name:'nama_bc',index:'nama_bc', width:200, hidden:true}
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblbc25viewdtl_hdr',
			sortname: 'id_sa_hdr',
			viewrecords: true,
			sortorder: "desc",
			width: 840,
			height:26,
			jsonReader: { repeatitems : false },
			caption:"Header BC25",
			rownumbers: false,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				// var rowIDs = jQuery("#tblbc25viewdtl_hdr").getDataIDs(); 
				// var rowData = $("#tblbc25viewdtl_hdr").getRowData();
			
				// for (var i = 0; i < rowData.length; i++) 
				// {
				   // var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblbc25viewdtl_hdr'));
				   
					// switch (rowData[i].status) {
						
						// case 'DATA PROCESSED':
						   // trElement.css({"color":"green"});
						// break;
						// case 'APPROVED':
						   // trElement.css({"color":"red"});
						// break;
					// }
				// }
			},
			
		}); 
			
                        
		// jQuery("#tblbc25viewdtl_hdr").jqGrid('navGrid','#ptblbc25viewdtl_hdr',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		// jQuery("#tblbc25viewdtl_hdr").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		jQuery("#tblassygetviewbc25_dtl").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc25/loaddata_bc25_gettassy_dtl'; ?>',
			mtype : "post",
			postData:form_datax,
			datatype: "json",
			colNames:['ID','id_sa_hdr', 'SA NO','NPWP PEMBELI', 'NAMA PEMBELI', 'INV NO', 'ASSY CODE',
					'ASSY NO', 'TOTAL SET', 'SATUAN', 'JUMLAH_COLI', 'GROSS WEIGHT', 'SATUAN', 'NETWEIGHT', 'SATUAN',
					'create date','create by','update date','update by'
					],
			colModel:[
				{name:'id_sa',index:'id_sa', width:60, hidden:true},
				{name:'id_sa_hdr',index:'id_sa_hdr', width:160, hidden:true},
				{name:'SA_NO',index:'SA_NO', width:166,stype:"text",searchoptions:{}},
				{name:'NPWP_PEMBELI',index:'NPWP_PEMBELI', width:119},
				{name:'NAMA_PEMBELI',index:'NAMA_PEMBELI', width:205},
				{name:'INV_NO',index:'INV_NO', width:130, hidden:false},
				{name:'ASSY_CODE',index:'ASSY_CODE', width: 87, hidden:false},
				{name:'ASSY_NO',index:'ASSY_NO', width:179, hidden:false},
				{name:'TOTAL_SET',index:'TOTAL_SET', width:106, hidden:false},
				{name:'SATUAN',index:'SATUAN', width:106, hidden:false},
				{name:'JUMLAH_COLI',index:'JUMLAH_COLI', width:106, hidden:false},
				{name:'GROSSWEIGHT',index:'GROSSWEIGHT', width:93, hidden:false, align:'right'},
				{name:'SATUANGROSS',index:'SATUANGROSS', width:106, hidden:false},
				{name:'NETWEIGHT',index:'NETWEIGHT', width:106, hidden:false, align:'right'},
				{name:'SATUANNET',index:'SATUANNET', width:86, hidden:false},
				{name:'create_date',index:'create_date', width:106, hidden:false},
				{name:'create_by',index:'create_by', width:106, hidden:false},
				{name:'update_date',index:'update_date', width:106, hidden:false},
				{name:'update_by',index:'update_by', width:106, hidden:false},
				
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblassygetviewbc25_dtl',
			sortname: 'id_sa',
			viewrecords: true,
			sortorder: "asc",
			width: 840,
			height:280,
			jsonReader: { repeatitems : false },
			caption:"Data SA",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				
			},
		}); 
		
		
		jQuery("#tblassygetviewbc25_dtl").jqGrid('navGrid','#ptblassygetviewbc25_dtl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblassygetviewbc25_dtl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		jQuery("#tblbbgetviewbc25_dtl").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc25/loaddata_bc25_getbb_dtl'; ?>',
			mtype : "post",
			postData:form_datax,
			datatype: "json",
			colNames:['id_sa_bb'
			  ,'id_sa_hdr'
			  ,'SA NO'
			  ,'NO URUT'
			  ,'PART NAME'
			  ,'QTY'
			  ,'UNIT'
			  ,'STATUS'
			  ,'CURR'
			  ,'PRICE'
			  ,'CIF'
			  ,'NDPMB'
			  ,'NDPDM NOW'
			  ,'HARGA PABEAN'
			  ,'HS'
			  ,'BM'
			  ,'PPN'
			  ,'PPH'
			  ,'BM RP'
			  ,'PPN RP'
			  ,'PPH RP'
			  ,'create_date'
			  ,'create_by'
			  ,'update_date'
			  ,'update_by'
					],
			colModel:[
				{name:'id_sa_bb',index:'id_sa_bb', width:60, hidden:true},
				{name:'id_sa_hdr',index:'id_sa_hdr', width:160, hidden:true},
				{name:'SA_NO',index:'SA_NO', width:166,stype:"text",searchoptions:{}},
				{name:'NO_URUT',index:'NO_URUT', width:119},
				{name:'PART_NAME',index:'PART_NAME', width:205},
				{name:'QTY',index:'QTY', width:130, hidden:false},
				{name:'UNIT',index:'UNIT', width: 87, hidden:false},
				{name:'STATUS',index:'STATUS', width:179, hidden:false},
				{name:'CURR',index:'CURR', width:106, hidden:false},
				{name:'PRICE',index:'PRICE', width:106, hidden:false,align:'right'},
				{name:'CIF',index:'CIF', width:106, hidden:false, align:'right'},
				{name:'NDPMB',index:'NDPMB', width:93, hidden:false, align:'right'},
				{name:'NDPDM_NOW',index:'NDPDM_NOW', width:106, hidden:false,align:'right'},
				{name:'HARGA_PABEAN',index:'HARGA_PABEAN', width:106, hidden:false,align:'right'},
				{name:'HS',index:'HS', width:86, hidden:false},
				{name:'BM',index:'BM', width:106, hidden:false,align:'right'},
				{name:'PPN',index:'PPN', width:106, hidden:false,align:'right'},
				{name:'PPH',index:'PPH', width:106, hidden:false,align:'right'},
				{name:'BM_RP',index:'BM_RP', width:106, hidden:false,align:'right'},
				{name:'PPN_RP',index:'PPN_RP', width:86, hidden:false,align:'right'},
				{name:'PPH_RP',index:'PPH_RP', width:106, hidden:false,align:'right'},
				{name:'create_date',index:'create_date', width:106, hidden:false,align:'right'},
				{name:'create_by',index:'create_by', width:106, hidden:false},
				{name:'update_date',index:'update_date', width:106, hidden:false},
				{name:'update_by',index:'update_by', width:106, hidden:false},
				
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblbbgetviewbc25_dtl',
			sortname: 'id_sa_bb',
			viewrecords: true,
			sortorder: "asc",
			width: 840,
			height:240,
			jsonReader: { repeatitems : false },
			caption:"List BB SA",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				
			},
		}); 
		
		
		jQuery("#tblbbgetviewbc25_dtl").jqGrid('navGrid','#ptblbbgetviewbc25_dtl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblbbgetviewbc25_dtl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		jQuery("#tblsadok_dtl").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc25/loaddata_sa_dok_dtl'; ?>',
			mtype : "post",
			postData:form_datax,
			datatype: "json",
			colNames:[
			    'SA_NO'
				,'INV_NO'
					],
			colModel:[
				{name:'SA_NO',index:'SA_NO', width:166,stype:"text",searchoptions:{}},
				{name:'INV_NO',index:'INV_NO', width:119},
								
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblsadok_dtl',
			sortname: 'SA_NO',
			viewrecords: true,
			sortorder: "asc",
			width: 840,
			height:280,
			jsonReader: { repeatitems : false },
			caption:"Data DOk SA",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				
			},
		}); 
		
		
		jQuery("#tblsadok_dtl").jqGrid('navGrid','#ptblsadok_dtl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblsadok_dtl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		$("#view_mainbc25_1").button().click(function(){
			$("#idprintinstruksi_pemeriksaandlg").hide();
			$("#idmainbc25").fadeIn();
			
		
		});
		$("#view_mainbc25_2").button().click(function(){
			$("#idprintppbidlg").hide();
			$("#idmainbc25").fadeIn();
			
		
		});
		$("#view_mainbc25_3").button().click(function(){
			$("#idprintsppbidlg").hide();
			$("#idmainbc25").fadeIn();
			
		
		});
		
		$("#view_mainbc25_4").button().click(function(){
			$("#idprintbc25lampirandlg").hide();
			$("#idmainbc25").fadeIn();
			
		
		});
		
		
		$("#btnupdetpemasukanbc25manual").button().click(function(){
			if( $.trim($("#txtnobc25").val()) =='' || $.trim($("#txtnotglbc25").val()) == '' 
				){
				alert('Data Belum Lengkap');
				return false;
			
			}
			
			var id = jQuery("#tblbc25viewdtl_hdr").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblbc25viewdtl_hdr").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};	
			
			
			if (ret.NODAFT == ''){
				alert('nodaft belum ada');
			    return false;
			}
			
			var form_data = {
				
				id_bc_out:ret.id_sa_hdr,typedok:'BC25',statusdok:ret.status
				
			};
			
					
			$("#update_pemasukan_bc25").dialog( "destroy" );
			$(".update_pemasukan_bc25cl").remove();
			$(".update_pemasukan_bc25cl").html('');
			$("body").append('<div id="update_pemasukan_bc25" title="Warning" class="update_pemasukan_bc25cl"><p>Apakah anda akan Memproses Data ini Menjadi Data Pengeluaran bc25?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali dan data menjadi APPROVED di inventory!!!!!</div>');
			$("#update_pemasukan_bc25").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_bc25/prosesdatatofg'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#update_pemasukan_bc25").dialog("close");
								$('#update_pemasukan_bc25').dialog("destroy"); 
								$(".update_pemasukan_bc25cl").remove(); 
								$(".update_pemasukan_bc25cl").html('');
								$("#idhdrbc25_data_out").val(msg.id_bc_out);
								$('#tblbc25hdr').trigger('reloadGrid');
								$('#tblbc25hdr_dtl').trigger('reloadGrid');
							} else { 
								alert(msg.sts+msg.desc);
								$("#update_pemasukan_bc25").dialog("close");
								$('#update_pemasukan_bc25').dialog("destroy"); 
								$(".update_pemasukan_bc25cl").remove(); 		

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

					}
				},
				close : function(){
					$('#update_pemasukan_bc25').dialog("destroy"); 
					$(".update_pemasukan_bc25cl").remove(); 
					$("body").append('<div id="update_pemasukan_bc25" title="Warning" class="update_pemasukan_bc25cl"><p>Apakah anda akan Memproses Data ini Menjadi Data Pengeluaran bc25?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali dan data menjadi APPROVED di inventory!!!!!</div></div>');     
					$(".update_pemasukan_bc25cl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});	
			
		
		});
		
		$("#btnapprovedpemasukanbc25manual").button().click(function(){ 
			if(($.trim($("#txtnobc25").val()) =='' && $.trim($("#txtnobc25").val()) =='-') || $.trim($("#txtnotglbc25").val()) == '' 
				|| $.trim($("#txttglpemasukanbc25hdr").val()) == '' || $.trim($("#txttglpemasukanapprovedbc25hdr").val()) == ''  ){
				alert('Data Belum Lengkap');
				return false;
			
			}
			
			var id = jQuery("#tblbc25viewdtl_hdr").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblbc25viewdtl_hdr").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};	
			
			var form_data ={
				id_bc_out:$("#idhdrbc25_data_out").val(),
				typedok:'BC25',
				tglfg_out:$("#txttglpemasukanbc25hdr").val(),
				tglfg_out_apporved:$("#txttglpemasukanapprovedbc25hdr").val(),
			};		
			
			if ($("#idhdrbc25_data_out").val()==''){
						
				alert("Data Belum Di Proses Pengeluaran");
				return false;
			}
			if (form_data.id_bc_out == ''){
						
				alert("Data Belum Di Proses Pengeluaran");
				return false;
			}
						
			$("#dlg_prosesdatatofg_bc25_approved").dialog( "destroy" );
			$(".dlg_prosesdatatofg_bc25_approvedcl").remove();
			$(".dlg_prosesdatatofg_bc25_approvedcl").html('');
			$("body").append('<div id="dlg_prosesdatatofg_bc25_approved" title="Warning" class="dlg_prosesdatatofg_bc25_approvedcl"><p>Apakah anda akan memproses APPROVED data ini?!?</p><br /> Type Doc BC = '+ form_data.typedok +'</div>');
			$("#dlg_prosesdatatofg_bc25_approved").dialog({
				height: 200,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
						if ($("#tglfg_out").val()=='' || $("#tglfg_out_apporved").val()==''){
			
							alert("Please Insert Date");
							return false;
						
						}
					
					$.ajax({
						url : "<?php echo base_url().'inventory/ct_fg/prosesdatatofg_approved'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlg_prosesdatatofg_bc25_approved").dialog("close");
								$('#dlg_prosesdatatofg_bc25_approved').dialog("destroy"); 
								$(".dlg_prosesdatatofg_bc25_approvedcl").remove(); 
								/* jQuery("#tblfgout_hdr").trigger('reloadGrid'); */
							} else { 
								alert(msg.sts+' '+msg.desc); 
								$("#dlg_prosesdatatofg_bc25_approved").dialog("close");
								$('#dlg_prosesdatatofg_bc25_approved').dialog("destroy"); 
								$(".dlg_prosesdatatofg_bc25_approvedcl").remove(); 

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

					}
				},
				close : function(){
					$('#dlg_prosesdatatofg_bc25_approved').dialog("destroy"); 
					$(".dlg_prosesdatatofg_bc25_approvedcl").remove(); 
					$("body").append('<div id="dlg_prosesdatatofg_bc25_approved" title="Warning" class="dlg_prosesdatatofg_bc25_approvedcl"><p>Apakah anda akan memproses file ini?!?</p></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});	
		
		});
	
			
	});
		  	
</script>
</div>
<div id="idprintinstruksi_pemeriksaandlg">
	<button id="view_mainbc25_1">Kembali Ke Hal. Awal</button>
	<hr >
	<iframe id="frameinstruksi_pemeriksaan" src="" frameborder="0" width="100%" height="370">
	</iframe>
	
</div>
<div id="idprintppbidlg">
	<button id="view_mainbc25_2">Kembali Ke Hal. Awal</button>
	<hr >
	<iframe id="frameppbi" src="" frameborder="0" width="100%" height="370">
	</iframe>
	
</div>
<div id="idprintsppbidlg">
	<button id="view_mainbc25_3">Kembali Ke Hal. Awal</button>
	<hr >
	<iframe id="framesppbi" src="" frameborder="0" width="100%" height="370">
	</iframe>
	
</div>
<div id="idprintbc25lampirandlg">
	<button id="view_mainbc25_4">Kembali Ke Hal. Awal</button>
	<hr >
	<iframe id="framebc25lampiran" src="" frameborder="0" width="100%" height="370">
	</iframe>
	
</div>


<!--<div id="instruksi_pemeriksaandlg" title="Print Instruksi Pemeriksaan" class="instruksi_pemeriksaandlg_cl"></div> -->



	
	