<?php
session_start();

include "../functions.php";
checkAdmin(session_id());

include "header.php";
?>

<center>
<table width=80% cellspacing=1 cellpadding=3 border=0>
<form action=report.php method=post name=form1 target=_blank>
<tr>
<td width=1% nowrap><b>From:</b><br><input type="text" size=10 name="from" readonly onfocus='popUpCalendar(this, form1.from, "yyyy-mm-dd")'></td>
<td width=1% nowrap><b>To:</b><br><input type="text" size=10 name="to" readonly onfocus='popUpCalendar(this, form1.to, "yyyy-mm-dd")'></td>
<td width=1% nowrap><b>Type:</b><br><?php movetype() ?></td>
<td width=1% nowrap><b>Staff:</b><br><?php staff() ?></td>
<td width=1% nowrap valign=bottom><input type=submit value="Generate Report"></td>
<td>&nbsp;</td>
</tr>
</form>
</table>
</center>
<?php
include "footer.php";

function movetype()
{
	echo "<select name=\"typeid\">
		<option value=0>All Types</option>";
	$query = "select typeid, typename from movetype";
	$result = mysql_query($query) or die (mysql_error());
	while ($row = mysql_fetch_array($result))
	{
		$typeid = $row[0];
		$typename = $row[1];
		echo "<option value=\"$typeid\">$typename</option>";
	}
	echo "</select>";
}

function staff()
{
	echo "<select name=\"staffid\">
		<option value=0>All Staffs</otion>";
	$query = "select staffid, firstname, lastname from staff order by firstname asc";
	$result = mysql_query($query) or die (mysql_error());
	while ($row = mysql_fetch_array($result))
	{
		$staffid = $row[0];
		$name = $row[1] . "," . $row[2];
		echo "<option value=\"$staffid\">$name</option>";
	}
	echo "</select>";
}
?>