<?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"/>
<link rel="stylesheet" type="text/css" href="paginate.css">
<!--form validation java script-->
<script type="text/javascript">
function validate_form()
{
	valid=true;
	
	if((document.loginForm.staffID.value=="")||(document.loginForm.staffPassword.value==""))
	{alert("Please fill your login details.");
		valid=false;}
	
}
</script>

<!--clock function-->
<script type="text/javascript">
function init ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("clock").appendChild ( timeDisplay );
}

function updateClock ( )
{
  var currentTime = new Date ( );

  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );

  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for display
  var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

// -->
</script>
</head>

<body onload="updateClock(); setInterval('updateClock()', 1000 )">

<table border="0" width="100%">

<tr>
<td><img src="Picture/Logo.gif"></td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td colspan="2"><h2>Daily Bookstore - Management System</h2></td>
<td align="right"><h3>Current Time:<span id="clock">&nbsp;</span></h3></td>
</tr>

<tr>
<td colspan="2"></td>
<td align="right" style="color:darkblue"><h3>You log in as:<span>
<?php
echo "<span style='color:black;font-weight:bold'>".$username."</span>";
?>
<a href="logout.php">(Logout)</a>
</h3>
</span>
</td>
</tr>

</table>

<table align="center" width="100%" border="0">

<tr>
<td>
<fieldset>
<legend><img src="Picture/gear.gif" width="40" height="40">Function List</legend>
<div class="toplink">

<!--function list-->
<?php
include ("stafffunction.php");
?>

<hr/>
<center>
<h2>Bookstore Online Order List</h2>

<form action="onlineorderlist.php" name="searchform" method="GET">
Search: <input type="text" size="100" name="keyword" value="Type your keyword here.">

<select name="searchBy">
	<option value="">Select One</option>
	<option value="cartNo">Cart No</option>
	<option value="cartName">Buyer Name</option>
	<option value="cartDate">Submit Date</option>
	</select>

<input type="submit" name="search" value="Search"><input type="submit" name="reset" value="Reset Result">
</form>
</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/bill.gif" width="30" height="30">Manage Bill</legend>
<table>
<tr>
<td valign="top">
<a href="onlineorderlist.php"><img src="Picture/onlineorder.gif" width="30" height="30" alt="manage online order"><a href="onlineorderlist.php">Online Order</a><br/>
<br/>
<a href="deliveryorderlist.php"><img src="Picture/do.gif" width="30" height="30" alt="manage delivery order"><a href="deliveryorderlist.php">Delivery Order</a><br/>
<br/>
<a href="salesorder.php"><img src="Picture/salesorder.gif" width="30" height="30" alt="manage sales order"><a href="salesorder.php">Sales Order</a><br/>
<br/>
<a href="invlist.php"><img src="Picture/invoice.gif" width="30" height="30" alt="manage invoice"><a href="invlist.php">Invoice</a>
</td>
</tr>
</table>
</fieldset>
</td>
<td width="75%">
<?php
include("onlinelist.php");
?>
</td>
</tr>
</table>
</div>
</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>