<?php include('open_connection.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="css/gridtable.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
function printPage() {
if(document.all) {
document.all.divButtons.style.visibility = 'hidden';
window.print();
document.all.divButtons.style.visibility = 'visible';
} else {
document.getElementById('divButtons').style.visibility = 'hidden';
window.print();
document.getElementById('divButtons').style.visibility = 'visible';
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Quotation Display</title>
</head>
<?php
$username=$_SESSION['username'];
//echo 'Welcome: '.$username;
?>
 <?php
                    $userid=mysql_query("select * from tbl_dir_user where user_name='$username'")or die(mysql_errno());
                    $row2=mysql_fetch_array($userid);
                    $user_id=$row2['user_id'];
					
                ?>
<?php
       $quotation_id = $_GET['quotation_id'];
						//echo $quotation_id;?>
						
		<?php  $quotation= "SELECT * FROM tbl_dir_fnb_quotation left join tbl_dir_fnb_customer
		                    ON tbl_dir_fnb_quotation.cust_id=tbl_dir_fnb_customer.cust_id
		                    WHERE tbl_dir_fnb_quotation.quotation_id ='$quotation_id'";
				
																		
				$result= mysql_query($quotation);
				// $row = mysql_fetch_array($result, MYSQL_ASSOC);			
				$row=mysql_fetch_array($result);
			    $cust_id=$row['cust_id'];
				$quotation_remarks=$row['quotation_remarks'];
			?>
			
<body>
<div align="center">
  <table width="861" class="gridtable">
    <tr>
      <td colspan="9" ><img src="images/picc.png" width="187" height="163" /></td>
    </tr>
    <tr>
      <td width="170">Attention to</td>
      <td width="294">:<?php echo $row['cust_name']?></td>
      
      <td width="168">Date</td>
      <td width="209">:<?php echo $row['quotation_date_from']; ?> <strong>to</strong> <?php echo $row['quotation_date_to']; ?></td>
    </tr>
    <tr>
      <td>Name</td>
      <td>:<?php echo $row['cust_position']?></td>
      <td>Quotation</td>
      <td>:Cafe@picc/<?php echo date("Y"); ?>/<?php echo date("m"); ?>/
      <label><strong><?php echo $quotation_id?></strong></label></td>
    </tr>
    <tr>
      <td>Position</td>
      <td>:<?php echo $row['cust_company']?></td>
      <td>Customer ID </td>
      <td>:<?php echo $row['cust_id']?></td>
    </tr>
    <tr>
      <td>Address</td>
      <td>:<?php echo $row['cust_address1'].",".  $row['cust_address2']?></td>
      <td colspan="2" rowspan="6"><p align="center"><strong>OFFICIAL RECEIPT </strong></p>
        <p></p></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>:<?php echo $row['cust_address3'].",".$row['cust_address4']?></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>:<?php echo $row['cust_postcode'] .",". $row['cust_city']?></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>:<?php echo $row['cust_state']?></td>
    </tr>
    <tr>
      <td>Contact No </td>
      <td>:<?php echo $row['cust_contact']?></td>
    </tr>
    <tr>
      <td>Email</td>
      <td>:<?php echo $row['cust_email']?></td>
    </tr>
    <tr>
      <td colspan="4"><?php

			$rowsPerPage =10; 
				$pageNum = $_REQUEST['page']; 
				if(empty($pageNum))
						{
					$offset =0;
					$pageNum=1;
						}
				else
						{
					$offset = ($pageNum - 1) * $rowsPerPage;
						}	
					$result3=mysql_query("SELECT * from tbl_dir_fnb_quotation left join tbl_dir_user 
on tbl_dir_fnb_quotation.user_id=tbl_dir_user.user_id  WHERE tbl_dir_fnb_quotation.quotation_id='$quotation_id'   LIMIT $offset, $rowsPerPage");
			  
			
		            $i=$offset;
					echo "<center><table border=1 width=100%  align=center class=gridtable >";
					echo"<tr><th  width=100>No</th><th  width=600>Desciption</th><th width=100>Reference No</th>
						<th  width=100>Amount</th></tr>";
					$sum=0;	
					while(@$row3=mysql_fetch_array($result3))
						{
				        $quotation_id = $row3['quotation_id']; 
			    $user_salutation = $row3['user_salutation'];
			      $user_fullname = $row3['user_fullname'];
			   $designation_name = $row3['designation_name'];
		 	     $quotation_desc = $row3['quotation_desc'];
		       $quotation_amount = $row3['quotation_amount'];
		       $y=date("Y");
			   $m=date("m");
			   
			   //echo $y,$m;
				
			 	 
			$i++;
					echo"<tr>";
					echo "<td align= center >".$i."</td>";
					echo "<td align=center width=600>".$row3['quotation_desc']."</td>";
					echo "<td align=center width=100>"."Cafe@picc/$y/$m/<label><strong>
					       </label>".$row3['quotation_id']."</strong></td>";
					echo "<td align=center width=100>".$row3['quotation_amount']."</td>";
					echo "</tr>";	
				}	
				
				
					echo "</table>";
					
					
 ?></td>
    </tr>
    <!--tr>
      <td height="119" colspan="4"><p>Prepared  by:</p>
        <h3><?php echo $user_fullname?>(<?php echo $user_salutation?>) </h3>
      <p><?php echo $designation_name?></p></td>
    </tr-->
	<tr>
      <td colspan="9" style="max-width:100%; height:auto"><img src="Header.png" align="middle" width="98%" height="40%" /></td>
    </tr>
  </table>
  <div id="divButtons" name="divButtons">
<input type="button" value = "Print " onclick="printPage()" style="font:bold 11px verdana;color:#FF0000;background-color:#FFFFFF;"> &nbsp;
<input type="button" value = "Back" onClick="history.go(-1);return true;" style="font:bold 11px verdana;color:#FF0000;background-color:#FFFFFF;">

</div>
</div>
</body>
</html>
