<?php    
$PID = "lap_cekin";
$SC = $_SERVER["SCRIPT_NAME"];

require_once("lib/dbconn.php");
require_once("lib/form.php");
require_once("lib/functions.php");


title_print("Guest in House");
	
?>

<table id='mytable' class="gridtable tableWithFloatingHeader" width="100%" border="1px">
	<tr>
		<td class="gridtable_th" align="center">No</td>
		<td class="gridtable_th" align="center">Guest ID</td>
		<td class="gridtable_th" align="center">Check in<br/>Date</td>
		<td class="gridtable_th" align="center">No.<br/>Room</td>
		<td class="gridtable_th" align="center">Room Type</td>
		<td class="gridtable_th" align="center">Guest</td>
		<td class="gridtable_th" align="center">Address</td>
		<td class="gridtable_th" align="center">Hp & Email</td>
	</tr>
	<?php
	$sql = "select DISTINCT a.*, c.keterangan as inisial, d.*, d.keterangan as negara, f.no_room
			from tbl_booking a 
			join tbl_transaksi b on b.no_booking = a.id_booking
			join tbl_referensi c ON c.id = a.kd_inisial and c.kd = 'INS'
			join tbl_referensi d ON d.id = a.jns_room and d.kd = 'ROM'
			join tbl_referensi e on e.id = a.kd_negara and e.kd = 'NGR'
			join tbl_room f on f.id = b.item_id
			where b.jns_trans = 'ROOM' and a.status_booking = 'cekin' and b.status_trans = 1
			ORDER BY no_room ASC";
	$r = mysql_query($sql);
	$n = mysql_num_rows($r);
	
	$no = 1;

while ($row = mysql_fetch_array($r)) {
	?>
	<tr>
		<td class="gridtable_td"><?php echo $no++; ?></td>
		<td class="gridtable_td" align="center"><a href="javascript:GuestFolio('<?php echo $row[id_booking]; ?>')"><?php echo $row[id_booking]; ?></a></td>
		<td class="gridtable_td" align="center"><?php echo ucwords(strtolower($row[tgl_cekin])); ?></td>
		<td class="gridtable_td" align="center"><?php echo ucwords(strtolower($row[no_room])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[keterangan])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[inisial]." ".$row[nm_lengkap])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[alamat]." ".$row[kota]." ".$row[ngr])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[no_hp]." / ".$row[email])); ?></td>
	</tr>
	<?php } ?>
</table>

<script language='JavaScript'>

}
</script>
