<!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']."_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");
$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");


$table_name = $_SESSION['db_prefix']."_quotation_lines";
$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '0' ";
$line_result = mySQL_query($line_query);
$result0 = mysql_result($line_result, 0, "quote_item_price");
if ($result0!=0) {
$option0 = $result0;
}
else {
$option0 = '>----';
}


$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '1' ";
$line_result = mySQL_query($line_query);
$result1 = mysql_result($line_result, 0, "quote_item_price");
if ($result1!=0) {
$option1 = $result1;
}
else {
$option1 = '----';
}



$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '2' ";
$line_result = mySQL_query($line_query);
$result2 = mysql_result($line_result, 0, "quote_item_price");
if ($result2!=0) {
$option2 = $result2;
}
else {
$option2 = '----';
}


$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '3' ";
$line_result = mySQL_query($line_query);
$result3 = mysql_result($line_result, 0, "quote_item_price");
if ($result3!=0) {
$option3 = $result3;
}
else {
$option3 = '----';
}



$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '4' ";
$line_result = mySQL_query($line_query);
$result4 = mysql_result($line_result, 0, "quote_item_price");
if ($result4!=0) {
$option4 = $result4;
}
else {
$option4 = '----';
}



$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '5' ";
$line_result = mySQL_query($line_query);
$result5 = mysql_result($line_result, 0, "quote_item_price");
if ($result5!=0) {
$option5 = $result5;
}
else {
$option5 = '----';
}



$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '6' ";
$line_result = mySQL_query($line_query);
$result6 = mysql_result($line_result, 0, "quote_item_price");
if ($result6!=0) {
$option6 = $result6;
}
else {
$option6 = '----';
}



$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '7' ";
$line_result = mySQL_query($line_query);
$result7 = mysql_result($line_result, 0, "quote_item_price");
if ($result7!=0) {
$option7 = $result7;
}
else {
$option7 = '----';
}



$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '8' ";
$line_result = mySQL_query($line_query);
$result8 = mysql_result($line_result, 0, "quote_item_price");
if ($result8!=0) {
$option8 = $result8;
}
else {
$option8 = '----';
}



$line_query = "SELECT quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' AND quote_option = '9' ";
$line_result = mySQL_query($line_query);
$result9 = mysql_result($line_result, 0, "quote_item_price");
if ($result9!=0) {
$option9 = $result9;
}
else {
$option9 = '----';
}




$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:12px;
}
</style>
</head>
<body  onload="window.print(); window.close();" >
<!--<body  onload="window.print();" >-->

<div style="width:800px;">
<?php include('../include/print_header.php'); ?>


<div style="width:650px; margin-left:50px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:12px;"><br>

<?php 
echo $c1.'<br>';
if ($c3!='') { echo $c2.' '.$c3.'<br>'; }
if ($c4!='') { echo $c4; }
if ($c7!='') { echo '<br>email: '.$c7; }
?>
<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 'Q'.$quote_no?>
<br><br>

<b>Re: <?php echo $re_title ?></b>
<br><br>

Dear Sir / Madam,
<br><br>

Thank you for your enquiry. Herewith our quotation for the above requirements.<br>

<div style="position: relative;">
    <img src="../images/electric_fence.png" width="600" height="355";>
    <div style="position: absolute; top: 0px; left: 0px; height: 1px;">
       <table width="600" border="0">
  <tr>
    <td width="107" height="142" valign="bottom">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='white'><b>P <?php echo $option0 ?></b></font></td>
    <td width="93" valign="bottom">&nbsp;&nbsp;&nbsp;<font color='white'><b>P <?php echo $option1 ?></b></font></td>
    <td colspan="2" valign="bottom">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='white'><b>P <?php echo $option2 ?></b></font></td>
    <td width="94" valign="bottom">&nbsp;&nbsp;&nbsp;&nbsp;<font color='white'><b>P <?php echo $option3 ?></b></font></td>
    <td width="88" valign="bottom">&nbsp;</td>
  </tr>
  <tr>
    <td height="198" valign="bottom">&nbsp;&nbsp;&nbsp;<font color='white'><b>P <?php echo $option4 ?></b></font></td>
    <td valign="bottom"><font color='white'><b>P <?php echo $option5 ?></b></font></td>
    <td width="94" valign="bottom"><font color='white'><b>P <?php echo $option6 ?></b></font>></td>
    <td width="84" valign="bottom"><font color='white'"><b>P <?php echo $option7 ?></b></font>></td>
    <td valign="bottom"><font color='white'"><b>P <?php echo $option8 ?></b></font></td>
    <td valign="bottom"><font color='white'><b>P <?php echo $option9 ?></b></font></td>
  </tr>
</table>
</div>
<div>
<table width="600" border="0">
  <tr>
    <td width="434"><div style="width:450px; font-size:9px;">
      <b>SPECIFICATIONS</b><br>        
            The above will be attached to top of  wall and palisade fence.<br>
            The HAMMER analogue EZ630 will be  used to energize the fence (unless ACE 100 selected).<br>
            The energizer comes complete with  battery backup and an in-built alarm monitor &amp; multi tone siren and key  switch for operation.<br>
            The voltage on the fence will be  ±8000v (Stored energy 6 Joules); this operates on a pulsating basis &amp; is  therefore non-lethal.<br>
            All energizers are manufactured to  SABS IEC 1011 and carries a 12 month warranty*.<br>
            Installation will take approximately  2 days.<br>
            Full back up is always available  &amp; Manase offer a comprehensive after sale maintenance contract.<br>
<br>        
      <b>TERMS</b><br>          
            Prices <?php echo $vat ?> 12% VAT<br>
            Payment 
            <?php $terms ?>
            <br>
            Balance on completion<br>
            Client to supply dedicated 220v mains  power supply, if generator required P450/day<br>
            Prices valid <?php echo $valid_days ?> days<br>
            Delivery <?php echo $delivery_days ?> days </div></td>
    <td width="156" valign="top"><img src="../images/electric_fence_2.png" width="150" height="228"></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><img src="../images/electric_fence3.png" width="600" height="34"></td>
    </tr>
</table>

</div>
   
</div>
</div>

</body>
</html>