
<SCRIPT type='text/javascript' language="JavaScript" src='js/jquery-ui-timepicker-addon.js'></SCRIPT>
<link rel="stylesheet" type="text/css" href='js/jquery-ui-timepicker-addon.css'/>
        
<script>
	$(function() {
		var startDateTextBox  = $('.wkt1');
		var endDateTextBox = $('.wkt2');

		$.timepicker.datetimeRange(
			startDateTextBox,
			endDateTextBox,
			{
				minInterval: (1000*60*60), // 1hr
				dateFormat: 'yy-mm-dd', 
				timeFormat: 'HH:mm:ss',
				start: {}, // start picker options
				end: {} // end picker options					
			}
		);
	});
</script>
<?php 
   
$PID = "lap_booking";
$SC = $_SERVER["SCRIPT_NAME"];

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



if (!isset($GLOBALS['print'])) {
	title_print("Reservation Report");	
	$tgl = date("d-m-Y");
	$jam = date("H:i:s");
?>
<form>
<input type="hidden" name="p" value="<?php echo $PID;?>"/>

<table class="gridtable_form" width="40%">
	<tr>
		<td><b>Date From</b></td>
		<td>
			<input type="text" name="tgl1" class="wkt1" value="<?php echo $_GET["tgl1"]; ?>" readonly="readonly">
			<!--input type="text" name="wkt1" size="15" class="wkt1" value="<?php echo $_GET["wkt1"]; ?>" readonly="readonly"-->
		</td>
	</tr>
	<tr>
		<td><b>to</b></td>
		<td>
			<input type="text" name="tgl2" class="wkt2" value="<?php echo $_GET["tgl2"]; ?>" readonly="readonly">
			<!--input type="text" name="wkt2" size="15" class="wkt2" value="<?php echo $_GET["wkt2"]; ?>" readonly="readonly"-->	
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><input type="submit" value="View"/></td>
	</tr>
</table>
</form>
<?php } else { ?>
<table class="gridtable_form" width="50%">
	<tr>
		<td><b>Report Name</b></td>
		<td> : Booking Report </td>
	</tr>
	<tr>
		<td><b>Date From</b></td>
		<td> : <?php echo $_GET["tgl1"]; ?> <b>to</b> <?php echo $_GET["tgl2"]; ?></td>
	</tr>
	<tr>
		<td><b>Date Print</b></td>
		<td> : <?php echo $tgl; ?> &nbsp; <?php echo $jam; ?></td>
	</tr>
	<tr>
		<td><b>User Print</b></td>
		<td> : <?php echo $_SESSION[nama_usr];?>  </td>
	</tr>
</table>
<?php } ?>
<br/>
<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">No. Reserv.</td>
		<td class="gridtable_th" align="center">Reserv. Date</td>
		<td class="gridtable_th" align="center">Check in Date</td>
		<td class="gridtable_th" align="center">Order Name</td>
		<td class="gridtable_th" align="center">Address</td>
		<td class="gridtable_th" align="center">No.Hp & Email</td>
		<td class="gridtable_th" align="center">Room Type</td>
	</tr>
	<?php
	$sql = "select a.*, b.keterangan as inisial, c.*, d.keterangan as negara
			from tbl_booking a 
			JOIN tbl_referensi b ON b.id = a.kd_inisial and b.kd = 'INS'
			JOIN tbl_referensi c ON c.id = a.jns_room and c.kd = 'ROM'
			join tbl_referensi d on d.id = a.kd_negara and d.kd = 'NGR'
			where (CONCAT(a.tgl_booking,' ',a.wkt_booking) between '".$_GET[tgl1]."' and '".$_GET[tgl2]."' )  ";
	
	$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"><?php echo $row[id_booking]; ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[tgl_booking])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[tgl_cekin])); ?></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[kd_pos]." ".$row[negara])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[no_hp]." / ".$row[email])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[keterangan])); ?></td>
	</tr>
	<?php } ?>
</table>

