<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../index.html'; </script>";
 return;
}
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
	tr{background-color:white}
	th{background-color:steelblue;color:white}
</style>
<center>

<form action='<?print $PHP_SELF?>'>
<input type=hidden name='itcode' value='<?print $itcode?>'>
<input type=hidden name='ordno' value='<?print $ordno?>'>
<table>
<tr><td>Reason </td><td><select name='reas'>
<option>Not available in Branch</option>
<option>Not available in Telcon</option>
<option>Not available in PSN</option>
<option>High Price</option>
<option>Err</option>
</select>
</td>
<td><input type=submit value='Short close now' name='cls'></td></tr>
</table>
</form>

<?
if($cls)
{
include("../opendb.php");
include("../test.php");
$cldate=date("Y-m-d");
$sql="update purorder_spare set closed='Y',reas='$reas',cldate='$cldate' where partcode='$itcode' and orderno='$ordno' and brcode='$brcode'";
mysqli_query($db,$sql) or die(mysqli_error());
print "<script> alert('Item has been closed'); document.location='pur_orderview.php' </script>";
}
?>
