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

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

$job_card_no = $_GET['job_card_no'];
$quote='no';
$table_name = $_SESSION['db_prefix']."_compiled_jobs";
$job_query = "SELECT * FROM $table_name WHERE job_card_no = '".$job_card_no."' ";
$job_result = mySQL_query($job_query);
$cust_id = mysql_result($job_result, 0, "cust_id");	
$mworks = mysql_result($job_result, 0, "mworks");	

$table_name2 = $_SESSION['db_prefix']."_customer";
		$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
		$customer_result = mySQL_query($customer_query);
		$customer_num = mysql_num_rows($customer_result);	
		$a1 = mysql_result($customer_result, 0, "account_type");
			if ($a1=="corporate") { 
				$name = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$name = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}

$table_name = $_SESSION['db_prefix']."_mworks_delivered";
$delivered_query = "SELECT * FROM $table_name WHERE job_card_no = '".$job_card_no."'  ";
$delivered_result = mySQL_query($delivered_query);
$delivered_num = mysql_num_rows($delivered_result);
$m_delivered_id = mysql_result($delivered_result, 0, "m_delivered_id");
$vehicle_id = mysql_result($delivered_result, 0, "vehicle_id");

$table_name = $_SESSION['db_prefix']."_mworks_delivered_lines";
$delivered_lines_query = "SELECT * FROM $table_name WHERE m_delivered_id = '".$m_delivered_id."'  ";
$delivered_lines_result = mySQL_query($delivered_lines_query);
$delivered_lines_num = mysql_num_rows($delivered_lines_result);

if ($mworks=='only') {
$table_name = $_SESSION['db_prefix']."_vehicle";
$vehicle_query = "SELECT  registration_no, make, model FROM $table_name WHERE vehicle_id = '".$vehicle_id."' ";
$vehicle_result = mySQL_query($vehicle_query);
$vehicle_name = mysql_result($vehicle_result, 0, "make").' '.mysql_result($vehicle_result, 0, "model");
$vehicle_reg = mysql_result($vehicle_result, 0, "registration_no");
}
?>
<title>Manase job card <?php echo $job_card_no ?></title>
<link rel="shortcut icon" type="image/x-icon" href="../images/favicon.ico">

<style>
body {
	font-family:Arial, Helvetica, sans-serif;
	font-size:12px;
}
</style>
</head>

<body  onload="window.print(); window.close();" >
<?php include('../include/m_print_header.php'); ?>
<div class="print_main_frame" style="height:auto;"><br>
<br>
<div class="print_standard_frame"> 
<table width="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="472"><label class="label_page_head">Delivery note:</label>
              &nbsp;&nbsp;&nbsp;<label class="label_page_head_2">&nbsp;&nbsp;&nbsp; <?php echo $name ?></label></td>
            <td width="208">Job card no.:<label style="font-size:24px; color:#209949;"><?php echo $job_card_no ?></label></td>
    </tr>
  </table>
<br>
<br>

<?php 
		include ('../include/customer_block.php');
		echo '<br>';
		include ('../include/job_block.php')
		?>
<br>
<br>
<table width="652" id="table_details_display">
  <tr>
    <td width="469">Component</td>
    <td width="171">Quantity</td>
  </tr>
  <?php
  $i=0;
  while ($i<$delivered_lines_num) {
	  $component = mysql_result($delivered_lines_result, $i, "component");
	  $delivered_qty = mysql_result($delivered_lines_result, $i, "delivered_qty");
  ?>
  <tr>
    <td><?php echo $component ?></td>
    <td align="center"><?php echo $delivered_qty ?></td>
  </tr>
  <?php
  $i++;
  }
  ?>
</table>
<br>
<br>
<?php
if ($mworks=='only') {
	?>
<table width="650" id="table_details_display">
  <tr>
    <td colspan="4">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="4">Undersigned accepts in good order the above mentioned goods:</td>
    </tr>
  <tr>
    <td width="128" height="30">Customer Name:</td>
    <td width="196">&nbsp;</td>
    <td width="96">Date:</td>
    <td width="210">&nbsp;</td>
  </tr>
  <tr>
    <td height="30">Csutomer signature:</td>
    <td>&nbsp;</td>
    <td>Vehicle:</td>
    <td><?php echo $vehicle_name ?>&nbsp;</td>
  </tr>
  <tr>
    <td height="30">Driver signature:</td>
    <td>&nbsp;</td>
    <td>Registration no:</td>
    <td><?php echo $vehicle_reg ?>&nbsp;</td>
  </tr>
</table>
<?php 
}
?>

 


        
</div>
  
</div>


</html>