<?php
session_start();
if(isset($_POST["dat"]) && isset( $_POST['hotelID'] )){
	 $hid=$_POST['hotelID'];
	$date=$_POST["dat"];
	
include("buda_connect.php");

$queryH=mysql_query("select recept_no,hotel_id,room_id,cust_id,pay_type,arrived_on,check_in_time,arivedf,departure_on,departure_to,no_of_night,nofguest,occupation_type,cash_amount,Age,car_reg,p_status,clerksign from  recept where hotel_id='$hid' and departure_on like '%$date%' ")or die("Error1: ".mysql_error());


$hotno=mysql_num_rows($queryH);

if($hotno>0){
	 
	 $gethoD = array();
	 ?><table border=1 id="b"> <tr><td colspan=6>CUSTOMER RECEPTION BOOK FOR <b><?php echo $date;?></b> </td></tr><?php
	 
	 $NR=0;
	 while($NR<$hotno){
	 $OuthD=mysql_fetch_array($queryH);
	 
	 array_push($gethoD,array('recept_no'=>$OuthD[0],
	                         'hotel_id'=>$OuthD[1],
							  'room_id'=>$OuthD[2],
							 'cust_id'=>$OuthD[3],
							 'pay_type'=>$OuthD[4],
							 'arrived_on'=>$OuthD[5],
							 'check_in_time'=>$OuthD[6],
							 'arivedf'=>$OuthD[7],
							 'departure_on'=>$OuthD[8],
							 'departure_to'=>$OuthD[9],
							 'no_of_night'=>$OuthD[10],
							 'nofguest'=>$OuthD[11],
							 'occupation_type'=>$OuthD[12],
							 'cash_amount'=>$OuthD[13],
							 'Age'=>$OuthD[14],
							 'car_reg'=>$OuthD[15],
							 'p_status'=>$OuthD[16],
							 'clerksign'=>$OuthD[17]
 							  
							  
	             
				 ));
$ph_no=mysql_query("select phno from phone_number where cust_id='$OuthD[3]'")or die("Error 2:".mysql_error());

$getp=array();

$Outp=mysql_fetch_array($ph_no);
	 
	 array_push($getp,array('phno'=>$Outp[0]
	                       
				 ));
				 
$qH=mysql_query("select room_no,rname,rcost,rtype,rstatus from room where hotel_id='$OuthD[1]' and room_no='$OuthD[2]'")or die("Error3: ".mysql_error());
$ht=mysql_num_rows($qH);

 
	 $rum = array();
	 
	 $OD=mysql_fetch_array($qH);
	 
	 array_push($rum,array('room_no'=>$OD[0],
	                         'rname'=>$OD[1],
							 'rcost'=>$OD[2],
							 'rtype'=>$OD[3],
							 'rstatus'=>$OD[4]
							 ));
				 
/*$occ=mysql_query("select  room_status from occupation_record where hotel_id='$OuthD[1]' and cust_id='$OuthD[3]'")or die("Error3: ".mysql_error());
$ht=mysql_num_rows($occ);

 
	 $rum = array();
	 
	 $Oc=mysql_fetch_array($occ);                             
	 
	 array_push($rum,array('room_status'=>$Oc[0]
	                        
							 ));*/
							 
							 
							 
$cust=mysql_query("select fname,mname,lname,address,email,nationality,post_code,profession from  customer where cust_id='$OuthD[3]'")or die("Error3: ".mysql_error());

	$cu=mysql_num_rows($cust);

 
	 $rn = array();
	 
	 $ct=mysql_fetch_array($cust);                             
	 
	 array_push($rn,array('fname'=>$ct[0],
	                      'mname'=>$ct[1],
						  'lname'=>$ct[2],
						  'address'=>$ct[3],
						  'email'=>$ct[4],
						  'nationality'=>$ct[5],
						  'post_code'=>$ct[6],
						  'profession'=>$ct[7]
	                        
							 ));						 
		?>
	<tr id="tdprof"><td id="blue"><font size=2 color =white type="agency fb">Full Name:</font></td><td colspan=5><font size=3 type="agency fb"><?php echo $ct[0]." ".$ct[1]." ".$ct[2];?></font></td>
	</tr>
	
	<tr><td id="blue"><font size=2 color =white type="agency fb">Customer ID:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[3]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Reception NO:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[0]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Room Name:</font></td><td><font size=2 type="agency fb"><?php echo $OD[1]; ?></font></td></tr> 
	
	
	
	<tr><td id="blue"><font size=2 color =white type="agency fb">Email Address:</font></td><td><font size=2 type="agency fb"><?php echo $ct[4]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Physical Address:</font></td><td><font size=2 type="agency fb"><?php echo $ct[3]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Nationality:</font></td><td><font size=2 type="agency fb"><?php echo $ct[5]; ?></font></td></tr> 

<tr><td id="blue"><font size=2 color =white type="agency fb">Professional:</font></td><td><font size=2 type="agency fb"><?php echo $ct[7]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Date of Arrival:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[5].", ".$OuthD[6]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Arrived From:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[7]; ?></font></td></tr> 


<tr><td id="blue"><font size=2 color =white type="agency fb">Date of Departure:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[8]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Departure To:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[9]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Number of Night:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[10]; ?></font></td></tr> 

<tr><td id="blue"><font size=2 color =white type="agency fb">Night of Guest:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[11]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Occupation Type:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[12]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Payment Type:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[4]; ?></font></td></tr> 

	
	<tr><td id="blue"><font size=2 color =white type="agency fb">Payment Staus:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[16]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Amount paid:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[13]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Phone number:</font></td><td><font size=2 type="agency fb"><?php echo $Outp[0]; ?></font></td></tr> 
	
	
	
	
	
	
	
	
	
	
	
<tr><td id="blue"><font size=2 color =white  type="agency fb">Customer Age:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[14]; ?></font></td>
	
	
	<td id="blue"><font size=2 color =white type="agency fb">Post Code:</font></td><td><font size=2 type="agency fb"><?php echo $ct[6]; ?></font></td>
	
	
	<td id="blue"><font size=2  color =white type="agency fb">Car Registration NO:</font></td><td><font size=2 type="agency fb"><?php echo $OuthD[15]; ?></font></td></tr> 

<tr><td colspan =6 ><center><font size=2  type="agency fb">Clerk Signature:</font> <font size=1><i><?php echo $OuthD[17]; ?></i></font></center></td></tr> 	
<?php				 
$NR++;

	 }
	 ?>
</table>
<?php
}else{
	echo "No value match!..".$date;
}
}else{
	echo "No value posted!..";
}

?>      