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

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

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


	  
	  $table_name = $_SESSION['db_prefix']."_team_supply";
	 $supply_query = "SELECT *  FROM $table_name WHERE  team_supply_no = '".$team_supply_no."' ";
	 $supply_result = mySQL_query($supply_query);
	 $supply_num = mysql_num_rows($supply_result);
	 
	 $team = mysql_result($supply_result, 0, "team_id");
	 $supply_date = mysql_result($supply_result, 0, "issue_date");
	 $issued_by = mysql_result($supply_result, 0, "issued_by");
	 $authorised_by = mysql_result($supply_result, 0, "authorised_by");
	 
	 $table_name = $_SESSION['db_prefix']."_team_supply_lines";
	 $line_query = "SELECT *  FROM $table_name WHERE  team_supply_no = '".$team_supply_no."' ";
	 $line_result = mySQL_query($line_query);
	 $line_num = mysql_num_rows($line_result);

$report_name='Team supply';
?>
<title>Supplied to '<?php $name ?></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>Team 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 $team ?></td>
    <td align="left" valign="top">Team supply no:</td>
    <td align="left" valign="top"><?php echo $team_supply_no ?>&nbsp;</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($supply_date )) ?></td>
    <td width="146" align="left" valign="top">&nbsp;</td>
    <td width="185" align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td align="left" valign="top">Issued by:</td>
    <td align="left" valign="top"><?php echo $issued_by ?></td>
    <td align="left" valign="top">Authorised by:</td>
    <td align="left" valign="top"><?php echo $authorised_by ?></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, "team_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>&nbsp;</b></td>
    </tr>
  <tr>
    <td width="288" height="60">Sign:</td>
    <td width="312">date:</td>
  </tr>
</table>

</div>  
</div>

</body>
</html>