<?php 
include("config.php");
include("config2.php");

$room_no = $conn->real_escape_string($_POST['room_no']);
$id = $conn->real_escape_string($_POST['id']); 
$cid='0';
	
if($id>"0"){
//----------------------customer entry -------------------------

 mysql_query("delete from  bookings where room_no='$room_no' and customer_id='$cid' and ostatus='0'");
	
}	 // end  check selected room

//----------------------end customer entry -------------------------

$bresult=mysql_query("select * from bookings WHERE customer_id='$cid' and ostatus='0' group by room_no asc");
$brow=mysql_fetch_array($bresult);
if($brow!=""){
?>
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="list_table">
  <tbody>
    <tr>
      <th width="10%">Room No</th>
      <th width="39%">Booked/Hold Date</th>
	  <th width="12%">Price</th>
	  <th width="11%">Days</th>
      <th width="11%">Addition Service</th>
      <th width="11%">Addition Service for Person</th>
    <th width="6%">Total</th>
    <th width="6%">Delete</th>
    </tr>
<?php 
do{
	  ?>
    <tr>
      <td><?php echo $brow[room_no]; ?></td>
      <td><?php 
$cresult=mysql_query("select check_in,rprice from bookings WHERE customer_id='$cid' and ostatus='0' and room_no='$brow[room_no]'");
$crow=mysql_fetch_array($cresult);
	$sr=0;
do{
$sr=$sr+1;
echo $crow[check_in].", ";
$rprice=$crow[rprice];
}while($crow=mysql_fetch_array($cresult));
	
		  
		  ?></td>
      <td><?php echo $brow[rprice]; ?></td>
		<td><?php echo $sr; ?></td>
      <td><?php echo $brow[additional_ser]; ?></td>
      <td><?php echo $brow[addi_pax]; ?></td>
     <td><?php $total=$sr*$rprice; echo $total; $gtotal=$gtotal+$total; ?></td>
     <td align="center"><a href="javascript:void(0);" onClick="delete_hotel('<?php echo $brow[id]; ?>','<?php echo $brow[room_no]; ?>');">Delete</a>
</td>
    </tr>
	 <?php 
	  
	  }while($brow=mysql_fetch_array($bresult));
	  ?>
	  <tr>
      <td colspan="5">&nbsp;</td>
      <td>Total </td>
      <td><?php echo $gtotal;?><input name="stotal_taka" type="hidden" id="stotal_taka" value="<?php echo $gtotal;?>" /></td>
      <td align="center">&nbsp;</td>
    </tr>
  </tbody>
</table>
 
<?php
}
	
//----------------------Booking  -------------------------
	
 
//----------------------end Booking  -------------------------

//header("location:add_client.php");
 
//header("location:hotel_new.php?info=Please Select Date of Booking/Hold");
 
?>