<?php session_start();?>
<?php require_once('open_connection.php');?>
<link href="css/gridtable.css" rel="stylesheet" type="text/css" />
<link href="css/imagetable.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="30%"></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 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/logout3.gif" align="right"></a>
							</td>
</tr>
<tr><td>
<h2 align="center">FOOD AND BEVERAGE QUOTATION</h2>
<form method="post">
<?php $quotation_id = $_GET['quotation_id'];?>
		<?php
       $quotation= "SELECT * FROM tbl_dir_fnb_quotation WHERE quotation_id ='$quotation_id'";
		$result = mysql_query($quotation);
			$row=mysql_fetch_array($result);
		$cust_id=$row['cust_id'];
		$quotation_remarks=$row['quotation_remarks'];
		?>
		<?php
     
       $customer= "SELECT * FROM tbl_dir_fnb_customer WHERE cust_id ='$cust_id'";
		$result1 = mysql_query($customer);
			$row1=mysql_fetch_array($result1);
		$cust_id=$row1['cust_id'];	
		$cust_name=$row1['cust_name'];
		?>

<table align=center class="gridtable" >
<tr>
            <th width="20%" scope="col">Customer Name </th>
            <th width="50%" scope="col">Date</th>
			<!--th width="21%" scope="col">Quotation No: </th-->
            <th width="40%" scope="col">Remarks</th>
  </tr>
          <tr>
            <td><?php echo $row1['cust_name']?> </td>
            <td><input type="hidden" id="quotation_id" name="quotation_id"   value="<?php echo htmlentities($_REQUEST['quotation_id']); ?>">
			 <label class="control-label" for="input01">Event Duration:</label>
			<input type="text" id="quotation_date_from" name="quotation_date_from"required value="<?php echo $row['quotation_date_from']; ?>">
			 <label for="to">To &nbsp;</label><input type="text" id="quotation_date_to" name="quotation_date_to" value="<?php echo $row['quotation_date_to']; ?>"></td>
			<!--td>Cafe@picc <input type="text" size="5" maxlength="5" name="quotation_id"></td-->
             <td><textarea name="quotation_remarks" rows="8" cols="40" ><?php echo $quotation_remarks;?></textarea></td>
          </tr>
		<tr><td colspan="3" align="center"><button name="save" class="button">Save</button> &nbsp;
		<input type="button" value = "Back" onClick="history.go(-1);return true;" class="button"></td></tr> 
</table>
<?php
                if (isset($_POST['save'])){

                    $quotation_date_from  =$_POST['quotation_date_from'];
                    $quotation_date_to    =$_POST['quotation_date_to'];
					$quotation_remarks    =$_POST['quotation_remarks'];
				

                    $result3=mysql_query("update tbl_dir_fnb_quotation set quotation_date_from='$quotation_date_from',
                                          quotation_date_to='$quotation_date_to',
                                          quotation_remarks='$quotation_remarks'
                                          where quotation_id='$quotation_id' ")or die(mysql_error());
				
		 
		 if ($result3){
		 		echo "<script language='javascript'>window.location='quotation_chooseDate_zerogst.php?cust_id=$cust_id'</script>";}
			else{
				echo 'Unsuccessful, please try again';}
    }     
            ?>
</form>
<br>

<!--hr /-->

 </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>

