<!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");	

$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']."_install_jobs";
$install_query = "SELECT * FROM $table_name WHERE job_card_no = '".$job_card_no."' ";
$install_result = mySQL_query($install_query);
$install_num = mysql_num_rows($install_result);
$install_date = mysql_result($install_result, 0, "install_date");
$confirmed = mysql_result($install_result, 0, "confirmed");
$forman = mysql_result($install_result, 0, "forman");
$site_contact = mysql_result($install_result, 0, "site_contact");
$site_no = mysql_result($install_result, 0, "site_no");
$route_description = mysql_result($install_result, 0, "route_description");
$vehicle_id = mysql_result($install_result, 0, "vehicle");

	$table_name2 = $_SESSION['db_prefix']."_employee";
	$employee_query = "SELECT emp_first_name, emp_last_name FROM $table_name2 WHERE emp_id ='".$forman."' ";
	$employee_result = mySQL_query($employee_query);
	$employee_num = mysql_num_rows($employee_result);	
$forman_name  = mysql_result($employee_result, 0, "emp_first_name").' '.mysql_result($employee_result, 0, "emp_last_name"); 

$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, "registration_no").' '.mysql_result($vehicle_result, 0, "make").' '.mysql_result($vehicle_result, 0, "model");

$table_name = $_SESSION['db_prefix']."_inspection_report";
$inspection_query = "SELECT *  FROM $table_name WHERE job_card_no = '".$job_card_no."' ";
$inspection_result = mySQL_query($inspection_query);
$inspected_by = mysql_result($inspection_result, 0, "inspected_by");
$inspection_date = mysql_result($inspection_result, 0, "inspection_date");
$job_approved = mysql_result($inspection_result, 0, "job_approved");
$agreed = mysql_result($inspection_result, 0, "agreed");
$completed = mysql_result($inspection_result, 0, "completed");
$cust_signed = mysql_result($inspection_result, 0, "cust_signed");
$filled = mysql_result($inspection_result, 0, "filled");
$job_approved = mysql_result($inspection_result, 0, "job_approved");


?>


<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css" />

<title>Manase inspection report for 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/print_header.php'); ?>
<div class="print_main_frame" style="height:auto;">
<br>
<br>

<div class="print_standard_frame">
      <table width="650" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="472"><label class="label_page_head">Inspection report:</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>
      </div><br>

<div class="print_standard_frame">
<?php 
		include ('../include/customer_block.php');
		echo '<br>';
		include ('../include/job_block.php')
		?>
<br>
</div>        
<div class="print_standard_frame">
     <table width="650" id="table_details_display">
  <tr>
    <td width="126">Install date:</td>
    <td width="217"><?php echo date("d-m-Y", strtotime($install_date)) ?>&nbsp;</td>
    <td width="110">Confirmed:</td>
    <td width="177"><?php echo $confirmed ?>&nbsp;</td>
  </tr>
  <tr>
    <td>Foreman:</td>
    <td><?php echo $forman_name ?>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Site contact:</td>
    <td><?php echo $site_contact ?>&nbsp;</td>
    <td>Site phone no:</td>
    <td><?php echo $site_no ?>&nbsp;</td>
  </tr>
  <tr>
    <td>Vehicle:</td>
    <td colspan="3"><?php echo $vehicle_name ?>&nbsp;</td>
    </tr>
  <tr>
    <td>Route description:</td>
    <td colspan="3"><?php echo $route_description ?></td>
    </tr>
    </table>
</div> 
<div class="print_standard_frame">
     <br>
    The job was
<table width="649" id="table_details_display">
      <tr>
    <td width="214"> carried out in the agreed period:</td>
    <td width="423"><?php echo $agreed ?></td>
  </tr>
  <tr>
    <td> completed in time:</td>
    <td><?php echo $completed ?></td>
  </tr>
  <tr>
    <td> signed for by customer:</td>
    <td><?php echo $cust_signed ?></td>
  </tr>
  <tr>
    <td> job card filled in completely:</td>
    <td><?php echo $filled ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
      </table>
        <br>

      <table width="649" id="table_details_display">
  <tr>
    <td width="265" valign="top">Job was inspected by:</td>
    <td width="372"><?php echo $inspected_by?>
      </td>
  </tr>
  <tr>
    <td valign="top">Inspection date:</td>
    <td><?php echo date("d-m-Y", strtotime($inspection_date))?></td>
  </tr>
        </table>
   <br>

    <table width="649" id="table_details_display">
  <tr>
    <td width="265">Job approved?</td>
    <td width="372"><?php echo $job_approved ?></td>
  </tr>
</table>
</div>
 
</div>       


</div>
</body>

</html>