<?php 
include "../include/config.php"; 
include "../function/inc_function.php"; 
$id_header = isset($_REQUEST['id_header']) ? $_REQUEST['id_header'] :'';
$no_urut   = isset($_REQUEST['no_urut']) ? $_REQUEST['no_urut'] :'';
$status    = isset($_REQUEST['status']) ? $_REQUEST['status'] :'';
$hd = mysql_fetch_array(mysql_query("SELECT a.* FROM log_outgoing a WHERE a.id_header='$id_header' AND no_urut='$no_urut'"));
?>
<html>
<head>
<link rel='stylesheet' type='text/css' href="../include/css/print_styles.css" />	
</head>
<body>
<div id="popup1">
<h3 align="center">DOKUMEN ASAL BAHAN BAKU</h1>
<hr size="3"></hr>
<p id="text1">
	No Aju : <?=$hd['no_aju'];?><br>
	Tanggal Aju : <?=$hd['tgl_aju'];?><br>	
	No Dokumen : <?=$hd['no_dokpab'];?><br>
	Tanggal Dokumen : <?=$hd['tgl_dokpab'];?><br>
	Jenis Dokumen : <?=$hd['jenis_dokpab'];?><br>
	Status Dokuemn : <?=$hd['status_dokpab'];?><br>
	Kode Barang : <?=$hd['kode'];?><br>
	Nama Barang : <?=$hd['nm_barang'];?><br>
	Jumlah : <?=number_format($hd['jumlah'],2,'.',',');?><br>
</p>
<h4>DOKUMEN IMPORT</h4>
<table width="100%">
	<tr>
		<th>No Urut</th>	
		<th>No Aju</th>
		<th>Jenis Dokumen Asal</th>
		<th>No Dokumen Asal</th>
		<th>Tanggal Dokumen Asal</th>
		<th>Kode Barang</th>
		<th>Nama Barang</th>	
		<th>Satuan</th>	
		<th>Jumlah</th>
		<th>Nilai</th>			
	</tr>
	<?php
		$qr2 = mysql_query("SELECT * FROM log_outgoing_dokasal WHERE id_header='$id_header' AND no_urut='$no_urut' AND kode_dokasal=0
			   AND log_status='$status' ORDER BY no_urut,kode_dokasal, no_urut_dokpab ASC");
		while($d2=mysql_fetch_array($qr2)){
	?>
		<tr>
			<td align="center"><?=$d2['no_urut_dokpab'];?></td>
			<td align="center"><?=$d2['noaju_dokpab_asal'];?></td>
			<td align="center"><?=$d2['jenis_dokpab_asal'];?></td>
			<td align="center"><?=$d2['no_dokpab_asal'];?></td>
			<td align="center"><?=$d2['tgl_dokpab_asal'];?></td>
			<td align="left"><?=$d2['kode_barang'];?></td>
			<td align="left"><?=$d2['nm_barang'];?></td>
			<td align="center"><?=$d2['satuan'];?></td>
			<td align="right"><?=number_format($d2['jumlah'],2,',','.');?></td>
			<td align="right"><?=number_format($d2['nilai'],2,',','.');?></td>
		</tr>
	<?php }	?>
</table>
<h4>DOKUMEN LOKAL</h4>
<table width="100%">
	<tr>
		<th>No Urut</th>	
		<th>No Aju</th>
		<th>Jenis Dokumen Asal</th>
		<th>No Dokumen Asal</th>
		<th>Tanggal Dokumen Asal</th>
		<th>Kode Barang</th>
		<th>Nama Barang</th>	
		<th>Satuan</th>	
		<th>Jumlah</th>
		<th>Nilai</th>			
	</tr>
	<?php
		$qr3 = mysql_query("SELECT * FROM log_outgoing_dokasal WHERE id_header='$id_header' AND no_urut='$no_urut' AND kode_dokasal=1
			   AND log_status='$status' ORDER BY no_urut,kode_dokasal, no_urut_dokpab ASC");
		while($d3=mysql_fetch_array($qr3)){
	?>
		<tr>
			<td align="center"><?=$d3['no_urut_dokpab'];?></td>
			<td align="center"><?=$d3['noaju_dokpab_asal'];?></td>
			<td align="center"><?=$d3['jenis_dokpab_asal'];?></td>
			<td align="center"><?=$d3['no_dokpab_asal'];?></td>
			<td align="center"><?=$d3['tgl_dokpab_asal'];?></td>
			<td align="left"><?=$d3['kode_barang'];?></td>
			<td align="left"><?=$d3['nm_barang'];?></td>
			<td align="center"><?=$d3['satuan'];?></td>
			<td align="right"><?=number_format($d3['jumlah'],2,',','.');?></td>
			<td align="right"><?=number_format($d3['nilai'],2,',','.');?></td>
		</tr>
	<?php }	?>
</table>
</div>
</body>
</html>
