<html>
<head>
<script type="text/javascript"  language="javascript">
	$(document).ready(function(){
		$("#bpbdate").datepicker({
			dateFormat : "yy-mm-dd",
			changeMonth : true,
			changeYear : true,
		});
	});
	$(document).ready(function(){
		$("#invdate").datepicker({
			dateFormat : "yy-mm-dd",
			changeMonth : true,
			changeYear : true,
		});
	});
	$(document).ready(function(){
		$("#docdate").datepicker({
			dateFormat : "yy-mm-dd",
			changeMonth : true,
			changeYear : true,
		});
	});
	$(document).ready(function(){
		$("#tglaju").datepicker({
			dateFormat : "yy-mm-dd",
			changeMonth : true,
			changeYear : true,
		});
	});
	function openwindow(){
		window.open("popup/popup_suppinc.php?","mywindow","menubar=1,scrollbars=1,resizable=1,width=600,height=250");
	}
	function openwindow1(){
		window.open("popup/popup_barang.php?","mywindow","menubar=1,scrollbars=1,resizable=1,width=600,height=250");
	}
	function pilih(id){
		var y  = document.getElementById("inch_purpid");		
		$.ajax({type: "POST",
			url: "transaksi/manual/load_purpose.php", 
			data: "docid="+id,
			success: function(result){			
			y.innerHTML="<option value='0'>PILIH</option>";
			arr_data = result.split("XX");
			if(id==1){ /*BC 2.3 */
				var option = document.createElement("option");
					option.text = arr_data[1];
					option.value = arr_data[0];
					y.add(option);
				var option = document.createElement("option");
					option.text = arr_data[3];
					option.value = arr_data[2];
					y.add(option);						
			}else if(id==3){ /*BC 2.6.2 */
				var option = document.createElement("option");
					option.text = arr_data[1];
					option.value = arr_data[0];
					y.add(option);
				var option = document.createElement("option");
					option.text = arr_data[3];
					option.value = arr_data[2];
					y.add(option);						
			}else if(id==4){ /*BC 2.7 */
				var option = document.createElement("option");
					option.text = arr_data[1];
					option.value = arr_data[0];
					y.add(option);
				var option = document.createElement("option");
					option.text = arr_data[3];
					option.value = arr_data[2];
					y.add(option);						
			}else if(id==5){ /*BC 4.0 */
				var option = document.createElement("option");
					option.text = arr_data[1];
					option.value = arr_data[0];
					y.add(option);					
			}
		}});
	}
	$(document).ready(function(){
		var inc = {
			source: "transaksi/manual/json_prodinc.php",					
			select: function(event, ui){
				$("#prodcode").val(ui.item.prod_code); 
				$("#prodid").val(ui.item.prod_id); 
				$("#prodsat").val(ui.item.prod_sat); 
			},
			minLength: 1
		};
		$("#prodcode").autocomplete(inc);		
	});	
	function currency_click(currency){
		if(currency=="IDR"){
			var nilai=1;
		}else{
			var nilai=0;		
		}
		$("#n_rate").val(nilai);
	 }
	 function save_click(){
		if(form.inch_bpbno.value==""){
			alert("Silakan isi no masuk.");
			form.inch_bpbno.focus();
			return false;
		}else if(form.sup_name.value==""){
			alert("Silakan isi nama pemasok.");
			form.sup_name.focus();
			return false;
		}else if((form.inch_invno.value=="") ){
			alert("Silakan isi nomor invoice.");
			form.inch_invno.focus();
			return false;
		}else if((form.inch_dono.value=="") ){
			alert("Silakan isi nomor DO.");
			form.inch_dono.focus();
			return false;
		}else if((form.inch_docid.value=="BLANK") ){
			alert("Silakan pilih jenis dokumen.");
			form.inch_docid.focus();
			return false;
		}else if((form.inch_purpid.value=="BLANK") ){
			alert("Silakan pilih tujuan dokumen.");
			form.inch_purpid.focus();
			return false;
		}else if((form.inch_docno.value=="") ){
			alert("Silakan isi nomor dokumen.");
			form.inch_docno.focus();
			return false;
		}else if((form.no_aju.value=="") ){
			alert("Silakan isi nomor aju.");
			form.no_aju.focus();
			return false;
		}else if((form.po_no.value=="10") && (form.tqty.value==0) ){
			alert("Silakan isi detail barang.");
			form.tqty.focus();
			return false;
		}else if((form.inch_currency.value=="BLANK") ){
			alert("Silakan pilih valuta.");
			form.inch_currency.focus();
			return false;
		}else if((form.n_rate.value==0) ){
			alert("Kurs tidak boleh nol.");
			form.n_rate.focus();
			return false;
		}else if((form.tipe_dokumen.value=="BLANK") ){
			alert("Silakan pilih tipe dokumen.");
			form.tipe_dokumen.focus();
			return false;
		}else{
			var a = confirm("Apakah anda yakin akan menyimpan data?");
			if (a == true){
				form.action ='?page=Proses-Pemasukan-BC20&Act=SAVEM';
				form.method = 'post';
				form.submit();			
				return true;
			}
		}
	}
	function add_det_click(){
		if(form.prodid.value==""){
			alert("Silakan isi nama barang.");
			form.prodname.focus();
			return false;
		}else if((form.incdqty.value=="") ){
			alert("Silakan isi jumlah barang.");
			form.incdqty.focus();
			return false; 
		}else if((form.incdprice.value=="") ){
			alert("Silakan isi harga barang.");
			form.incdprice.focus();
			return false;
		}else if((form.incdamount.value=="") ){
			alert("Silakan nilai barang.");
			form.incdamount.focus();
			return false;
		}else if((form.incdweight.value=="") ){
			alert("Silakan isi berat barang.");
			form.incdweight.focus();
			return false;
		}else{
			form.action ='?page=Proses-Pemasukan-BC20&Act_Det=ADD_DETM';
			form.method = 'post';
			form.submit();			
			return true;
		}
	}
	function delete_detail_click(id){
		form.action ='?page=Proses-Pemasukan-BC20&Act_Det=DELETE_DETM&id_deth='+id;
		form.method = 'post';
		form.submit();			
		return true;
	}
	function close_click(){
		form.action ='?page=Proses-Pemasukan-BC20&Act=CLOSE'
		form.method = 'post';
		form.submit();		
		return true;
	}
	function popup_item(){
		window.open("popup/popup_item.php?","mywindow","menubar=1,scrollbars=1,resizable=1,width=650,height=250");
	}
	function pono_click(po_no){
		form.action ='?page=Proses-Pemasukan-BC20&Act=SEL_PO&po_no='+po_no
		form.method = 'post';
		form.submit();		
		return true;
	}
	function cal_click(){
		var c  = $("#inch_currency").val();
		var q  = $("#incdqty").val();
		var r  = $("#n_rate").val();		
		var th = $("#totalharga").val();
		var p  = eval(th)/eval(q);
		if(c=="IDR"){
			var nidr  = eval(th); 
			var nusd  = 0; 
		}else{
			var nidr  = eval(th)*eval(r); 
			var nusd  = eval(th);
		}
		$("#incdprice").val(p);	
		$("#n_usd").val(nusd);
		$("#incdamount").val(nidr);
	}
</script>
</head>
<form action="#" method="post" name="form" target="_self" enctype="multipart/form-data">
<table width="100%" cellpadding="2" cellspacing="1" class="table-list" style="margin-top:0px;">
	<tr>
	  <th colspan="4">HEADER PEMASUKAN - BC 2.0</th>
	</tr>
	<tr>
	  <td width="15%">Ref# No. PO</td>
	  <td width="35%">: 
	  	<input type="hidden" name="inch_id" value="<?php echo $inch_id; ?>" size="50" />
		<?php if(empty($inch_id)){ ?>
		<select name="po_no" onChange="pono_click(this.value);">
		  <option value="10" selected="selected">PILIH</option> 
			<?php
			  $dataSql = mysql_query("SELECT po_no FROM purchase_order WHERE po_status=20 AND po_type='Purchasing' ORDER BY  po_no ASC");
			  while ($dataRow = mysql_fetch_array($dataSql)) {
				if ($dataRow['po_no']== $po_no) {
					$cek = " selected";
				} else { $cek=""; }
				echo "<option value='$dataRow[po_no]' $cek>$dataRow[po_no]</option>";
			  }
			  $sqlData ="";
			?>
		 </select>
		 <?php }else{ ?>
		 <input type="hidden" name="po_no" value="<?php echo $po_no; ?>" size="50" />
		 <select name="po_no" onChange="pono_click(this.value);" disabled="disabled">
		  <option value="10" selected="selected">PILIH</option> 
			<?php
			  $dataSql = mysql_query("SELECT po_no FROM purchase_order WHERE po_status IN(20,30) ORDER BY  po_no ASC");
			  while ($dataRow = mysql_fetch_array($dataSql)) {
				if ($dataRow['po_no']== $po_no) {
					$cek = " selected";
				} else { $cek=""; }
				echo "<option value='$dataRow[po_no]' $cek>$dataRow[po_no]</option>";
			  }
			  $sqlData ="";
			?>
		 </select>
		 <?php } ?>
	  </td>
	  <td width="15%">Valuta & Kurs</td>
	  <td width="35%">: <select name="inch_currency" id="inch_currency" onChange="currency_click(this.value);">
			  <option value="BLANK">PILIH</option> 
				<?php
				  $dataSql = mysql_query("SELECT currency FROM currency ORDER BY id ASC");
				  while ($dataRow = mysql_fetch_array($dataSql)) {
					if ($dataRow['currency']== $incd_currency) {
						$cek = " selected";
					} else { $cek=""; }
					echo "<option value='$dataRow[currency]' $cek>$dataRow[currency]</option>";
				  }
				  $sqlData =""; 
				?>
			 </select>&nbsp;
			 <input type="text" id="n_rate" name="n_rate" value="<?=$incd_price_rate;?>" size="10" style="text-align:right">
	  </td>
	</tr>
    <tr>
	  <td>No Surat Jalan</td>
	  <td>: <input type="text" name="inch_bpbno" value="<?php echo $inch_bpbno; ?>" size="20" style="background-color:#CCFFFF"></td>
	  <td>No DO</td>
	  <td>: <input type="text" name="inch_dono" value="<?php echo $inch_dono; ?>" size="20"></td>
	</tr>
	<tr>
		<td>Tanggal Masuk</td>
		<td>: <input type="text" name="inch_bpbdate" value="<?php if(empty($inch_bpbdate)){$inch_bpbdate=$date;} echo $inch_bpbdate; ?>" size="12" id="bpbdate" 
				  readonly="true" style="background-color:#CCFFFF " /> </td>
		<td>Jenis Dokumen</td>
		<td>: <select name="inch_docid" onChange="pilih(this.value);">
					<?php
					  $dataSql = mysql_query("SELECT id,doc_type FROM document_type WHERE doc_status=1 AND id=6 ORDER BY  id ASC");
					  while ($dataRow = mysql_fetch_array($dataSql)) {
						if ($dataRow['id']== $inch_docid) {
							$cek = " selected";
						} else { $cek=""; }
						echo "<option value='$dataRow[id]' $cek>$dataRow[doc_type]</option>";
					  }
					  $sqlData ="";
					?>
				 </select>
		 	
		</td>
	</tr>
	<tr>
		<td>Pemasok</td>
		<td>: <input type="hidden" name="sup_id" value="<?php echo $sup_id; ?>" size="10" />
			  <input type="hidden" name="sup_npwp" value="<?php echo $sup_npwp; ?>" size="10" />
				 <input type="text" name="sup_name" value="<?php echo $sup_name; ?>" size="30" readonly style="background-color:#CCFFFF " />		
				 <a href="javascript: openwindow('');"><img src="images/popup.png" height="15" width="15" title="Tambah" border="0" />
			 </td>
		<td>Tujuan</td>
		<td>: 
			<select name="inch_purpid" id="inch_purpid">
			  <option value="BLANK">PILIH</option> 
				<?php
				  $dataSql = mysql_query("SELECT id, purp_desc FROM purpose WHERE purp_docid='1' ORDER BY id ASC");
				  while ($dataRow = mysql_fetch_array($dataSql)) {
					if ($dataRow['id']== $inch_purpid) {
						$cek = " selected";
					} else { $cek=""; }
					echo "<option value='$dataRow[id]' $cek>$dataRow[purp_desc]</option>";
				  }
				  $sqlData =""; 
				?>
			 </select>
		</td>
	</tr>
	<tr>
		<td>No Invoice</td>
		<td>: <input type="text" name="inch_invno" value="<?=$inch_invno;?>"></td>
		<td>No Dokumen</td>
		<td>: <input type="text" name="inch_docno" size="6" maxlength="6" value="<?=$inch_docno;?>"></td>
	</tr>
	<tr>
		<td>Tanggal Invoice</td>
		<td>: <input type="text" name="inch_invdate" value="<?php if(empty($inch_invdate)){$inch_invdate=$date;} echo $inch_invdate; ?>" size="12" id="invdate" 
				  readonly="true" style="background-color:#CCFFFF " />
		</td>
		<td>Tanggal Dokumen</td>
		<td>: <input type="text" name="inch_docdate" value="<?php if(empty($inch_docdate)){$inch_docdate=$date;} echo $inch_docdate; ?>" size="12" id="docdate" 
				  readonly="true" style="background-color:#CCFFFF " /></td>
	</tr>
	<tr>
		<td>No Aju</td>
		<td>: <input type="text" name="no_aju" size="30" maxlength="30" value="<?=$no_aju;?>"></td>
		<td>Tanggal Aju</td>
		<td>: <input type="text" name="tgl_aju" value="<?php if(empty($tgl_aju)){$tgl_aju=$date;} echo $tgl_aju; ?>" size="12" id="tglaju" 
				  readonly="true" style="background-color:#CCFFFF " /></td>
	</tr>    
	<tr>
		<td>Tipe Dokumen</td>
		<td>: <select name="tipe_dokumen">
				<option value="BLANK">PILIH</option>
					<?php
					  $dataSql = mysql_query("SELECT id,doc_type FROM document_type WHERE doc_status=3 ORDER BY  id ASC");
					  while ($dataRow = mysql_fetch_array($dataSql)) {
						if ($dataRow['doc_type']== $tipe_dokumen) {
							$cek = " selected";
						} else { $cek=""; }
						echo "<option value='$dataRow[doc_type]' $cek>$dataRow[doc_type]</option>";
					  }
					  $sqlData ="";
					?>
				 </select></td>
		<td>Harga Maklon</td>
		<td>: <input type="text" name="harga_dokumen" size="20" maxlength="20" value="<?=$harga_dokumen;?>" style="text-align:right"></td>
	</tr> 
	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>    
	<tr>
		<th colspan="4">DETAIL PEMASUKAN - BC 2.0</th>
	</tr>
    <?php if(($po_no=='10') || empty($po_no)){  ?>
	<tr>
		<td colspan="4">
			<table width="100%" border="0">
				<tr>
					<td>Kode/Nama Barang</td>
					<td>Satuan</td>
					<td>Jumlah</td>
					<td>Nilai</td>
					<td>Harga Satuan</td>
					<!--<td>&nbsp;</td>
					<td>Rate</td>-->
					<td>Nilai Non IRD</td>
					<td>Nilai IDR</td>
					<td>Berat</td>
					<td>Action</td>
				</tr>
				<tr>
					<td><input type="hidden" name="prodid" id="prodid" style="width:300px;">
					    <input type="text" name="prodcode" id="prodcode" style="width:200px; background-color:#CCFFFF" >
						<img src="images/popup.png" height="15" width="15" title="Popup Item Master" style="cursor:pointer" border="0" onClick="popup_item();" />
					</td>
					<td>
						<input type="text" name="prod_sat" id="prodsat" style="width:50px; text-align:left; background-color:#CCFFFF" readonly>
						<input type="hidden" name="prodstock" id="prodstock" style="width:50px; text-align:left; background-color:#CCFFFF" readonly>
					</td>
					<td><input type="text" id="incdqty" name="incdqty" style="width:60px; text-align:right"></td>
					<td><input type="text" id="totalharga" name="totalharga" style="width:100px; text-align:right" onBlur="cal_click();"></td>
					<td><input type="text" id="incdprice" name="incdprice" style="width:100px; text-align:right"></td>					
					<td>
						<input type="text" id="n_usd" name="n_usd" style="width:100px; text-align:right">
					</td>
					<td>
						<input type="text" id="incdamount" name="incdamount" style="width:100px; text-align:right">
					</td>
					<td><input type="text" name="incdweight" style="width:70px; text-align:right ">&nbsp;Kg</td>
					<td><input type="button" name="Add_Detail" value="Tambah" style="cursor:pointer" onClick="add_det_click();"></td>
				</tr>
			</table>
		</td>
	</tr>
    <?php } ?>
	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="4">
		   <?php if(empty($inch_id) && !empty($po_no) && $po_no != "10"){ ?>			
			<table width="100%">
				<tr>
					<td align="center">No.</td>
					<td align="center">Nama Barang</td>
					<td align="center">Unit</td>
					<td align="center">Qty PO</td>
					<td align="center">Qty Rcv</td>
					<td align="center">Qty Rmn</td>
					<td align="center">Qty Input</td>
					<td align="center">Harga</td>
					<td align="center">Total</td>
					<td align="center">Berat</td>
					<!--<td align="center">No Urut</td>-->
				</tr>
				<?php
					$no=0; 
					$qd = mysql_query("SELECT a.*, b.prod_code,b.prod_name,b.prod_sat
									   FROM purchase_order_detail a
									   INNER JOIN product b ON b.id=a.pod_prodid
						   			   WHERE a.po_no='$po_no'");
					while($dt=mysql_fetch_object($qd)){	   
						$no++;
						#cek terima
						$cek = mysql_fetch_array(mysql_query("SELECT SUM(a.incd_qty) qty_rcv FROM incoming_detail a INNER JOIN incoming b ON b.id=a.incd_hid
						WHERE b.inch_status IN(15,20) AND a.incd_prodid='$dt->pod_prodid' AND b.po_no='$po_no'"));
						#sisa qty
						$qty_rmn=$dt->pod_qty-$cek['qty_rcv'];
					if($qty_rmn>0){					
				?> 
				  <tr>
					<td align="center"><?=$no;?></td>
					<td><?php echo "$dt->prod_code - $dt->prod_name";?></td>
					<td align="center"><?=$dt->prod_sat;?></td>
					<td align="center">
						<input type="hidden" name="prod_name2[<?=$dt->id;?>]" value="<?=$dt->prod_name;?>" size="15" style="text-align:right">
						<input type="hidden" name="pilih[<?=$dt->id;?>]" value="<?=$dt->id;?>" size="15" style="text-align:right">
						<input type="hidden" name="incd_prodid2[<?=$dt->id;?>]" value="<?=$dt->pod_prodid;?>" size="15" style="text-align:right">
						<input type="text" name="pod_qty[<?=$dt->id;?>]" value="<?=$dt->pod_qty;?>" size="8" style="text-align:center" readonly>
					</td>
					<td align="center">
						<input type="text" name="incd_rcv[<?=$dt->id;?>]" value="<?=$cek['qty_rcv'];?>" size="8" style="text-align:center" readonly>
					</td>
					<td align="center">
						<input type="text" name="incd_rmn[<?=$dt->id;?>]" value="<?=$qty_rmn;?>" size="8" style="text-align:center" readonly>
					</td>
					<td align="center">
						<input type="text" name="incd_qty2[<?=$dt->id;?>]" value="0" size="8" style="text-align:center">
					</td>
					<td align="center">
						<input type="text" name="pod_price[<?=$dt->id;?>]" value="<?=$dt->pod_price;?>" size="10" style="text-align:right">						
					</td>
					<td align="center">
						<input type="text" name="incd_price2[<?=$dt->id;?>]" value="<?=$dt->pod_amount;?>" size="10" style="text-align:right">						
					</td>
					<td align="center">
						<input type="text" name="incd_weight2[<?=$dt->id;?>]" value="0" size="10" style="text-align:right">&nbsp;KG
					</td>
					<!--<td align="center">
						<input type="text" name="no_urut2[<?=$dt->id;?>]" value="0" size="5" style="text-align:center">
					</td>-->
				</tr>
					<?php } } ?>				
			</table>
			<?php }else if(empty($inch_id) && ($po_no=='10' || empty($po_no))){  ?>				
			<table width="100%">
				<tr>
					<td align="center">No.</td>
					<td align="center">Nama Barang</td>
					<td align="center">Unit</td>
					<td align="center">Jumlah</td>
					<td align="center">Harga</td>
					<!--<td align="center">Rate</td>-->
					<td align="center">Nilai(Non IDR)</td>
					<td align="center">Nilai(IDR)</td>
					<td align="center">Berat</td>					
					<td align="center">Action</td>
				</tr>
				<?php
					$no=0; $tqty=0; $tprice=0; $tamount=0; $tweight=0; $tprice_usd=0;
					$qd = mysql_query("SELECT a.*, b.prod_code,b.prod_name,b.prod_sat
									   FROM incoming_temp a
									   INNER JOIN product b ON b.id=a.incd_prodid
									   WHERE a.incd_inputby='$user_id' AND incd_status=10order by a.id ASC");
					while($dt=mysql_fetch_object($qd)){	   
				    $no++;
					$tqty     = $tqty + $dt->incd_qty; 
					$tprice   = $tprice + $dt->incd_price;
					$tweight  = $tweight + $dt->incd_weight;
					$tprice_usd = $tprice_usd + $dt->incd_price_usd;
				?> 
				  <tr>
					<td style="width:20px;" align="center"><?=$no;?></td>
					<td style="width:300px;"><?php echo "$dt->prod_code - $dt->prod_name";?></td>
					<td style="width:150px;" align="center"><?=$dt->prod_sat;?></td>
					<td style="width:150px;" align="right"><?=number_format($dt->incd_qty,2,'.',',');?></td>
					<td style="width:150px;" align="right"><?=number_format($dt->incd_price_satuan,2,'.',',');?>&nbsp;<?=$dt->incd_currency;?></td>
					<!--<td style="width:150px;" align="right"><?=number_format($dt->incd_price_rate,2,'.',',');?></td>-->
					<td style="width:150px;" align="right"><?=number_format($dt->incd_price_usd,2,'.',',');?></td>
					<td style="width:150px;" align="right"><?=number_format($dt->incd_price,2,'.',',');?>&nbsp;IDR</td>
					<td style="width:150px;" align="right"><?=number_format($dt->incd_weight,2,'.',',');?>&nbsp;<?=$dt->incd_wunit;?></td>
					<td style="width:170px;" align="center">
						<img src="images/btn_delete.png" width="20" height="20"  border="0"  title="Hapus" style="cursor:pointer" onClick="delete_detail_click('<?=$dt->id;?>');"/>
					</td>
				</tr>
				<?php } ?>
				<tr>
					<td colspan="3" align="right">Total</td>
					<td align="right"><?=number_format($tqty,2,'.',',');?><input type="hidden" name="tqty" value="<?=$tqty;?>"></td>
					<td align="right">&nbsp;</td>
					<td align="right"><?=number_format($tprice_usd,2,'.',',');?></td>
					<td align="right"><?=number_format($tprice,2,'.',',');?>&nbsp;IDR</td>
					<td align="right"><?=number_format($tweight,2,'.',',');?>&nbsp;Kg</td>
					<td>&nbsp;</td>
				</tr>
			</table>
			<?php }else if(!empty($inch_id)){ ?>
			<table width="100%">
				<tr>
					<td align="center">No.</td>
					<td align="center">Nama Barang</td>
					<td align="center">Unit</td>
					<td align="center">Jumlah</td>
					<td align="center">Harga</td>
					<!--<td align="center">Rate</td>>-->
					<td align="center">Nilai(Non IDR)</td>
					<td align="center">Nilai(IDR)</td>
					<td align="center">Berat</td>
					<!--<td align="center">Ket.</td>-->
					<td align="center">Action</td>
				</tr>
				<?php
					$no=0; $tqty=0; $tprice=0; $tamount=0; $tweight=0; $tprice_usd=0;
					$qd = mysql_query("SELECT a.*, b.prod_code,b.prod_name,b.prod_sat
									   FROM incoming_detail a
									   INNER JOIN product b ON b.id=a.incd_prodid
						   			   WHERE a.incd_hid='$inch_id' order by a.id ASC");
					while($dt=mysql_fetch_object($qd)){	   
				    $no++;
					$tqty     = $tqty + $dt->incd_qty; 
					$tprice   = $tprice + $dt->incd_price;
					$tweight  = $tweight + $dt->incd_weight;
					$tprice_usd = $tprice_usd + $dt->incd_price_usd;
				?> 
				  <tr>
					<td align="center"><?=$no;?><input type="hidden" name="id_det[<?=$dt->id;?>]" value="<?=$dt->id;?>"></td>
					<td><input type="text" value="<?php echo "$dt->prod_code - $dt->prod_name";?>" size="30" readonly></td>
					<td align="center"><input type="text" value="<?=$dt->prod_sat;?>" size="8" readonly style="text-align:center"></td>
					<td align="right"><input type="text" name="incd_qty[<?=$dt->id;?>]" value="<?=$dt->incd_qty;?>" size="7" style="text-align:right"></td>
					<td align="right">
						<input type="text" name="incd_price_satuan[<?=$dt->id;?>]" value="<?=$dt->incd_price_satuan;?>" size="10" style="text-align:right">
						<input type="text" name="incd_currency[<?=$dt->id;?>]" value="<?=$dt->incd_currency;?>" size="5" style="text-align:center">
					</td>
					<!--<td align="right"><input type="text" name="incd_price_rate[<?=$dt->id;?>]" value="<?=$dt->incd_price_rate;?>" size="10" style="text-align:right"></td>-->
					<td align="right"><input type="text" name="incd_price_usd[<?=$dt->id;?>]" value="<?=$dt->incd_price_usd;?>" size="10" style="text-align:right"></td>
					<td align="right">
						<input type="text" name="incd_price[<?=$dt->id;?>]" value="<?=$dt->incd_price;?>" size="10" style="text-align:right">&nbsp;IDR
						<input type="hidden" name="incd_price_rate[<?=$dt->id;?>]" value="<?=$dt->incd_price_rate;?>" size="10" style="text-align:right">
					</td>
					<td align="right">
						<input type="text" name="incd_weight[<?=$dt->id;?>]" value="<?=$dt->incd_weight;?>" size="10" style="text-align:right">&nbsp;<?=$dt->incd_wunit;?>
					</td>
					<!--<td align="left">
						<input type="text" name="incd_desc[<?=$dt->id;?>]" value="<?=$dt->incd_desc;?>" size="20" style="text-align:left">
					</td>-->
					<td align="center">
						<img src="images/btn_delete.png" width="20" height="20"  border="0"  title="Hapus" style="cursor:pointer" onClick="delete_detail_click('<?=$dt->id;?>');"/>
					</td>
				</tr>
				<?php } ?>
				<tr>
					<td colspan="3" align="right">Total</td>
					<td align="right"><?=number_format($tqty,2,'.',',');?><input type="hidden" name="tqty" value="<?=$tqty;?>"></td>
					<td>&nbsp;</td>
					<td align="right"><?=number_format($tprice_usd,2,'.',',');?></td>
					<td align="right"><?=number_format($tprice,2,'.',',');?>&nbsp;IDR</td>
					<td align="right"><?=number_format($tweight,2,'.',',');?>&nbsp;Kg</td>
					<td>&nbsp;</td>
				</tr>
			</table>
			<?php } ?>
		</td>
	</tr>
	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="4" align="center">
			<input type="button" name="btnSave" value="SIMPAN" style="cursor:pointer;" onClick="save_click();">
			<input type="button" value="BATAL" name="batal" style="cursor:pointer"  onClick="close_click();" />
		</td>
    </tr>
</table>
</form>
</html> 
