<?php
session_start();
$username = $_SESSION['staff'];

include ("connect.php");
	$staffID = $_POST["staffID"];
	$salaryslipName = $_POST["salaryslipName"];
	
	
	if($_POST["Save"] == "Save")
	{
	$result = mysql_query("UPDATE salaryslip SET salaryslipName = '$salaryslipName', salaryslipAuthor = '$salaryslipAuthor', salaryslipPublisher = '$salaryslipPublisher', salaryslipDate = '$salaryslipDate', salaryslipCategory = '$salaryslipCategory', salaryslipMin = '$salaryslipMin', salaryslipPrice = '$salaryslipPrice', salaryslipSummary = '$salaryslipSummary', salaryslipLocation = '$salaryslipLocation', salaryslipMin = '$salaryslipMin' WHERE staffID = '$staffID'");
	
	$db = mysql_close();
	echo "<script language='javascript'>alert('Book Edit Success.')</script>";
	echo "<script language='javascript'>window.location='book.php'</script>";
}
if($_SESSION['staff']!= null)
{
?>
	
<html>
<head>
<title>Daily Bookstore - Management System</title>
<!--include css file-->
<link href="bookstaff.css" rel="stylesheet" type="text/css"/>
</head>

<body>

<?php
include ("stafffunctionbar.php");
?>
</div>
</fieldset>
</td>
</tr>
</table>

</center>

<hr/>
<center>
<h2>Daily Bookstore Management - Manage Book</h2>
</center>

<div id="mainpage">
<table width="90%">
<tr>
<td width="15%" valign="top">
<fieldset style="margin:0 5 0 0">
<legend><img src="Picture/salary.gif" width="30" height="30">Salary</legend>
<table>
<td valign="top">
<a href="salarylist.php"><img src="Picture/salary.gif" width="30" height="30" alt="EPF"><a href="salarylist.php">Salary List</a><br/>
<br/>
<a href="addsalary.php"><img src="Picture/addsalary.jpg" width="30" height="30" alt="EPF"><a href="addsalary.php">Add Salary</a><br/>
<br/>
<a href="editepf.php"><img src="Picture/epf.gif" width="30" height="30" alt="EPF"><a href="editepf.php">EPF</a><br/>
<br/>
<a href="socsolist.php"><img src="Picture/socso.gif" width="30" height="30" alt="Socso"><a href="socsolist.php">Socso</a><br/>
</td>
</tr>
</table>
</fieldset>
</td>

<td width="75%">
<center>
<form name="addbook" method="post" enctype="multipart/form-data">
<fieldset style="width:80%">
<legend><img src="Picture/salary.gif" width="30" height="30">Edit Salary</legend>

<table align="center">

<?php
include("connect.php");
$staffID=$_GET['staffID'];
$result = mysql_query("SELECT * FROM salaryslip WHERE staffID = '$staffID'");


$row = mysql_fetch_array($result);

echo "<tr>";
echo "<td>staffID: </td>";
echo "<td><input type='hidden' name='staffID' value='$row[staffID]'>$row[staffID]";
echo "<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;staffID cannot edited.</font>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td>Slip No: </td>";
echo "<td><input type='hidden' name='slipNo' value='$row[slipNo]'>$row[slipNo]";
echo "<font color='red'>&nbsp;&nbsp;&nbsp;slipNo cannot edited.</font>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td>Staff Name: </td>";
echo "<td><input type='text' name='staffName' size='20' maxlength='20' value='$row[staffName]'></td>";
echo "</tr>";

echo "<tr>";
echo "<td>Working Hour: </td>";
echo "<td><input type='text' name='staffHour' size='20' maxlength='20' value='$row[staffHour]'></td>";
echo "</tr>";

echo "<tr>";
echo "<td>Overtime: </td>";
echo "<td><input type='text' name='staffOT' size='20' maxlength='20' value='$row[staffOT]'></td>";
echo "</tr>";

echo "<tr>";
echo "<td>Salary: </td>";
echo "<td><input type='text' name='staffSalary' size='20' maxlength='20' value='$row[staffSalary]'></td>";
echo "</tr>";

echo "<tr>";
echo "<td>Bonus: </td>";
echo "<td><input type='text' name='staffBonus' size='20' maxlength='20' value='$row[staffBonus]'></td>";
echo "</tr>";

echo "<tr>";
echo "<td>EPF: </td>";
echo "<td><input type='text' name='staffEPF' size='20' maxlength='20' value='$row[staffEPF]'></td>";
echo "</tr>";

echo "<tr>";
echo "<td>Socso: </td>";
echo "<td><input type='text' name='staffSocso' size='20' maxlength='20' value='$row[staffSocso]'></td>";
echo "</tr>";

echo "<tr>";
echo "<td colspan='4' align='center'><input type='submit' name='Save' value='Save'></td>";
echo "</tr>";
echo "</table>";
?>
</fieldset>
</form>
</center>
</body>
</html>
<?php
}else{
	echo "<script language='javascript'>alert ('Please login.')</script>";
	echo "<script language='javascript'>window.location='index.php'</script>";
}
?>