<html>

<body style="background-color: #ffffff;background-image:url(rail.jpg);background-repeat: repeat-y">

<?php
	$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	include('link2.php');
?>

<h2 align=center><i>Staff view Room Transaction</i></h2>

<h3 align=center>Search for user detail</h3>
<?php
echo "<center><a href=room1.php>Back&nbsp;Menu</a>

<form action='http://www.wauhaha.com/karaoke_online/searchingbooking.php' method='post'>
<table border='1' cellspacing='0' cellpadding='5' bordercolorlight='tan' align=center>
<tr>
	<td>Search by:</td>
	<td><select name='searchBy'>
	<option value='Username'>Username</option>
	<option value='Name'>Name</option>
	<option value='IC'>IC</option>
	</select>
	</td>
	<td rowspan='2'><input type='submit' name='search' value='Search'>&nbsp;&nbsp;&nbsp;&nbsp;
	
	</td>
</tr>
<tr>
	<td>Keywords:</td>
	<td><input type='text' name='keywords'></td>
</tr>
</table>

</form>";

?>


<?php


if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
$start_from = ($page-1) * 10; 
$result2 = mysql_query("SELECT * FROM roomtrans ORDER BY date DESC LIMIT $start_from,10");
$sql = mysql_query("select COUNT(*) From roomtrans");  

$row=mysql_fetch_array($sql);
$total_records = $row[0];
$total_pages = ceil($total_records / 10);
echo "<center>";
for ($i=1; $i<=$total_pages; $i++) { 
	echo "<a href='viewroomtrans1.php?page=".$i."'>&nbsp;" .$i. "&nbsp;</a>"; 
}; 
echo "<table border=1 align=center style ='font-family:Arial, Helvetica, sans-serif;font-size:1em' color='blue' bordercolorlight='tan' cellspacing=0 cellpadding=4>
 <tr bgcolor=lightblue >

						<th>Name</th>
						<th>IC</th>
						<th>Contact</th>
						<th>RoomType</th>
						<th>Package1</th>
						<th>People1</th>
						<th>Price1</th>
						<th>Total1</th>
						<th>Package2</th>
						<th>People2</th>
						<th>Price2</th>
						<th>Total2</th>
				
						<th>Total</th>
						<th>Date</th>
						<th>Time</th>
						<th>Book Time</th>
						<th>Hours</th>
						
						</tr>";


while($row2 = mysql_fetch_array($result2)){

  
  echo"<tr align='center' border=1>";
	

  echo "<td border=1>".$row2['Name']."</td>";
  echo "<td border=1>".$row2['IC']."</td>";
  echo "<td border=1>".$row2['Contact']."</td>";
  echo "<td border=1>".$row2['roomtype']."</td>";
  echo "<td border=1>".$row2['package1']."</td>";
  echo "<td border=1>".$row2['people1']."</td>";
  echo "<td border=1>Rm".$row2['price1']."</td>";
  echo "<td border=1>Rm".$row2['total1']."</td>";
  echo "<td border=1>".$row2['package2']."</td>";
  echo "<td border=1>".$row2['people2']."</td>";
  echo "<td border=1>Rm".$row2['price2']."</td>";
  echo "<td border=1>Rm".$row2['total2']."</td>";

  echo "<td border=1>Rm".$row2['Total']."</td>";
  echo "<td border=1>".$row2['date']."</td>";
  echo "<td border=1>".$row2['time']."</td>";
  echo "<td border=1>".$row2['booktime']."</td>";
  echo "<td border=1>".$row2['hours']."</td>";

  
  echo "</tr>";
 
  }
  echo "</table>";


?>
	</body>
</html>	