<?php
session_start();

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

$moveid = $_GET["moveid"];

$query = "select movetitle, startdate, movedetail, stopdate from move where moveid='$moveid'";

$result = mysql_query($query) or die (mysql_error());

if ($row = mysql_fetch_array($result))
{
	$movetitle = $row[0];
	$movedate = $row[1];
	$movedetail = $row[2];
}

$query = "select firstname, lastname from staff, move_staff where move_staff.moveid='$moveid' and move_staff.staffid=staff.staffid";
$result = mysql_query($query) or die (mysql_error());
if ($row = mysql_fetch_array($result))
{
	$name = $row[0] . "," . $row[1];
}

$query = "select movetype.typename from movetype, move_type where move_type.moveid='$moveid' and move_type.typeid=movetype.typeid";
$result = mysql_query($query) or die (mysql_error());
if ($row = mysql_fetch_array($result))
{
	$typename = $row[0];
}
?>

<html><head><title>Staff Movement Detail</title></head><body>
<center>
  <table width=80% cellspacing=0 cellpadding=5 border=0>
    <tr>
	    <td align="left" colspan=2 width=100%>
	    <table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img src="../img/logo.jpg" width=96 height=61></td><td><form action="javascript: window.print(1);"><input type="image" src="../img/print.jpg" value="Print"></td></form><td><form action="javascript: window.close();"><input type="image" src="../img/close.jpg" value="Close"></td></form></tr></table>
	</td>
    </tr>
    <tr>
      <td width="1%" nowrap style="font-weight: bold">Date</td><td><?php echo $movedate; ?></td>
    </tr>
    
    <tr>
      <td width="1%" nowrap style="font-weight: bold">Title</td><td><?php echo $movetitle; ?></td>
    </tr>
    
    <tr>
      <td width="1%" nowrap style="font-weight: bold">Type</td><td><?php echo $typename; ?></td>
    </tr>
    
    <tr>
      <td width="1%" nowrap style="font-weight: bold">Staff</td><td><?php echo $name; ?></td>
    </tr>
    
    <tr>
      <td width="1%" nowrap style="font-weight: bold" valign=top>Detail</td><td><?php echo $movedetail; ?></td>
    </tr>
  </table>
</center>
</body>
</html>