<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include('../include/session.php');
$delivery_no = $_GET['delivery_no'];

   
		$table_name = $_SESSION['db_prefix']."_tile_deliver";
		$quote_query = "SELECT *  FROM $table_name WHERE delivery_no = '".$delivery_no."'";
		$quote_result = mySQL_query($quote_query);
		$cust_id=mysql_result($quote_result, 0, "cust_id");
		$deliver_date=mysql_result($quote_result, 0, "deliver_date");
		$del_col=mysql_result($quote_result, 0, "del_col");
		$order_no=mysql_result($quote_result, 0, "order_no");
		$pallets=mysql_result($quote_result, 0, "pallets");
		$delivery_address=mysql_result($quote_result, 0, "delivery_address");			 
		$delivered_by=mysql_result($quote_result, 0, "delivered_by");
		$delivery_time=mysql_result($quote_result, 0, "delivery_time");	
		$vehicle_reg=mysql_result($quote_result, 0, "vehicle_reg");				 
		
		$quote='no';
								
		$table_name = $_SESSION['db_prefix']."_tile_deliver_lines";
		$line_query = "SELECT *  FROM $table_name WHERE delivery_no = '".$delivery_no."' ";
		$line_result = mySQL_query($line_query);
		$line_num = mysql_num_rows($line_result);
	
$report_name = 'Delivery';
$report_no = $delivery_no;
?>

<!--style sheets-->
<link href="../css/print.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" type="image/x-icon" href="../images/favicon.ico">
<title>Tiles delivery <?php echo $delivery_no ?></title>

</head>

<body>

<script>
window.onload = function () {
  window.print();
  setTimeout(function(){window.close();}, 100);
}
</script>

<?php include('../include/print_header.php'); ?>
<div class="print_main_frame" style="height:auto; margin-left:50px;">
<br>
<br>

<div class="print_standard_frame">

</div>
<br>

  <div class="print_standard_frame">
        <table width="652" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="483">Order no <?php echo $order_no ?> delivered to:</td>
    <td width="169">Delivery date: <?php echo date("d-m-Y", strtotime($deliver_date)) ?></td>
  </tr>
</table>
<br>

        <?php 
		include ('../include/customer_block.php');
		?>
         </div><br>
<br>
<div class="print_standard_frame">
<label class="print_header_label_std">Delivery address:</label><br>
<table width="650" id="table_display" >
  <tr>
    <td width="118">Plot no:</td>
    <td><?php echo $delivery_address ?></td>
    </tr>
  
</table>
</div>

<div class="print_standard_frame">
<label class="print_header_label_std">Items delivered:</label>
<br>
<br>
         <table width="650" id="table_display" >
           <tr>
             <td height="26" align="left" valign="top">Item</td>
             <td width="116" align="left" valign="top">Group</td>
             <td width="71" align="left" valign="top">Unit</td>
             <td width="56" align="left" valign="top">Quantity</td>
             <td width="56" align="left" valign="top">Replacement</td>
             <td colspan="2" align="center" valign="top">Batch codes</td>
           </tr>
           <?php
				$i=0;
				$sub_tot=0;
				$a5_total=0;
				 while ($i<$line_num){
					 $a0 = mysql_result($line_result, $i, "delivery_line_id");
					 $a1 = mysql_result($line_result, $i, "store_item_id");
					 $table_name = $_SESSION['db_prefix']."_store_items";
						$item_query = "SELECT item_name, unit, subCategory 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");
						$a4a = mysql_result($item_result, 0, "subCategory");
					 $a2 = mysql_result($line_result, $i, "quantity");
					 $a5 = mysql_result($line_result, $i, "batch_1");
					 $a6 = mysql_result($line_result, $i, "batch_2");
					 $a7 = mysql_result($line_result, $i, "replace_qty");
					 
										 
				 ?>
           <tr>
             <td valign="top"><?php echo $a1a ?></td>
             <td valign="top"><?php echo $a4a ?></td>
             <td valign="top"><?php echo $a3a ?></td>
             <td align="right" valign="top"><?php echo $a2 ?></td>
             <td align="right" valign="top"><?php echo $a7 ?></td>
             <td width="56" align="center" valign="top"><?php echo $a5 ?></td>
             <td width="56" align="center" valign="top"><?php echo $a6 ?></td>
           </tr>
           <?php 
			   // $a6_total=$a6_total+$a6;
				$i++;
				 }
				 ?>
           <tr>
             <td valign="top">Pallets</td>
             <td valign="top">&nbsp;</td>
             <td valign="top">&nbsp;</td>
             <td align="right" valign="top"><?php echo $pallets ?></td>
             <td align="right" valign="top">&nbsp;</td>
             <td align="center" valign="top">&nbsp;</td>
             <td align="center" valign="top">&nbsp;</td>
           </tr>       
         </table>
			<div align="left">
<img src="../images/info_green.png" width="16" height="16">
<label class="label_info">Pallets to be refunded on return. / Offloading to be done by customer.</label>          
</div>
         </div>
         <br>
<div class="print_standard_frame">
<table width="652" id="table_display">
  <tr>
    <td width="113" height="36">Delivery by:</td>
    <td width="220"><?php echo $delivered_by ?></td>
    <td width="120">Received by:</td>
    <td width="199">&nbsp;</td>
  </tr>
  <tr>
    <td height="30">Registration no:</td>
    <td><?php echo $vehicle_reg ?></td>
    <td>Date:</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="30">Driver name:</td>
    <td>&nbsp;</td>
    <td>Customer name:</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="37">Driver sign:</td>
    <td>&nbsp;</td>
    <td>Customer sign:</td>
    <td>&nbsp;</td>
  </tr>
</table>

</div>         
<br>
</div>
 
  



</body>


