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

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

title("<img src='images/sales-report-icon.png' width='65' align='absmiddle' >  Print of Check");

	
if (isset($_GET[idx])){
	include_once('keterangan.php');
?>
<br/>
<br/>
<br/>
<div class="ui four column stackable grid" align="center">
	<div class="column">
		<a class="btn_bayar" href="javascript:cetak_booking('<?php echo $_GET[idx]; ?>')" >Booking</a>
	</div>
	<div class="column">
		<a class="btn_bayar" href="javascript:cetak_bayar('<?php echo $_GET[idx]; ?>')">Payment</a>
	</div>
	<div class="column">
		<a class="btn_bayar" href="javascript:cetak_dp('<?php echo $_GET[idx]; ?>')">Down Payment</a>
	</div>
	<div class="column">
		<a class="btn_bayar" href="javascript:cetak_retur('<?php echo $_GET[idx]; ?>')">Return</a>
	</div>
</div>

<br/>
<br/>
<br/>
<br/>
<script language='JavaScript'>
function cetak_booking(tag) {
    sWin = window.open('includes/cetak_booking.php?idx='+tag, 'xWin',
 'top=0,left=0,width=750,height=550,menubar=no,scrollbars=yes');
    sWin.focus();
}
function cetak_bayar(tag) {
    sWin = window.open('includes/cetak_bayar.php?idx='+tag, 'xWin',
 'top=0,left=0,width=750,height=550,menubar=no,scrollbars=yes');
    sWin.focus();
}
function cetak_dp(tag) {
    sWin = window.open('includes/cetak_dp.php?idx='+tag, 'xWin',
 'top=0,left=0,width=750,height=550,menubar=no,scrollbars=yes');
    sWin.focus();
}
function cetak_retur(tag) {
    sWin = window.open('includes/cetak_retur.php?idx='+tag, 'xWin',
 'top=0,left=0,width=750,height=550,menubar=no,scrollbars=yes');
    sWin.focus();
}
</script>
<?php
} else {
	$sql = "select DISTINCT b.tgl_cekin, a.no_booking, b.nm_lengkap, b.alamat, b.jns_room, c.item_id, d.no_room, e.keterangan, b.no_hp, b.status_booking
			from tbl_pembayaran a
			JOIN tbl_booking b on b.id_booking = a.no_booking
			left JOIN tbl_transaksi c on c.no_booking = a.no_booking and c.jns_trans = 'ROOM' and c.status_trans = 1
			LEFT JOIN tbl_room d on d.id = c.item_id
			JOIN tbl_referensi e on e.id = b.jns_room and e.kd = 'ROM'";
	$r = mysql_query($sql);
	$n = mysql_num_rows($r);
	
	$no = 1;
	?>
<form>
<input type="hidden" name="p" value="<?php echo $PID; ?>"/>
<input type="submit" style="display: none;"/>
<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. Guest</td>
		<td class="gridtable_th" align="center">Date of Checkin</td>
		<td class="gridtable_th" align="center">Room</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">Status</td>
	</tr>
	<tr>
		<td class="gridtable_th">&nbsp;</td>
		<td class="gridtable_th" align="center"><input type="text" size="10" name="kd_book" value="<?php echo $_GET[kd_book];?>"></td>
		<td class="gridtable_th">&nbsp;</td>
		<td class="gridtable_th">&nbsp;</td>
		<td class="gridtable_th" align="center"><input type="text" name="nama" value="<?php echo $_GET[nama];?>"></td>
		<td class="gridtable_th" align="center"><input type="text" name="alamat" value="<?php echo $_GET[alamat];?>"></td>
		<td class="gridtable_th">&nbsp;</td>
		<td class="gridtable_th">&nbsp;</td>
	</tr>
	<?php
while ($row = mysql_fetch_array($r)) {
	?>
	<tr>
		<td class="gridtable_td"><?php echo $no++; ?></td>
		<td class="gridtable_td" align="center"><a href="<?php echo "$SC?p=$PID&idx=$row[no_booking]";?>"><?php echo $row[no_booking]; ?></a></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[tgl_cekin])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[no_room]." - ".$row[keterangan])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[nm_lengkap])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[alamat])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[no_hp])); ?></td>
		<td class="gridtable_td"><?php echo ucwords(strtolower($row[status_booking])); ?></td>
	</tr>
	<?php
} ?>
</table>
</form>
<?php } ?>