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

if($_SESSION['staff']!= null)
{
?>
	
<html>
<head>
<title>Daily Bookstore - Management System</title>
<!--include css file-->
<link href="bookstaff.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="calendar.js"></script>
<script type="text/javascript" src="calendar-setup.js"></script>
<script type="text/javascript" src="calendar-en.js"></script>
<style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>
</head>

<body>

<?php
include ("stafffunctionbar.php");
?>

<center>
<h2>Add New Staff</h2>
</center>

<center>
<div id="mainpage">
<table width="90%">
<tr>
<td width="15%" valign="top">
<fieldset style="margin:0 5 0 0">
<legend><img src="Picture/admin.gif" width="30" height="30">Admin Control</legend>
<table>
<tr>
<td valign="top">
<a href="stafflist.php"><img src="Picture/list.gif" width="30" height="30" alt="admin control"><a href="stafflist.php">Staff List</a><br/>
<br/>
<a href="addstaff.php"><img src="Picture/addadmin.gif" width="30" height="30" alt="add staff"><a href="addstaff.php">Add Staff</a><br/>
<br/>
</td>
</tr>
</table>
</fieldset>
</td>

<td width="75%">

<form name="form" method="post" action="addstaffaction.php">
<fieldset style="width:80%">
<legend><img src="Picture/addadmin.gif" width="30" height="30" alt="add staff">New Employee Register Form</legend>
<br/>
<table align="center" width="70%">
<tr>
<td>Staff ID: </td>
<td><input type="text" name="staffID" size="7" maxlength="7"/></td>
</tr>

<tr>
<td>Name: </td>
<td><input type="text" name="staffName" size="50" maxlength="50"></td>
</tr>

<tr>
<td>Address: </td>
<td><input type="text" name="staffAddress" size="50" maxlength="100"></td>
</tr>

<tr>
<td>Phone No: </td>
<td><input type="text" name="staffPhone" size="20" maxlength="15"></td>
</tr>

<tr>
<td>Email: </td>
<td><input type="text" name="staffEmail" size="30" maxlength="30"></td>
</tr>

<tr>
<td>DOB: </td>
<td><input type="text" id="cal-field-1" name="staffDOB"/>
			<button type="submit" id="cal-button-1">Date</button>
			<script type="text/javascript">
			Calendar.setup({
			inputField : "cal-field-1",
			button : "cal-button-1",
			align : "Tr"
			});
			</script></td>
</tr>

<tr>
<td>IC NO.: </td>
<td><input type="text" name="staffIC" size="20" maxlength="12"></td>
</tr>

<tr>
<td>Gender: </td>
<td><input type="radio" name="staffSex" value="M"/>Male &nbsp;&nbsp;
<input type="radio" name="staffSex" value="F"/>Female</td>
</tr>

<tr>
<td>Race: </td>
<td><select name="staffRace"><option value="0">Choose One</option>
<option value="Chinese">Chinese</option>
<option value="Malay">Malay</option>
<option value="Indian">Indian</option>
<option value="Others">Others</option>
</select>
</td>			
</tr>

<tr>
<td>Marital: </td>
<td><input type="radio" name="staffMarital" value="Y"/>Yes &nbsp;&nbsp;
<input type="radio" name="staffMarital" value="N"/>No</td>
</tr>

<tr>
<td>Job Title: </td>
<td><input type="text" name="staffJobTitle" size="20" maxlength="20"></td>
</tr>

<tr>
<td>Job Category: </td>
<td><select name="staffCategory"><option value="0">Choose One</option>
<option value="IT Staff">IT Staff</option>
<option value="Cashier">Cashier</option>
<option value="Stock Control">Stock Control</option>
<option value="Management">Management</option>
</select>
</td>			
</tr>

<tr>
<td>Date Join: </td>
<td><input type="text" name="staffDateJoin" size="20" maxlength="20"></td>
</tr>

<tr>
<td>Base Salary: RM </td>
<td><input type="text" name="staffSalary" size="10" maxlength="5"></td>
</tr>

<tr>
<td>Bank: </td>
<td><select name="staffBank"><option value="0">Choose One</option>
<option value="Maybank">Maybank</option>
<option value="CIMB">CIMB</option>
<option value="RHB">RHB</option>
<option value="Hong Leong">Hong Leong</option>
<option value="Other">Other</option>
</select>
</td>
</tr>

<tr>
<td>Bank Account No.: </td>
<td><input type="text" name="staffAccount" size="20" maxlength="20"></td>
</tr>

<tr>
<td>EPF: </td>
<td><input type="text" name="staffEPF" size="20" maxlength="20"></td>
</tr>

<tr>
<td>Socso: </td>
<td><input type="text" name="staffSocso" size="20" maxlength="20"></td>
</tr>

<tr>
<td>PCB: </td>
<td><input type="text" name="staffPCB" size="20" maxlength="20"></td>
</tr>

<tr>
<td>Pay Leave Hour: </td>
<td><input type="text" name="staffPayLeave" size="20" maxlength="20"></td>
</tr>

<tr>
<td>Password: </td>
<td><input type="text" name="staffPassword" size="20" maxlength="20"></td>
</tr>

<tr>
<td>Status: </td>
<td><select name="staffstatus"><option value="Available">Availbale</option>
<option value="Cancel">Cancel</option>
</select>
</td>			
</tr>

<tr>
<td colspan="2" align="center"><input type="button" name="Save" value="Save" 
onclick='submitcheck(staffID.value,staffAddress.value,staffPhone.value,staffEmail.value,staffDOB.value,staffIC.value,
staffSex.value,staffRace.value,staffMarital.value,staffJobTitle.value,staffCategory.value,staffDateJoin.value,
staffSalary.value,staffBank.value,staffAccount.value,staffEPF.value,staffSocso.value,staffPassword.value
)'></td>
</tr>
</table>

</fieldset>
</form>

</td>
</tr>
</table>

<script language="Javascript">
	function submitcheck(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s){
	if((a=="")||(b=="")||(c=="")||(d="")||(e="")||(f=="")||(g=="")||(h="")||(i="")||(j=="")||(k=="")||(l="")||(m="")||(n=="")||(o=="")||(p="")||(q="")||(r="")||(s="")){
	alert("Please check your staff information.");
	}else{
	this.form.submit();
	}
}
</script>

</center>

<?php
}else{
	echo "<script language='javascript'>alert ('Please login.')</script>";
	echo "<script language='javascript'>window.location='index.php'</script>";
}
?>
<hr/>

<center>
<div id="bottom">
<br/>
Copyright &#169; with Tian Tian Bookstore 2011. All Rights Reserved.
<br/>
Website:<a href="../bookstore" target="_blank">www.dailybook.com.my
</div>
</center>

</body>
</html>