<?php session_start();?>
<?php require_once('open_connection.php');?>
<link href="css/gridtable.css" rel="stylesheet" type="text/css" />
<!--link href='blue/style.css' rel='stylesheet' type='text/css' /-->
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script>
	$(function() {
		$("#quotation_date_from").datepicker({ dateFormat: 'yy-mm-dd' });
		$( "#format" ).change(function() {
		 var minValue = $(this).val();
		  minValue = $.datepicker.parseDate("yy-mm-dd", minValue);
            minValue.setDate(minValue.getDate()+1);
			$( "#invoice_date").datepicker( "option", "dateFormat", $( this ).val() );
		});
		$("#quotation_date_to").datepicker({ dateFormat: 'yy-mm-dd' });
		$( "#format" ).change(function() {
		 var maxValue = $(this).val();
		  maxValue = $.datepicker.parseDate("yy-mm-dd", maxValue);
            maxValue.setDate(maxValue.getDate()+1);
			$( "#invoice_date").datepicker( "option", "dateFormat", $( this ).val() );
		});
	});
	</script>  					
<!DOCTYPE html>
<html>
<head>
      <title>PICCSB e-Directory System</title>

</head>
<body bgcolor="#333333"> 
<table width="100%" border="0" align="center">
<tr>
<td width="15%" bgcolor="#333333">&nbsp;</td>
<td width="70%" align="center" bgcolor="#FFFFFF" > 

<table width="100%" border="0" align="center">

<!-- row for header picc 1 -->
<tr>  
     <th width="100%" colspan="4"><img src="images/header-cox.jpg" width="100%" height="40%"></th>
</tr>

<!-- row for header picc 2 -->
<tr>
     <th width="100%" colspan="4"><img src="images/eoffice-cox.jpg" width="100%" height="15%"></th>
</tr>
<!-- calling frame -->	
<tr>
    <td colspan="1" width="10%" align="center"><?php include("header.php");?></td>
	
</tr>
<tr>

<td colspan="3" width="90%" align="center" >
<tr><td>&nbsp;</td></tr>
<tr><td align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<?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'];
					
                ?>
							<a href="cust_FnB_Login.php"><img src="images/logout5.png" align="right" width="80" height="35" title="Logout from this page"></a><a href="cust_FnB.php"><img src="images/back-button.png" align="right" width="80" height="35" title="Back to Customer's List"></a>
							
							</td>
</tr>
<tr><td><?php
$cust_id = $_REQUEST['cust_id'];
$cust_name = $_REQUEST['cust_name'];
$customer1= "SELECT * FROM tbl_dir_fnb_customer WHERE cust_id ='$cust_id'";
		$result = mysql_query($customer1);
			$row=mysql_fetch_array($result);
		$cust_id=$row['cust_id'];
		$cust_name=$row['cust_name'];?>
<h2 align="center">List of Quotation for <?php echo $row['cust_name']?></h2>
	
<form method="post">
		<?php
       $cust_id = $_REQUEST['cust_id'];
	    //$cust_name = $_REQUEST['cust_name']	 
			//echo $cust_id;
       $customer= "SELECT * FROM tbl_dir_fnb_customer WHERE cust_id ='$cust_id'";
		$result = mysql_query($customer);
			$row=mysql_fetch_array($result);
		$cust_id=$row['cust_id'];
		
		?>
	

</form>
<br>


<?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 WHERE cust_id='$cust_id' ORDER BY quotation_id DESC  LIMIT $offset, $rowsPerPage");
		            $i=$offset;
					echo "<center><table border=1 width=61% align=center style=border-collapse:collapse; border-width:1px;font-family: verdana,arial,sans-serif; font-size:11px;color:#000000;  >";
					echo"<tr bgcolor=#b5cfd2 url('images/cell-blue.jpg') style=font-family: verdana,arial,sans-serif;><th  width=50>No</th><!--th>Name</th--><th  width=100>Quotation ID</th><th  width=200>Date Start</th>
					     <th width=200>Date End</th><th> Remarks</th><th> Payment</th>
					     <th width=300>Action</th></tr>";
						
					while(@$row1=mysql_fetch_array($result3))
						{
				   $quotation_id = $row1['quotation_id'];
		 	           $custi_id = $row['cust_id'];
		    $quotation_date_from = $row1['quotation_date_from'];
		      $quotation_date_to = $row1['quotation_date_to'];
			  $quotation_remarks = $row1['quotation_remarks'];
			  $quotation_status = $row1['quotation_status'];
			 	 
			$i++;
			?>
				
				<?php 
				if ($quotation_status=="Partial")
		  	 {
		  $color="#b5cfd2";
		  	 }
		  elseif ($quotation_status=="Paid")
		  	 {
		  $color=" #CC9999";
		  	 }
		 
		  else
		  	{
		   $color="#FF3300";
		  	}
			
				    echo "<tr  >";
					echo "<td align= center  >".$i."</td>";
					//echo "<td align=center width=200>".$row['cust_name']."</td>";
					echo "<td align=center width=200>".$row1['quotation_id']."</td>";
					//echo"<td width=100 align=center><a href='quotation_addOrder.php?quotation_id=".$row1['quotation_id']."'>".$row1['quotation_id']."</a></td>";
					echo "<td align=center width=200>".$row1['quotation_date_from']."</td>";
					echo "<td align=center width=200>".$row1['quotation_date_to']."</td>";	
					echo "<td align=center width=200>".$row1['quotation_remarks']."</td>";
					echo "<td align=center width=200 bgcolor=$color; ><span $color;>".$row1['quotation_status']."</a><span>"."</td>";
							  	
					echo "<td align=center ><!--a href='cust_del_quotation.php?quotation_id=".$row1['quotation_id']." '><img src=images/del.png title=Delete border=0/></a-->&nbsp;
						  <a href='cust_FnB_print.php?quotation_id=".$row1['quotation_id']." '><img src=images/view.png title=View border=0/></a></td>";
					echo"</tr>";
					echo"<tr>";
						}			
					echo "</table>";				
 ?>
 
</body>

  </td></tr>
  
  </div>
  </td></tr>
<!-- row for footer -->	
<tr>
	<th align="center" colspan="4">
	<?php include ('footer.php'); ?>
		
	</th>
</tr>

<!--- end for ruang kerja 80% -->
</table> 

</td>

<td width="15%" bgcolor="#333333">&nbsp;</td>

</tr>

<!--- end for ruang kerja 100% -->
</table>

</body>
</html>
