<head>
<?php
$table_name = $_SESSION['db_prefix']."_supply_customer";
$deliver_query = "SELECT * FROM $table_name WHERE supply_id = '".$supply_id."'  ";
$deliver_result = mySQL_query($deliver_query);
$deliver_num = mysql_num_rows($deliver_result);
$a1 = mysql_result($deliver_result, 0, "job_no");
$a2 = mysql_result($deliver_result, 0, "cust_id");
$a3 = mysql_result($deliver_result, 0, "delivery_note");
$a4 = mysql_result($deliver_result, 0, "delivery_address");
$a5 = mysql_result($deliver_result, 0, "delivered_by");
$a6 = mysql_result($deliver_result, 0, "vehicle_reg");
$a7 = mysql_result($deliver_result, 0, "delivery_date");
$a8 = mysql_result($deliver_result, 0, "delivery_time");

$table_name2 = $_SESSION['db_prefix']."_customer";
$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$a2."' ";
$customer_result = mySQL_query($customer_query);
$a0a = mysql_result($customer_result, 0, "account_type");
if ($a0a=="corporate") { 
$a0 = mysql_result($customer_result, 0, "comp_name"); 
} 
else {
$a0 = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 }
$a2b = mysql_result($customer_result, 0, "bag_box");
$a2c = mysql_result($customer_result, 0, "box_no");
$a2d = mysql_result($customer_result, 0, "postal_place");
$a2e = mysql_result($customer_result, 0, "phone");
$a2f = mysql_result($customer_result, 0, "contact_1");

$table_name8 = $_SESSION['db_prefix']."_supply_customer";
$deliveries_query = "SELECT delivery_note, supply_id, type, job_no,cust_id, delivery_date FROM $table_name8 WHERE job_no = '".$a1."' ";
$deliveries_result = mySQL_query($deliveries_query);
$deliveries_num = mysql_num_rows($deliveries_result);
$today = date("Y-m-d");
?>
<title>KC ROOFING Delivery note <?php echo $a3; ?> </title>
</head>

<body>

<div style="float:left; width:675px;">
       
  <table width="650" border="0" cellspacing="0" cellpadding="3">
          <tr>
            <td width="516" rowspan="3" align="center" valign="middle"><b><label style="font-size:16px">
              </label>
            <img src="../images/letterhead_KC_Roofing.png" width="513" height="86"></b></td>
            <td width="122" align="right" valign="top"><label class="label_plain" style="font-size:16px;"><?php echo $type_header ?></label></td>
          </tr>
          <tr>
            <td align="right" valign="top"><label class="label_plain" style="font-size:10px;"><?php if ($type_header=='COPY') echo 'Print date: '.date("d-m-Y", strtotime($today)) ?></label></td>
          </tr>
          <tr>
            <td height="47" align="right" valign="top"><label class="label_plain" style="font-size:16px;">Del note:
            
              &nbsp;&nbsp;&nbsp;<?php echo $a3?></label>&nbsp;</td>
          </tr>
          </table>
          <table width="650" cellpadding="3">
          <tr>
            <td width="140" height="106" valign="top"  style="border-left:thin; border-left-style:solid; border-top:thin; border-top-style:solid; border-right:thin; border-right-style:solid; border-bottom:thin; border-bottom-style:solid;" >
              <label class="label_plain" style="font-size:10px">Date:</label>
              <label class="label_plain">
              <?php echo date("d-m-Y", strtotime($a7)); ?></label><br>
              <label class="label_plain" style="font-size:10px">Time:</label>
             <label class="label_plain"> <?php echo $a8; ?></label>
  &nbsp;<br>
  <br>
  <label class="label_plain" style="font-size:10px">Job no.:</label> <label class="label_plain"><?php if ($a1!='0') { echo "J".$a1; } ?></label>
            </td>
            <td width="22" valign="top" >&nbsp;</td>
            <td width="206" valign="top" style="border-left:thin; border-left-style:solid; border-top:thin; border-top-style:solid; border-right:thin; border-right-style:solid; border-bottom:thin; border-bottom-style:solid;" >
              <label class="label_plain" style="font-size:10px">Deliver to:</label>
               <br>
                <br>
                <label class="label_plain">
              &nbsp;&nbsp;<?php echo $a0 ?></label><br>
  &nbsp;&nbsp;              <label class="label_plain"><?php echo $a4 ?></label>
            </td>
            <td width="36" valign="top">&nbsp;</td>
            <td width="222" align="left" valign="top" style="border-left:thin; border-left-style:solid; border-top:thin; border-top-style:solid; border-right:thin; border-right-style:solid; border-bottom:thin; border-bottom-style:solid;">
              
                <label class="label_plain" style="font-size:10px">Received in good order and condition by:<br><br></label>

               <label class="label_plain">                 
              name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $a5 ?>
              <br><br>
              &nbsp;&nbsp;sign:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_ _ _ _ _ _ _ _ _ _ _
              </label>
              
            </td>
          </tr>
  </table>
        <br>

</div>

