<?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="auto"></th>
</tr>

<!-- row for header picc 2 -->
<tr>
     <th width="100%" colspan="4"><img src="images/eoffice-cox.jpg" width="100%" height="auto"></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>
<h3 align="center" ><a href="cost_fnb_Ramadhan.php" style="text-decoration:none; color:#330000">Total Cost-Ramadhan </a></h3>
<form method="post">
		<?php
       $cust_id = $_REQUEST['cust_id'];	 
			//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'];	
		?>

<table align=center class="gridtable" >
<tr>
            <th width="20%" scope="col" >Customer </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 align="center"><?php echo $row['cust_company']?> <p><br> <?php echo $row['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 htmlentities($_REQUEST['quotation_date_from']); ?>">
			 <label for="to">To &nbsp;</label><input type="text" id="quotation_date_to" name="quotation_date_to" value="<?php echo htmlentities($_REQUEST['quotation_date_to']); ?>"></td>
			<!--td>Cafe@picc <input type="text" size="5" maxlength="5" name="quotation_id"></td-->
            <td><textarea rows="4" cols="40" name="quotation_remarks" ></textarea></td>
          </tr>
		<tr><td colspan="3" align="center"><button name="save" class="mybutton">Save</button> &nbsp;
		<a href="quotation_mainpage.php?cust_id=<?php echo $cust_id ?>" class="mybutton">Back </a></td></tr> 
</table>

</form>
<br>

<!--hr /-->
<div align="right"> 
<?php
            if (isset($_POST['save'])){
			            
			                  $cust_id=$row['cust_id'];
							  $user_id=$row2['user_id'];
				 $quotation_date_from =$_POST['quotation_date_from'];
				   $quotation_date_to =$_POST['quotation_date_to']; 
				    $quotation_remarks=$_POST['quotation_remarks'];  
					           $status='gst';    
				                  
            $Quo="insert into tbl_dir_fnb_rquotation
	    		 (quotation_id,cust_id,user_id,quotation_date_from,quotation_date_to,quotation_remarks) 
                  values ('$quotation_id','$cust_id','$user_id','$quotation_date_from','$quotation_date_to','$quotation_remarks')";
		
			$result= mysql_query($Quo);
		 
		 if ($result){
		 		echo "<script language='javascript'>window.location='quotation_chooseDate_Ramadhan.php?cust_id=$cust_id'</script>";}
			else{
				echo 'Unsuccessful, please try again';}
    }     
?>
</div>
<?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_rquotation WHERE cust_id='$cust_id'
					                      ORDER BY quotation_id DESC  LIMIT $offset, $rowsPerPage");
		            $i=$offset;
					echo "<center><table border=1 width=80% align=center style=border-collapse:collapse; border-width:1px;font-family: verdana,
					               arial,sans-serif; font-size:11px;color:#000000;text-decoration:none >";
					echo"<tr bgcolor=#b5cfd2 url('images/cell-blue.jpg') style=font-family: verdana,arial,sans-serif;><th  width=40>No</th><th  width=80>Quotation ID</th><th  width=200>Date Start</th>
					     <th width=250>Date End</th><th width=250> Remarks</th><th> Status</th>
					     <th width=400>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=="Cancel")
		  	 {
		  $color="#FF0000";
		  	 }
		  elseif ($quotation_status=="Confirm")
		  	 {
		  $color="#00FF00";
		  	 }
		 
		  else
		  	{
		   $color="#FFCC33";
		  	}
			
				    echo "<tr   >";
					echo "<td align= center  >".$i."</td>";
					echo"<td width=100 align=center><a href='quotation_addOrder_Ramadhan.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=left width=200>".$row1['quotation_remarks']."</td>";
					echo "<td align=center width=200 bgcolor=$color; ><span $color;><a style=color:black; href='quotation_status_Ramadhan.php?quotation_id=".$row1['quotation_id']."'>
					      ".$row1['quotation_status']."</a><span>"."</td>";
							  	
					echo "<td align=center ><a href='cust_del_quotation_Ramadhan.php?quotation_id=".$row1['quotation_id']." '>DELETE</a>&nbsp;&nbsp;
						 <a href='cust_FnB_print_Ramadhan.php?quotation_id=".$row1['quotation_id']." '>VIEW</a>&nbsp;&nbsp;
						 <a href='cust_FnB_edit_quotation_Ramadhan.php?quotation_id=".$row1['quotation_id']." '>EDIT</a></td>";
					echo"</tr>";
					echo"<tr>";
						}			
					echo "</table>";				
 ?>
</br>
 </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>
