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

<head>

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

$quote_no = $_GET['quote_no'];



$table_name2 = $_SESSION['db_prefix']."_maintenance_quotations";
$quote_query = "SELECT * FROM $table_name2 WHERE quote_no ='".$quote_no."' ";
$quote_result = mySQL_query($quote_query);
$quote_num = mysql_num_rows($quote_result);
$cust_id  = mysql_result($quote_result, 0, "cust_id");
$quotation_date  = mysql_result($quote_result, 0, "quotation_date");
$project  = mysql_result($quote_result, 0, "project");
//$job_card_no  = mysql_result($quote_result, 0, "job_card_no");
$valid_days   = mysql_result($quote_result, 0, "valid_days");
$delivery_days   = mysql_result($quote_result, 0, "delivery_days");
$terms   = mysql_result($quote_result, 0, "terms");
$vat   = mysql_result($quote_result, 0, "vat_text");
$re_title   = mysql_result($quote_result, 0, "re_title");
$sales_rep =  mysql_result($quote_result, 0, "seller");


$table_name = $_SESSION['db_prefix']."_maintenance_quotation_lines";
$line2_query = "SELECT quote_option_text, quote_item_text, quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' ";
$line2_result = mySQL_query($line2_query);
$line2_num = mysql_num_rows($line2_result);
$re_text = mysql_result($line2_result, 0, "quote_option_text");


$table_name = $_SESSION['db_prefix']."_maintenance_quotation_lines";
$line2_query = "SELECT quote_item_price  FROM $table_name WHERE quote_item_text = 'Year rate (11 months)' AND quote_number = '".$quote_no."' ";
$line2_result = mySQL_query($line2_query);
$line2_num = mysql_num_rows($line2_result);
$year_text = mysql_result($line2_result, 0, "quote_item_price");




$table_name3 = $_SESSION['db_prefix']."_customer";
$customer_query = "SELECT account_type, comp_name, name_2, title, bag_box, box_no, postal_place, phone, contact_1, email_1, cell_1, status FROM $table_name3 WHERE cust_id = '".$cust_id."' ";
$customer_result = mySQL_query($customer_query);
$c0 = mysql_result($customer_result, 0, "account_type");
if ($c0=="corporate") { $c1 = mysql_result($customer_result, 0, "comp_name"); } else { $c1 = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name"); }

$c2 = mysql_result($customer_result, 0, "bag_box");
$c3 = mysql_result($customer_result, 0, "box_no");
$c4 = mysql_result($customer_result, 0, "postal_place");
$c5 = mysql_result($customer_result, 0, "phone");
$c6 = mysql_result($customer_result, 0, "contact_1");
$c7 = mysql_result($customer_result, 0, "email_1");
$c8 = mysql_result($customer_result, 0, "status");
$c9 = mysql_result($customer_result, 0, "cell_1");

?>

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

<title>Quotation <?php echo $quote_no ?> for <?php echo $c1 ?></title>
<style>
body {
	font-family:Arial, Helvetica, sans-serif;
	font-size:14px;
}
</style>
</head>
<body  onload="window.print(); window.close();" >
<div style="width:800px;">
<?php include('../include/print_header.php'); ?>


<div style="width:650px; margin-left:50px; font-family:'Arial, Helvetica, sans-serif; font-size:14px;">
  <p><br>
  <br>
  <?php 
echo $c1.'<br>';
echo $c2.' '.$c3.'<br>';
echo $c4;
?>
  <br>
  <br>
  <br>
    
    Date: <?php echo date("d-m-Y", strtotime($quotation_date)); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ref: <?php echo 'M'.$quote_no?>
  <br>
  <br>
  <br>
  <b><u>Re: <?php echo $re_text; ?></u></b>
  <br>
  <br>
  <br>
    Dear Sir/Madam,
  <br>
  <br>
   <table width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="23" colspan="3">Our standard maintenance consits of the following: </td>
    </tr>
  <tr>
    <td width="93" height="120">&nbsp;</td>
    <td height="120" colspan="2">&#8226; Checking all insulators & replacing if necessary.<br>
      &#8226; Wires re-strained and tension where necessary.<br>
      &#8226; Cutting back of any obstructing branches or bushes, plant growth.<br>
      &#8226; Testing system and ensuring everything is in order.<br>
      &#8226; Testing alarm and checking voltage.<br>
      &#8226; Checking fuse and plug wiring.</td>
    </tr>
  <tr>
    <td height="30" colspan="3">Should major works be required, a separate quote will be forwarded to you. </td>
    </tr>
  <tr>
    <td height="30" colspan="2"><b>&nbsp;&nbsp;&nbsp;Year rate (you pay 11 months): P <?php echo number_format($year_text, 2, '.', ',') ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
    <td width="147" height="30"><b>&nbsp;</b></td>
    </tr>
  <tr>
    <td height="40" colspan="3">All prices incl VAT, pay terms: 1 year in advance. </td>
  </tr>
  <tr>
    <td height="50" colspan="3">For acceptance, please sign and return for invoicing.</td>
    </tr>
  <tr>
    <td colspan="3">Signed:  ..............................  Date:  ..... - ..... - ......... <br>
      <br>
      <br>
      <br>
THANK YOU <br>
Manase Maintenance <br>
<br>
<br>
<?php echo $sales_rep ?></td>
    </tr>
</table>
</div>
</div>

</body>
</html>