<html>
<head>
<title>
Admin View Salary
</title>
</head>
<body style="background-color: #ffffff;background-image:url(rail.jpg);background-repeat: repeat-y">
<center>
<?php include('link.php');?><h2>Admin View Salary</h2>
</center>
<center><a href=salary.php><img src=back.jpg width=40 height=40></a>
<?php
$date = date("m/y",time());
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	
$time = date ('Y-m-d');
$StaffID=$_GET['StaffID'];


$result2 = mysql_query("SELECT * FROM staff Where StaffID='$StaffID' ");
$result1 = mysql_query("SELECT * FROM salary  Where StaffID='$StaffID' ");


echo "<form action='http://www.wauhaha.com/karaoke/printsalary.php?StaffID=$StaffID' method=post>
	<table border=3 align=center style ='font-family:Arial, Helvetica, sans-serif;font-size:1em' color='blue' bordercolorlight='tan' cellspacing=0 cellpadding=4>
 <tr bgcolor=lightblue >

	<th>Staff ID</th>
	<th>Username</th>
	<th>Name</th>
	<th>Salary</th>
	<th>Overtime</th>
	<th>Leave</th>
	<th>Epf</th>
	<th>Socso</th>
	<th>Total Salary</th>
	<th>Date</th>
	<th colspan=2>Funtion</th>
 </tr>";
 $row1 = mysql_fetch_array($result1);
 $row2 = mysql_fetch_array($result2);
$Username = $row2['Username'];
$position = $row1['position'];
$salary = $row1['Salary'];
$re = mysql_query("select rate from socso where '$salary' between mins and maxs");
$r = mysql_fetch_array($re);
$result3 = mysql_query("SELECT * FROM salaryrate where position='$position' ");
$result4 = mysql_query("SELECT * FROM leave2 where id='$Username' ");
 $row4 = mysql_fetch_array($result4);
$row3 = mysql_fetch_array($result3);
  echo"<tr align='center' border=1>";

  echo "<td>".$row2['StaffID']."</td>";	
  echo "<td border=1>".$row2['Username']."</td>";
  echo "<td border=1>".$row2['Name']."</td>";
    

  $StaffID=$row2['StaffID'];
  
  
  echo "<td>".$row1['Salary']."</td>";


  echo "<td border=1>".$row3['overtime']." * <input type=text name=hours size=5 maxlength=2>(hours)</td>";
  echo "<td>".$row4['l']." Hours<input type=hidden name=l value=".$row4['l']."></td>";
  

  echo "<td border=1>".$row1['Epf']."</td>";
  echo "<td border=1>".$r['rate']."</td>";
  echo "<td border=1>".$row1['TSalary']."</td>";
 
   echo "<td>$time <input type=hidden name=t value=".$time.">
			</td>";

   echo "<td><input type=submit value=OK></td>";
   echo "</tr>";
 
 

   echo "</form>";
   echo "</table>";

   mysql_close($login);
?>
<?php 
echo "<br><br><br><br>";
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	
	
$result4 = mysql_query("select * from salarystatement where StaffID='$StaffID' order by Date DESC");
 
echo "<table border=3 align=center style ='font-family:Arial, Helvetica, sans-serif;font-size:1em' color='blue' bordercolorlight='tan' cellspacing=0 cellpadding=4>
 <tr bgcolor=lightblue >	

	<th>No</th>
	<th>Staff ID</th>
	<th>Username</th>
	<th>Name</th>
	<th>Salary</th>
	<th>Overtime</th>
	<th>Unpaid Leave </th>
	<th>Epf</th>
	<th>Com Epf</th>
	<th>Socso</th>
	<th>Total Salary</th>
	<th>Date</th>";



while($row4 = mysql_fetch_array($result4)){

echo "<tr>";
echo "<td>".$row4['SalaryID']."</td>";	
echo "<td>".$row4['StaffID']."</td>";
echo "<td>".$row4['Username']."</td>";	
echo "<td>".$row4['Name']."</td>";	
echo "<td>".$row4['Salary']."</td>";	
echo "<td>".$row4['Overtime']."</td>";	
echo "<td>".$row4['l']."</td>";	
echo "<td>".$row4['EPF']."</td>";	
echo "<td>".$row4['EPF1']."</td>";	
echo "<td>".$row4['socso']."</td>";	
echo "<td>".$row4['TotalSalary']."</td>";	
echo "<td>".$row4['Date']."</td>";	


}
?>
</body>
</html>