<?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);
$trf_id = isset($_REQUEST['trf_id']) ? $_REQUEST['trf_id'] :'';
$hd   = mysql_fetch_object(mysql_query("SELECT a.*, b.dept_name FROM transfer a INNER JOIN departement b ON b.id=a.trf_deptid WHERE a.id='$trf_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">TRANSFER BAHAN BAKU & BAHAN PENOLONG</h1>
<h5>Nomor:<?=$hd->trf_spbno;?>  Tanggal:<?=DateToIndo($hd->trf_spbdate);?> </h5>
<hr size="3"></hr>
<p id="text1">
	Dari :<br>
	<?=$hd->trf_pic;?><br>
	<?=$hd->dept_name;?><br><br>
	No./Tanggal Permintaan: <?=$hd->trf_reqno;?>/<?=DateToIndo($hd->trf_reqdate);?><br><br>
	Bersama dengan ini kami sampaikan telah kirimkan 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>
        <th>Jenis</th>
        <th>Nomor</th>
		<th>Tanggal</th>
	</tr>
    <?php
	$no=0;
	$query = mysql_query("SELECT a.*, b.prod_code,b.prod_name,b.prod_sat
						  FROM transfer_detailexbc a
						  INNER JOIN product b ON b.id=a.trfd_prodid
						  WHERE a.trfd_hid='$trf_id' ");
	while($data=mysql_fetch_object($query)){
		$no++;
		$itemprice = get_unitprice_bb($start_date_m2year,$end_date,$data->trfd_prodid);
		$tprice    = $data->trfd_qty*$itemprice;
	?>
	 <tr>
		<td align="center"><?=$no;?>.</td>
		<td><?=$data->prod_code;?></td>
		<td><?=$data->prod_name;?></td>
		<td align="right"><?=number_format($data->trfd_qty,2,'.',',');?></td>
		<td align="center"><?=$data->prod_sat;?></td>
        <td align="center"><?=$data->trfd_doctype;?></td>
		<td align="center"><?=$data->trfd_docno;?></td>
		<td align="center"><?=$data->trfd_docdate;?></td>
	</tr>	
	<?php } ?>
</table>
<p id="text1">
	Atas perhatian dan kerjasamanya disampaikan terima kasih.<br>
	<?=$comp->prof_city;?>, <?=DateToIndo($hd->trf_spbdate);?><br>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hormat kami <br><br><br><br><br><br>
	(............................................)
	
</p>
</div>
</body>
</html>
