<?php 
   
$PID = "lap_penggunaan_room";
$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' >  Room Usage Report");


?>
<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="tgl1" value="<?php echo $_GET["tgl1"]; ?>" ></td>
	</tr>
	<tr>
		<td><b>To</b></td>
		<td><input type="text" name="tgl2" class="tgl2" value="<?php echo $_GET["tgl2"]; ?>" ></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><input type="submit" value="Show"/></td>
	</tr>
</table>
<br/>
</form>
<?php

$sql = "select * from tbl_referensi where id != '000' and kd = 'ROM'
			 ";
	$r = mysql_query($sql);
	$n = mysql_num_rows($r);
	
	$no = 1;
?><div class="ui three column grid" ><?php
while ($row = mysql_fetch_array($r)) {
	$jml = getFromTable("select count(a.item_id) from tbl_transaksi a 
						join tbl_room b on b.id = a.item_id
						where a.jns_trans = 'ROOM' and b.kd_jenis = '".$row[id]."' and a.status_trans = 1 
						and (a.tgl_trans between '".$_GET[tgl1]."' and '".$_GET[tgl2]."')");
	
	$clas = "room".$no++; 
	
	?>
	<div class="column">
		<div class="ui top attached <?php echo $clas; ?> message"><b><?php echo $row[keterangan];?></b></div>
		<div class="ui bottom attached segment">
		Room Use Amount : <b><?php echo $jml; ?></b> Unit		
		</div>
	</div>
<?php } ?>

</div>