<?php 
include "../include/config.php"; 
include "../function/inc_function.php"; 
$start_date = get_startdate();
$end_date   = get_enddate();
$start_date_m2year = start_date_m2year($start_date);
$wonb_id = isset($_REQUEST['wonb_id']) ? $_REQUEST['wonb_id'] :'';
$hd   = mysql_fetch_object(mysql_query("SELECT a.*, b.dept_name FROM workorder_nonbom a INNER JOIN departement b ON b.id=a.wonb_deptid  WHERE a.id='$wonb_id'"));
$comp = mysql_fetch_object(mysql_query("SELECT prof_city FROM profil"));									  
?>
<html>
<head>
<link rel='stylesheet' type='text/css' href="../include/css/print_styles.css" />	
</head>
<body>
<div id="popup">
<h3 align="center">WORK ORDER NON BOM</h1>
<h5>Nomor:<?=$hd->wonb_no;?>  Tanggal:<?=DateToIndo($hd->wonb_date);?> </h5>
<hr size="3"></hr>
<p id="text1">
	Dari :<br>
	<?=$hd->wonb_pic;?><br>
	<?=$hd->dept_name;?><br><br>
	Bersama dengan ini kami sampaikan telah proses produksi sejumlah barang sebagai berikut:    
</p>
<table width="100%">
	<tr>
	</tr>
	<tr>
		<th>No.</th>
		<th>Kode Barang</th>
		<th>Nama Barang</th>
		<th>Jumlah</th>
		<th>Satuan</th>
	</tr>
    <?php
	$no=0;$tprice=0;
	$query = mysql_query("SELECT a.*, b.prod_code,b.prod_name,b.prod_sat, b.prod_cat
						  FROM workorder_nonbom_detail a
						  INNER JOIN product b ON b.id=a.wonbd_prodid
						  WHERE a.wonbd_hid='$wonb_id' ");
	while($data=mysql_fetch_object($query)){
		$no++;
	?>
	 <tr>
		<td align="center"><?=$no;?>.</td>
		<td><?=$data->prod_code;?></td>
		<td><?=$data->prod_name;?></td>
		<td align="right"><?=number_format($data->wonbd_qty,2,'.',',');?></td>
		<td align="center"><?=$data->prod_sat;?></td>
	</tr>	
	<?php } ?>
</table>
<p id="text1">
	Atas perhatian dan kerjasamanya disampaikan terima kasih.<br>
	<?=$comp->prof_city;?>, <?=DateToIndo($hd->wonb_date);?><br>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hormat kami <br><br><br><br><br><br>
	(............................................)
	
</p>
</div>
</body>
</html>
