<?php
$d=date('Y-m-d');
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	
$RoomNo = $_GET['RoomNo'];	
$rt = $_POST['rt'];
$t = $_POST['et'];
$q1 = $_POST['q1'];
$h = $_POST['h'];
$q2 = $_POST['q2'];
$n = $_POST['n'];
$ic = $_POST['ic'];
$c = $_POST['c'];

$result = mysql_query ("select * from roomtype where roomtype='$rt'");
$row = mysql_fetch_array($result);

$p1 = $row['price1'];
$p2 = $row['price2'];
$tp = ($q1 * $p1)*($h/3) ;
$tp2 = ($q2 * $p2)*($h/3) ;
$tp3 = ($tp + $tp2);

if(($q1 =="") && ($q2 =="")){
		echo "<script>alert('Please fill in your form completely')</script>";
		echo "<script language='javascript'>window.location='bookroom1.php?RoomNo=$RoomNo'</script>";die;
}
if(($n =="")||($ic =="")||($c =="")){
			echo "<script>alert('Please fill in your form completely')</script>";
		echo "<script language='javascript'>window.location='bookroom1.php?RoomNo=$RoomNo'</script>";die;
}
if(($q1 != "") &&($q2 != "") ){


echo "
<br><br>

<form method=post action=http://www.wauhaha.com/karaoke/sextend3.php?RoomNo=$RoomNo>

<table align=center style='font-family:verdana;font-size:14pt'>	
	<tr>
		<td width=200 align=center>Transaction ID :</td>  
		<td width=100 align=center>";include('broomtran.php'); echo"</td>
	</tr>
	<tr>
		<td width=150 align=center>Room No :</td>  
		<td width=200 align=center>$RoomNo</td>
	</tr>
	<tr>
		<td width=150 align=center>Room Type :</td>  
		<td width=200 align=center>$rt <input type=hidden name=rt value=".$rt."></td>
	</tr>
			<tr>
		<td width=150 align=center>Name :</td>
		<td width=200 align=center>$n <input type=hidden name=n value=".$n."></td>
	</tr>
			<tr>
		<td width=150 align=center>IC :</td>
		<td width=200 align=center>$ic <input type=hidden name=ic value=".$ic."></td>
	</tr>
			<tr>
		<td width=150 align=center>Contact :</td>
		<td width=200 align=center>$c <input type=hidden name=c value=".$c."></td>
	</tr>
		<tr>
		<td width=150 align=center>Date :</td>
		<td width=200 align=center>$d <input type=hidden name=d value=".$d."></td>
	</tr>
		<tr>
		<td width=150 align=center>Book Time :</td>
		<td width=200 align=center>$t <input type=hidden name=t value=".$t."></td>
	</tr>
		
	<tr>
		<td width=150 align=center>Hours:</td>
		<td width=200 align=center>$h Hours<input type=hidden name=h value=".$h."></td>
	</tr>
	<tr>
		<td width=150 align=center>Normal :</td>  
		<td width=200 align=center>$q1 People's'  * <u>Rm$p1  <input type=hidden name=q1 value=".$q1."><input type=hidden name=p1 value=".$p1."></u></td>
	</tr>
		<tr>
		<td width=150 align=center>Student :</td>  
		<td width=200 align=center>$q2 People's'  * <u>Rm$p2 <input type=hidden name=q2 value=".$q2."><input type=hidden name=p2 value=".$p2."></u></td>
	</tr>
		<tr>
		<td width=150 align=center>Total Price:</td>  
		<td width=200 align=center><u>Rm$tp3 <input type=hidden name=tp3 value=".$tp3."><input type=hidden name=tp2 value=".$tp2."><input type=hidden name=tp1 value=".$tp."></u></td>
	</tr>
	<tr>
		<td colspan=2 align=center><input type=submit Value=OK style='width:100;height:50'></td>
	</tr>
	
</table>
</form>
<center><button onclick='window.print()' style='width:100;height:50'>Print</button>	";die;
	
}
if($q2 == ""){


echo "
<br><br>

<form method=post action=http://www.wauhaha.com/karaoke/sextend3.php?RoomNo=$RoomNo>

<table align=center style='font-family:verdana;font-size:14pt'>	
	<tr>
		<td width=200 align=center>Transaction ID :</td>  
		<td width=100 align=center>";include('broomtran.php'); echo"</td>
	</tr>
	<tr>
		<td width=150 align=center>Room No :</td>  
		<td width=200 align=center>$RoomNo</td>
	</tr>
	<tr>
		<td width=150 align=center>Room Type :</td>  
		<td width=200 align=center>$rt <input type=hidden name=rt value=".$rt."></td>
	</tr>
			<tr>
		<td width=150 align=center>Name :</td>
		<td width=200 align=center>$n <input type=hidden name=n value=".$n."></td>
	</tr>
			<tr>
		<td width=150 align=center>IC :</td>
		<td width=200 align=center>$ic <input type=hidden name=ic value=".$ic."></td>
	</tr>
			<tr>
		<td width=150 align=center>Contact :</td>
		<td width=200 align=center>$c <input type=hidden name=c value=".$c."></td>
	</tr>
		<tr>
		<td width=150 align=center>Date :</td>
		<td width=200 align=center>$d <input type=hidden name=d value=".$d."></td>
	</tr>
		<tr>
		<td width=150 align=center>Book Time :</td>
		<td width=200 align=center>$t <input type=hidden name=t value=".$t."></td>
	</tr>
		<tr>
		<td width=150 align=center>Hours:</td>
		<td width=200 align=center>$h  Hours<input type=hidden name=h value=".$h."></td>
	</tr>
	<tr>
		<td width=150 align=center>Normal :</td>  
		<td width=200 align=center>$q1 People's'  * <u>Rm$p1  <input type=hidden name=q1 value=".$q1."><input type=hidden name=p1 value=".$p1."></u></td>
	</tr>

		<tr>
		<td width=150 align=center>Total Price:</td>  
		<td width=200 align=center><u>Rm$tp3 <input type=hidden name=tp1 value=".$tp."></u></td>
	</tr>
	<tr>
		<td colspan=2 align=center><input type=submit Value=OK style='width:100;height:50'></td>
	</tr>
	
</table>
</form>
<center><button onclick='window.print()' style='width:100;height:50'>Print</button>	";die;
	
}
if($q1 == ""){


echo "
<br><br>

<form method=post action=http://www.wauhaha.com/karaoke/sextend3.php?RoomNo=$RoomNo>

<table align=center style='font-family:verdana;font-size:14pt'>	
	<tr>
		<td width=200 align=center>Transaction ID :</td>  
		<td width=100 align=center>";include('broomtran.php'); echo"</td>
	</tr>
	<tr>
		<td width=150 align=center>Room No :</td>  
		<td width=200 align=center>$RoomNo</td>
	</tr>
	<tr>
		<td width=150 align=center>Room Type :</td>  
		<td width=200 align=center>$rt <input type=hidden name=rt value=".$rt."></td>
	</tr>
			<tr>
		<td width=150 align=center>Name :</td>
		<td width=200 align=center>$n <input type=hidden name=n value=".$n."></td>
	</tr>
			<tr>
		<td width=150 align=center>IC :</td>
		<td width=200 align=center>$ic <input type=hidden name=ic value=".$ic."></td>
	</tr>
			<tr>
		<td width=150 align=center>Contact :</td>
		<td width=200 align=center>$c <input type=hidden name=c value=".$c."></td>
	</tr>
		<tr>
		<td width=150 align=center>Date :</td>
		<td width=200 align=center>$d <input type=hidden name=d value=".$d."></td>
	</tr>
		<tr>
		<td width=150 align=center>Book Time :</td>
		<td width=200 align=center>$t <input type=hidden name=t value=".$t."></td>
	</tr>
		<tr>
		<td width=150 align=center>Hours:</td>
		<td width=200 align=center>$h Hours<input type=hidden name=h value=".$h."></td>
	</tr>
	<tr>
		<td width=150 align=center>Student :</td>  
		<td width=200 align=center>$q2 People's'  * <u>Rm$p2  <input type=hidden name=q2 value=".$q2."><input type=hidden name=p2 value=".$p2."></u></td>
	</tr>

		<tr>
		<td width=150 align=center>Total Price:</td>  
		<td width=200 align=center><u>Rm$tp3 <input type=hidden name=tp2 value=".$tp2."></u></td>
	</tr>
	<tr>
		<td colspan=2 align=center><input type=submit Value=OK style='width:100;height:50'></td>
	</tr>
	
</table>
</form>
<center><button onclick='window.print()' style='width:100;height:50'>Print</button>	";die;
	
}