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

<h1 align=center>View Approved Leave</h1>
<h4><a href='http://www.wauhaha.com/karaoke/vleave.php?<?php $Username=$_GET['Username']; echo "Username=$Username"; ?>'><img src=back.jpg width=40 height=40></a></a>&nbsp;&nbsp;
<h4><a href='http://www.wauhaha.com/karaoke/sleave.php?<?php $Username=$_GET['Username']; echo "Username=$Username"; ?>'>Apply Leave</a>&nbsp;&nbsp;
<a href='http://www.wauhaha.com/karaoke/sviewleave.php?<?php  echo "Username=$Username"; ?>'>Applied Leave</a>&nbsp;&nbsp;
<a href='http://www.wauhaha.com/karaoke/vappleave.php?<?php  echo "Username=$Username"; ?>'>Approved Leave</a></h4>


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

$result = mysql_query("select * from lapp where id='$Username'");
if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
$start_from = ($page-1) * 5; 
$result2 = mysql_query("SELECT * FROM lapp where id='$Username' ORDER BY no ASC LIMIT $start_from,5");
$sql = mysql_query("select COUNT(*) From lapp");  

$row=mysql_fetch_array($sql);
$total_records = $row[0];
$total_pages = ceil($total_records / 5);
echo "<center>";
for ($i=1; $i<=$total_pages; $i++) { 
	echo "<a href='vappleave.php?page=".$i."&Username=$Username'>&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 align=center>ID</th>
					<th align=center>Start Date</th>
					<th align=center>End Date</th>
					<th align=center>Start Time</th>
					<th align=center>End Time</th>
					<th align=center>Total Hours</th>
					<th align=center>Reason</th>
					<th align=center>Apply Date</th>
					<th align=center>Leave Remain</th>
					
 </tr>";
 while($r=mysql_fetch_array($result)){
 $no = $r['no'];
 echo "<tr>
		
			<td align=center>".$r['id']."</td>
			<td align=center>".$r['sd']."</td>
			<td align=center>".$r['ed']."</td>
			<td align=center>".$r['sh']."</td>
			<td align=center>".$r['eh']."</td>
			<td align=center>".$r['h']."</td>
			<td align=center>".$r['re']."</td>
			<td align=center>".$r['Date']."</td>
			<td align=center>".$r['lr']."</td>
		
 </tr>";
 }













?>