<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<!--reference to main.css removed-->
<?php
include('../include/session.php');
?>

<?php
$dep_supply_no=$_GET['dep_supply_no'];

$table_name = $_SESSION['db_prefix']."_company_supply";
$dep_supply_query = "SELECT *  FROM $table_name WHERE  dep_supply_no = '".$dep_supply_no."' ";
$dep_supply_result = mySQL_query($dep_supply_query);

$b0 = mysql_result($dep_supply_result, 0, "issue_date");
$b1 = mysql_result($dep_supply_result, 0, "department");
$b2 = mysql_result($dep_supply_result, 0, "supplied_to");
$b6 = mysql_result($dep_supply_result, 0, "issued_by");
$b7 = mysql_result($dep_supply_result, 0, "authorised_by");
	  
	 $table_name = $_SESSION['db_prefix']."_company_supply_lines";
	 $line_query = "SELECT *  FROM $table_name WHERE  dep_supply_no = '".$dep_supply_no."' ";
	 $line_result = mySQL_query($line_query);
	 $line_num = mysql_num_rows($line_result);


$report_name='Company supply';
?>
<title>Supplied to '<?php $b1 ?></title>


<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/print.css" />

</head>

<body  onload="window.print(); window.close();" >

<div style="width:800px;">
<?php include('../include/print_report_header.php'); ?>
<br>
<br>
<br>
<div style="width:650px; margin-left:50px; ">
<font font-family:Arial, Helvetica, sans-serif; size="+3"><b>Company supply</b></font>
  <br><br>
<br>
<table width="620" id="tableprint_no_border" >
  <tr>
    <td align="left" valign="top">Supplied to:</td>
    <td align="left" valign="top"><?php echo $b2 ?></td>
    <td align="left" valign="top">Issued to:</td>
    <td align="left" valign="top"><?php echo $b1 ?></td>
  </tr>
  <tr>
    <td width="114" align="left" valign="top">Date:</td>
    <td width="155" align="left" valign="top"><?php echo date("d-m-Y", strtotime($b0 )) ?></td>
    <td width="146" align="left" valign="top">Supply no:</td>
    <td width="185" align="left" valign="top"><?php echo $dep_supply_no ?></td>
  </tr>
  <tr>
    <td align="left" valign="top">Issued by:</td>
    <td align="left" valign="top"><?php echo $b6 ?></td>
    <td align="left" valign="top">Authorised by:</td>
    <td align="left" valign="top"><?php echo $b7 ?></td>
  </tr>
  <tr>
    <td colspan="4" align="left" valign="top">&nbsp;</td>
  </tr>
</table>
<br>
<br>
<table width="620" id="tableprint" >
  <tr>
    <td width="211" height="26" align="left" valign="top">Item</td>
    <td width="116" align="left" valign="top">Group</td>
    <td width="51" align="left" valign="top">Quantity</td>
    <td width="106" align="left" valign="top">Unit price</td>
    <td width="112" align="left" valign="top">Total</td>
  </tr>
  <?php
				$i=0;
				$sub_tot=0;
				$a6_total=0;
				 while ($i<$line_num){
					 $a0 = mysql_result($line_result, $i, "dep_supply_line_id");
					 $a1 = mysql_result($line_result, $i, "store_item_id");
					 $table_name = $_SESSION['db_prefix']."_store_items";
						$item_query = "SELECT item_name, subCategory, unit FROM $table_name WHERE store_item_id = '".$a1."' ";
						$item_result = mySQL_query($item_query);
						$a1a = mysql_result($item_result, 0, "item_name");
						$a3a = mysql_result($item_result, 0, "unit");
						$a4 = mysql_result($item_result, 0, "subCategory");
					 $a2 = mysql_result($line_result, $i, "quantity");
					 $a3 = mysql_result($line_result, $i, "price");
					$a5=$a2*$a3;
					$a6_total=$a6_total+$a5;
					 
				 ?>
  <tr>
    <td valign="top"><?php echo $a1a ?></td>
    <td valign="top"><?php echo $a4 ?></td>
    <td valign="top"><?php echo $a2 ?></td>
    <td align="right" valign="top"><div align="right"><?php echo $a3." /".$a3a ?></div></td>
    <td align="right" valign="top"><div align="right"><?php echo number_format($a5, 2, '.', ',')?></div></td>
  </tr>
  <?php 
			   // $a6_total=$a6_total+$a6;
				$i++;
				 }
				 ?>
  <tr>
    <td colspan="4" align="left" valign="top">&nbsp;</td>
    <td align="left" valign="top"></td>
  </tr>
  <tr>
    <td colspan="4" align="left" valign="top"><div align="right">Total:</div></td>
    <td align="left" valign="top"><div align="right"><?php echo number_format($a6_total, 2, '.', ',') ?></div></td>
  </tr>
</table>
<br>
<br>
<br>
<br>
<table width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="44" colspan="2">Received by: <b><?php echo $b2 ?></b></td>
    </tr>
  <tr>
    <td width="288" height="60">Sign:</td>
    <td width="312">date:</td>
  </tr>
</table>

</div>  
</div>

</body>
</html>