<!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");
$re_title   = mysql_result($quote_result, 0, "re_title");


$table_name = $_SESSION['db_prefix']."_quotation_lines";
$line_query = "SELECT quote_item_text, quote_item_price  FROM $table_name WHERE quote_number = '".$quote_no."' ";
$line_result = mySQL_query($line_query);
$line_num = mysql_num_rows($line_result);


$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>
</head>
<body   onload="window.print();" onFocus="window.close();">
<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>
<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 'Q'.$quote_no?>
<br>
<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>
<br>


<table width="512" border="0">
<?php 
$i=0;
while ($i<$line_num) {
	$quote_item_text = mysql_result($line_result, $i, "quote_item_text");
	$quote_item_price = mysql_result($line_result, $i, "quote_item_price");
	?>
  <tr>
    <td width="104">&nbsp;&nbsp;&nbsp;</td>
    <td width="266"><?php echo $quote_item_text?>&nbsp;</td>
    <td width="128" align="right">P <?php echo $quote_item_price?></td>
  </tr>
  <?php
  $i++;
}
?>
</table>
<br>
<br>


<u>Terms</u>
Payment: <?php $terms ?>.<br>
Delivery: <?php echo $delivery_days ?> days.<br>
Price valid for: <?php echo $valid_days ?> days.<br>
<b>Price ex VAT .<br>
<br>
<br>
Yours faithfully


  

</div>
</div>

</body>
</html>