<head>

<!--reference to main.css removed--><link rel="stylesheet" type="text/css" href="../css/main.css" />

<?php
include ("../include/session.php");

$supply_id = $_GET['supply_id'];

?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


<?php
$br1=34;
$br2=35;

$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_name = $_SESSION['db_prefix']."_captured_jobs";
$job_query = "SELECT * FROM $table_name WHERE job_no = '".$a1."' ";
$job_result = mySQL_query($job_query);
$job_no = mysql_result($job_result, 0, "job_no");
$cust_id = mysql_result($job_result, 0, "cust_id");
$designer = mysql_result($job_result, 0, "designer");
$roof_cover = mysql_result($job_result, 0, "roof_cover");
$roof_pitch = mysql_result($job_result, 0, "roof_pitch");
$max_overhang = mysql_result($job_result, 0, "max_overhang");
$roof_area = mysql_result($job_result, 0, "roof_area");
$floor_area = mysql_result($job_result, 0, "floor_area");
$quote_note = mysql_result($job_result, 0, "quote_note");
$value = mysql_result($job_result, 0, "value");
$del_date = mysql_result($job_result, 0, "del_date");

$b9 = mysql_result($job_result, 0, "project_no");
$b10 = mysql_result($job_result, 0, "project_place");
$b11 = mysql_result($job_result, 0, "project_description");
$b12 = mysql_result($job_result, 0, "designer");
$b13 = mysql_result($job_result, 0, "value");
if ($del_date!='') {$b14 = date("d-m-Y", strtotime($del_date)); } else {$b14='';}


$table_name = $_SESSION['db_prefix']."_supply_customer_lines";
$trusses_query = "SELECT job_no, truss_type, timber_type, quantity, user FROM $table_name WHERE supply_id = '".$supply_id."' AND timber_type = 'Trusses' ";
$trusses_result = mySQL_query($trusses_query);
$trusses_num = mysql_num_rows($trusses_result);

$table_name = $_SESSION['db_prefix']."_supply_customer_lines";
$summary_query = "SELECT * FROM $table_name WHERE supply_id = '".$supply_id."' AND truss_type = 'bracing'  ";
$summary_result = mySQL_query($summary_query);
$summary_num = mysql_num_rows($summary_result);
//echo '<br>'.$summary_query;

$table_name = $_SESSION['db_prefix']."_supply_customer_lines";
$summary2_query = "SELECT * FROM $table_name WHERE supply_id = '".$supply_id."' AND truss_type = 'sundries'  ";
$summary2_result = mySQL_query($summary2_query);
$summary2_num = mysql_num_rows($summary2_result);
//echo '<br>'.$summary_query;


$table_name = $_SESSION['db_prefix']."_supply_customer_lines";
$mitek_query = "SELECT job_no, truss_type, store_item_id, timber_type, quantity, user FROM $table_name WHERE supply_id = '".$supply_id."' AND truss_type = 'Mitek'";
$mitek_result = mySQL_query($mitek_query);
$mitek_num = mysql_num_rows($mitek_result);

$table_name = $_SESSION['db_prefix']."_supply_customer_lines";
$additional_query = "SELECT job_no, truss_type, store_item_id, timber_type, quantity, user FROM $table_name WHERE supply_id = '".$supply_id."' AND truss_type = 'Additional' ";
$additional_result = mySQL_query($additional_query);
$additional_num = mysql_num_rows($additional_result);

$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);


?>

<title>KC ROOFING Delivery note <?php echo $a3?> </title>
</head>
<body   onload="window.print();" onFocus="window.close();">
<div style="page-break-after:always;">
<div style="float:left; width:675px;">
       
  <table width="650" border="0" cellspacing="0" cellpadding="3">
          <tr>
            <td rowspan="3" align="center" valign="middle"><img src="../images/letterhead_KC_Roofing.png" width="513" height="86"></td>
            <td width="163" align="right" valign="top"><label class="label_plain" style="font-size:16px;">CUSTOMER COPY</label></td>
          </tr>
          <tr>
            <td align="right" valign="top">&nbsp;</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 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 ?><br>
  &nbsp;&nbsp;              <?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">                 
              &nbsp;name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $a5 ?>
              <br><br>
              &nbsp;sign:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_ _ _ _ _ _ _ _ _ _ _
              </label>
              
            </td>
          </tr>
        </table>
</div>
    

<div style="float:left;"><br>
<?php $line_no=0; ?>
<?php if ($trusses_num!=0) { ?>
<table width="646" align="left" id="table_details_display_grey" > 
              <tr >
                <td width="456" align="left" valign="top"><b>
                  <label class="label_plain">Item</label>
                </b></td>
                <td width="77" align="left" valign="top">&nbsp;</td>
                <td width="97" align="left" valign="top"><label class="label_plain">Quantity</label></td>
              </tr>
</table>
</div>
<div style="float:left;">
  <table width="646" align="left" id="table_details_display" > 
              <tr style="border-bottom-style:double;">
                <td colspan="2" align="left" valign="top"><label class="label_plain">Trusses:</label><?php $line_no = $line_no+1?>></td>
              </tr>
              <?php 
				  $i=0;
				  
				  while ($i<$trusses_num) {
				  		$f1 = mysql_result($trusses_result, $i, "truss_type");
						$f2 = mysql_result($trusses_result, $i, "quantity"); 			
				 ?>
              <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>"  >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td colspan="2" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain" style="font-size:14px;">delivery note: <?php echo $a3 ?></label>
               <?php $line_no = $line_no+1?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="label_plain" style="font-size:10px">Continued from page 1</label></td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $f1; ?></td>
             <td width="92"><?php echo $f2; ?>
               no<?php $line_no = $line_no+1?>
               </td>
             <?php 
			 }
			 else { 
			 if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $f1; ?></td>
             <td width="92"><?php echo $f2; ?>
               no
			   
			   <?php 
				  }?>
               </td>
             <?php }
			 $line_no = $line_no+1;
			 if ($line_no==$br2) { $i=$i-1; };
			    ?>
             </tr>
            
              <?php
             
			  $i++;
             }
             ?>
               
  </table>
</div>
<?php }
 if ($summary_num!=0) { ?>
<div style="float:left;">
<br>

  <table width="646" align="left" id="table_details_display" >
    <tr>
      <td colspan="3" align="left" valign="top" ><label class="label_plain">Bracing timber:</label><?php $line_no = $line_no+1?></td>
    </tr>
    <?php 
				  $k=0;
				  $temp_name='';
				  while ($k<$summary_num) { 
					    
					    $c1 = mysql_result($summary_result, $k, "timber_type");
						$c2 = mysql_result($summary_result, $k, "store_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT length FROM $table_name WHERE  store_item_id = '".$c2."' ";
							$name_result = mySQL_query($name_query);
							$c2a = mysql_result($name_result, 0, "length");
						$c3 = mysql_result($summary_result, $k, "tot_length"); 
						$c4 = mysql_result($summary_result, $k, "quantity");  
						 
						
				 ?>
    <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>" >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td width="456" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain">delivery note: <?php echo $a3 ?></label>
               <br>
               <br>
               <?php $line_no = $line_no+1?><br></td>
             <td style="border-right:hidden;">continued from page 1</td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $c1 ?></td>
             <td width="92"><?php echo $c4; ?>
               <?php $line_no = $line_no+1?>
              </td>
             <?php 
			 }
			 else { 
              if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label><?php $line_no = $line_no+1; ?> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $c1; ?></td>
             <td width="92"><?php echo $c4; ?>
               no
			   
			   <?php $line_no = $line_no+1;
				  }?>
               </td>
             <?php }
			    ?>
             </tr>
    <?php
			  $k++;
             }
             ?>
  </table>
</div>
<?php }
 if ($summary2_num!=0) { ?>
<div style="float:left;"><br>

 <table width="646" align="left" id="table_details_display" >
   <tr>
     <td colspan="3" align="left" valign="top"><label class="label_plain">Sundries timber:</label><?php $line_no = $line_no+1?>
       </td>
   </tr>
   <?php 
				  $k=0;
				  $temp_name='';
				  while ($k<$summary2_num) { 
					    $c1 = mysql_result($summary2_result, $k, "timber_type");
						$c2 = mysql_result($summary2_result, $k, "store_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT length FROM $table_name WHERE  store_item_id = '".$c2."' ";
							$name_result = mySQL_query($name_query);
							$c2a = mysql_result($name_result, 0, "length");
						$c3 = mysql_result($summary2_result, $k, "tot_length"); 
						$c4 = mysql_result($summary2_result, $k, "quantity");  
						
				 ?>
   <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>"  >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td width="456" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain">delivery note: <?php echo $a3 ?></label>
               <br>
               <br>
               <?php $line_no = $line_no+1?><br></td>
             <td style="border-right:hidden;">continued from page 1</td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $c2a ?></td>
             <td width="92"><?php echo $c4; ?>
               <?php $line_no = $line_no+1?>
               </td>
             <?php 
			 }
			 else { 
              if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label><?php $line_no = $line_no+1; ?> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $c2a; ?></td>
             <td width="92"><?php echo $c4; ?>
               no
			  
			   <?php $line_no = $line_no+1;
				  }?>
               </td>
             <?php }
			    ?>
             </tr>
   <?php
			  $k++;
             }
             ?>
 </table>
</div>
<?php }
if ($mitek_num!=0) { ?>
<div style="float:left;"><br>

    <table width="646" align="left" id="table_details_display" > 
              <tr style="border-bottom-style:double;">
                <td colspan="2" align="left" valign="top"><label class="label_plain">Mitek products:</label><?php $line_no = $line_no+1?>
               </td>
              </tr>
               <?php 
				  $j=0;
				  while ($j<$mitek_num) { 
					    $e1 = mysql_result($mitek_result, $j, "timber_type");
						$e2 = mysql_result($mitek_result, $j, "store_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT item_name, unit FROM $table_name WHERE  store_item_id = '".$e2."' ";
							$name_result = mySQL_query($name_query);
							$e2a = mysql_result($name_result, 0, "item_name");
							$e4 = mysql_result($name_result, 0, "unit");
						$e3 = mysql_result($mitek_result, $j, "quantity");  
						
				 ?>
             <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>"   >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td width="456" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain">delivery note: <?php echo $a3 ?></label>
               <br>
               <br>
               <?php $line_no = $line_no+1?><br></td>
             <td style="border-right:hidden;">continued from page 1</td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $e2a ?></td>
             <td width="92"><?php echo $e3.'&nbsp;&nbsp;'.$e4; ?>
               <?php $line_no = $line_no+1?>
               </td>
             <?php 
			 }
			 else { 
			  if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label><?php $line_no = $line_no+1; ?> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $e2a; ?></td>
             <td width="92"><?php echo $e3.'&nbsp;&nbsp;'.$e4; ?>
               <?php $line_no = $line_no+1;
				  }?>
               </td>
             <?php }
			    ?>
             </tr>
              <?php
				
			  $j++;
             }
             ?>
  </table></div>
<?php }
 if ($additional_num!=0) { ?>  
    
  <div style="float:left;"><br>

 <table width="646" align="left" id="table_details_display" > 
              <tr style="border-bottom-style:double; ">
                <td colspan="2" align="left" valign="top"><label class="label_plain">Additional sundries:</label></td>
              </tr>
               <?php 
				  $n=0;
				  while ($n<$additional_num) { 
					    $g1 = mysql_result($additional_result, $n, "timber_type");
						$g2 = mysql_result($additional_result, $n, "store_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT item_name, unit FROM $table_name WHERE  store_item_id = '".$g2."' ";
							$name_result = mySQL_query($name_query);
							$g2a = mysql_result($name_result, 0, "item_name");
							$g4 = mysql_result($name_result, 0, "unit");
						$g3 = mysql_result($additional_result, $n, "quantity");  
						
				 ?>
                 
             <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>"   >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td width="456" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain">delivery note: <?php echo $a3 ?></label>
               <br>
               <br>
               <?php $line_no = $line_no+1?><br></td>
             <td style="border-right:hidden;">continued from page 1</td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $g2a ?></td>
             <td width="92"><?php echo $g3.'&nbsp;&nbsp;'.$g4; ?>
               <?php $line_no = $line_no+1?>
              </td>
             <?php 
			 }
			 else { 
			  if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label><?php $line_no = $line_no+1; ?> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $g2a; ?></td>
             <td width="92"><?php echo $g3.'&nbsp;&nbsp;'.$g4; ?>
               <?php $line_no = $line_no+1;
				  }?>
               </td>
             <?php }
			    ?>
             </tr>
              <?php
				
			  $n++;
             }
             ?>
    </table>
</div>
          <?php } ?>
              
<div style="float:left; width:650px;"><br>

  <table id="table_details_display" style="page-break-inside:avoid;" >
  <tr>
  <td width="296"><p>Security check:</p>
    <p>Signature/stamp:</p>
  </td>
  <td width="342"><p>KC Roofing check:</p>
    <p>Signature/stamp:</p>
  </td><br>
</tr>
<?php if ($line_no==33) { ?>
<tr>
<td>&nbsp;

</td>
<td align="right">
Continue on page 2.
</td>
</tr>
<?php } ?>
</table><br>
<table id="table_details_display" style="page-break-inside:avoid; page-break-after:always;">
  <tr>
    <td width="296" rowspan="2" valign="top"><p>Received in good order and condition:</p>
      <p>Name:</p>
      <p>Sign:</p>
      <p>Date:</p></td>
    <td width="342" height="75" valign="top"><label class="label_plain">Remarks:</label>
      <p>&nbsp;</p></td>
  </tr>
  <tr>
    <td valign="bottom"><b>Important: </b>No claim of any nature will be considered unless rendered within 24 hours of receipt. All sales subject to our general conditions, available on request.</td>
  </tr>
  </table>
</div>
<br />

 
      </td>
           
    </tr>
  </table>

 <!--end of tableMain-->
<br>
<br>  
</div>



</div><br>

</div>


<div style="page-break-after:always;">
<div style="float:left; width:675px;">
       
  <table width="650" border="0" cellspacing="0" cellpadding="3">
          <tr>
            <td rowspan="3" align="center" valign="middle"><b><img src="../images/letterhead_KC_Roofing.png" width="513" height="86">
            <label style="font-size:16px"></b>
            </td>
            <td width="143" align="right" valign="top"><label class="label_plain" style="font-size:16px;">DRIVERS COPY</label></td>
          </tr>
          <tr>
            <td align="right" valign="top">&nbsp;</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 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 ?><br>
  &nbsp;&nbsp;              <?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">                 
              &nbsp;name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $a5 ?>
              <br><br>
              &nbsp;sign:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_ _ _ _ _ _ _ _ _ _ _
              </label>
              
            </td>
          </tr>
        </table>
</div>
    

<div style="float:left;"><br>
<?php $line_no=0; ?>
<?php if ($trusses_num!=0) { ?>
<table width="646" align="left" id="table_details_display_grey" > 
              <tr >
                <td width="456" align="left" valign="top"><b>
                  <label class="label_plain">Item</label>
                </b></td>
                <td width="77" align="left" valign="top">&nbsp;</td>
                <td width="97" align="left" valign="top"><label class="label_plain">Quantity</label></td>
              </tr>
</table>
</div>
<div style="float:left;">
  <table width="646" align="left" id="table_details_display" > 
              <tr style="border-bottom-style:double;">
                <td colspan="2" align="left" valign="top"><label class="label_plain">Trusses:</label><?php $line_no = $line_no+1?>></td>
              </tr>
              <?php 
				  $i=0;
				  
				  while ($i<$trusses_num) {
				  		$f1 = mysql_result($trusses_result, $i, "truss_type");
						$f2 = mysql_result($trusses_result, $i, "quantity"); 			
				 ?>
              <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>"  >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td colspan="2" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain" style="font-size:14px;">delivery note: <?php echo $a3 ?></label>
               <?php $line_no = $line_no+1?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="label_plain" style="font-size:10px">Continued from page 1</label></td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $f1; ?></td>
             <td width="92"><?php echo $f2; ?>
               no<?php $line_no = $line_no+1?>
               </td>
             <?php 
			 }
			 else { 
			 if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $f1; ?></td>
             <td width="92"><?php echo $f2; ?>
               no
			   
			   <?php 
				  }?>
               </td>
             <?php }
			 $line_no = $line_no+1;
			 if ($line_no==$br2) { $i=$i-1; };
			    ?>
             </tr>
            
              <?php
             
			  $i++;
             }
             ?>
               
  </table>
</div>
<?php }
 if ($summary_num!=0) { ?>
<div style="float:left;">
<br>

  <table width="646" align="left" id="table_details_display" >
    <tr>
      <td colspan="3" align="left" valign="top" ><label class="label_plain">Bracing timber:</label><?php $line_no = $line_no+1?></td>
    </tr>
    <?php 
				  $k=0;
				  $temp_name='';
				  while ($k<$summary_num) { 
					    $c1 = mysql_result($summary_result, $k, "timber_type");
						$c2 = mysql_result($summary_result, $k, "store_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT length FROM $table_name WHERE  store_item_id = '".$c2."' ";
							$name_result = mySQL_query($name_query);
							$c2a = mysql_result($name_result, 0, "length");
						$c3 = mysql_result($summary_result, $k, "tot_length"); 
						$c4 = mysql_result($summary_result, $k, "quantity");  
						
				 ?>
    <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>" >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td width="456" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain">delivery note: <?php echo $a3 ?></label>
               <br>
               <br>
               <?php $line_no = $line_no+1?><br></td>
             <td style="border-right:hidden;">continued from page 1</td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $c2a ?><</td>
             <td width="92"><?php echo $c4; ?>
               <?php $line_no = $line_no+1?>
              </td>
             <?php 
			 }
			 else { 
              if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label><?php $line_no = $line_no+1; ?> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $c2a; ?></td>
             <td width="92"><?php echo $c4; ?>
               no
			   
			   <?php $line_no = $line_no+1;
				  }?>
               </td>
             <?php }
			    ?>
             </tr>
    <?php
			  $k++;
             }
             ?>
  </table>
</div>
<?php }
 if ($summary2_num!=0) { ?>
<div style="float:left;"><br>

 <table width="646" align="left" id="table_details_display" >
   <tr>
     <td colspan="3" align="left" valign="top"><label class="label_plain">Sundries timber:</label><?php $line_no = $line_no+1?>
       </td>
   </tr>
   <?php 
				  $k=0;
				  $temp_name='';
				  while ($k<$summary2_num) { 
					    $c1 = mysql_result($summary2_result, $k, "timber_type");
						$c2 = mysql_result($summary2_result, $k, "store_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT length FROM $table_name WHERE  store_item_id = '".$c2."' ";
							$name_result = mySQL_query($name_query);
							$c2a = mysql_result($name_result, 0, "length");
						$c3 = mysql_result($summary2_result, $k, "tot_length"); 
						$c4 = mysql_result($summary2_result, $k, "quantity");  
						
				 ?>
   <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>"  >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td width="456" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain">delivery note: <?php echo $a3 ?></label>
               <br>
               <br>
               <?php $line_no = $line_no+1?><br></td>
             <td style="border-right:hidden;">continued from page 1</td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $c2a ?></td>
             <td width="92"><?php echo $c4; ?>
               <?php $line_no = $line_no+1?>
               </td>
             <?php 
			 }
			 else { 
              if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label><?php $line_no = $line_no+1; ?> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $c2a; ?></td>
             <td width="92"><?php echo $c4; ?>
               no
			  
			   <?php $line_no = $line_no+1;
				  }?>
               </td>
             <?php }
			    ?>
             </tr>
   <?php
			  $k++;
             }
             ?>
 </table>
</div>
<?php }
if ($mitek_num!=0) { ?>
<div style="float:left;"><br>

    <table width="646" align="left" id="table_details_display" > 
              <tr style="border-bottom-style:double;">
                <td colspan="2" align="left" valign="top"><label class="label_plain">Mitek products:</label><?php $line_no = $line_no+1?>
               </td>
              </tr>
               <?php 
				  $j=0;
				  while ($j<$mitek_num) { 
					    $e1 = mysql_result($mitek_result, $j, "timber_type");
						$e2 = mysql_result($mitek_result, $j, "store_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT item_name, unit FROM $table_name WHERE  store_item_id = '".$e2."' ";
							$name_result = mySQL_query($name_query);
							$e2a = mysql_result($name_result, 0, "item_name");
							$e4 = mysql_result($name_result, 0, "unit");
						$e3 = mysql_result($mitek_result, $j, "quantity");  
						
				 ?>
             <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>"   >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td width="456" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain">delivery note: <?php echo $a3 ?></label>
               <br>
               <br>
               <?php $line_no = $line_no+1?><br></td>
             <td style="border-right:hidden;">continued from page 1</td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $e2a ?></td>
             <td width="92"><?php echo $e3.'&nbsp;&nbsp;'.$e4; ?>
               <?php $line_no = $line_no+1?>
               </td>
             <?php 
			 }
			 else { 
			  if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label><?php $line_no = $line_no+1; ?> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $e2a; ?></td>
             <td width="92"><?php echo $e3.'&nbsp;&nbsp;'.$e4; ?>
               <?php $line_no = $line_no+1;
				  }?>
               </td>
             <?php }
			    ?>
             </tr>
              <?php
				
			  $j++;
             }
             ?>
  </table></div>
<?php }
 if ($additional_num!=0) { ?>  
    
  <div style="float:left;"><br>

 <table width="646" align="left" id="table_details_display" > 
              <tr style="border-bottom-style:double; ">
                <td colspan="2" align="left" valign="top"><label class="label_plain">Additional sundries:</label></td>
              </tr>
               <?php 
				  $n=0;
				  while ($n<$additional_num) { 
					    $g1 = mysql_result($additional_result, $n, "timber_type");
						$g2 = mysql_result($additional_result, $n, "store_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT item_name, unit FROM $table_name WHERE  store_item_id = '".$g2."' ";
							$name_result = mySQL_query($name_query);
							$g2a = mysql_result($name_result, 0, "item_name");
							$g4 = mysql_result($name_result, 0, "unit");
						$g3 = mysql_result($additional_result, $n, "quantity");  
						
				 ?>
                 
             <tr style=" <?php if ($line_no==$br1) { ?> page-break-after:always;<?php }?>"   >
             <?php
			  
			 if ($line_no==$br2) { ?>
             <td width="456" style="border-left:hidden; border-right:hidden;"><br>
               <br>
               <img src="../images/logo_small_KC_Roofing.png" alt="" width="110" height="31">               &nbsp;&nbsp;<label class="label_plain">delivery note: <?php echo $a3 ?></label>
               <br>
               <br>
               <?php $line_no = $line_no+1?><br></td>
             <td style="border-right:hidden;">continued from page 1</td>
             </tr>
             <tr> 
             <td width="456" ><?php echo $g2a ?></td>
             <td width="92"><?php echo $g3.'&nbsp;&nbsp;'.$g4; ?>
               <?php $line_no = $line_no+1?>
              </td>
             <?php 
			 }
			 else { 
			  if ($line_no==$br1) {
				 ?>
                 <td colspan="2" align="right" style="border-bottom:hidden; border-left:hidden; border-right:hidden;">
				  <label class="label_plain" style="font-size:10px;">Continued on page 2</label><?php $line_no = $line_no+1; ?> </td>
                  <?php
			 }
			 else
				  { ?>
             <td width="456" ><?php echo $g2a; ?></td>
             <td width="92"><?php echo $g3.'&nbsp;&nbsp;'.$g4; ?>
               <?php $line_no = $line_no+1;
				  }?>
               </td>
             <?php }
			    ?>
             </tr>
              <?php
				
			  $n++;
             }
             ?>
    </table>
</div>
          <?php } ?>
              
<div style="float:left; width:650px;"><br>

  <table id="table_details_display" style="page-break-inside:avoid;" >
  <tr>
  <td width="296"><p>Security check:</p>
    <p>Signature/stamp:</p>
  </td>
  <td width="342"><p>KC Roofing check:</p>
    <p>Signature/stamp:</p>
  </td><br>
</tr>
<?php if ($line_no==33) { ?>
<tr>
<td>&nbsp;

</td>
<td align="right">
Continue on page 2.
</td>
</tr>
<?php } ?>
</table><br>
<table id="table_details_display" style="page-break-inside:avoid; page-break-after:always;">
  <tr>
    <td width="296" rowspan="2" valign="top"><p>Received in good order and condition:</p>
      <p>Name:</p>
      <p>Sign:</p>
      <p>Date:</p></td>
    <td width="342" height="75" valign="top"><label class="label_plain">Remarks:</label>
      <p>&nbsp;</p></td>
  </tr>
  <tr>
    <td valign="bottom"><b>Important: </b>No claim of any nature will be considered unless rendered within 24 hours of receipt. All sales subject to our general conditions, available on request.</td>
  </tr>
  </table>
</div>
<br />

 
      </td>
           
    </tr>
  </table>

 <!--end of tableMain-->
<br>
<br>  
</div>



</div><br>

</div>
</body>

</html>