<?php
include('../include/session.php');
$today = date("Y-m-d");
date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$purchase_id = $_GET['purchase_id'];

$table_name = $_SESSION['db_prefix']."_purchase";
$void_query = "UPDATE $table_name SET authorised = 'void', authorised_date = '".$today."', authorised_by = '".$_SESSION['username']."' WHERE purchase_id = '".$purchase_id."' ";
execsql($void_query);

$table_name2 = $_SESSION['db_prefix']."_tracking_store";
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '187', '".$purchase_id."' , '','', '' )";
$trackingResult = mySQL_query($trackingQuery);	

?>

<script language="javascript" type="text/javascript">
          window.location="purchase_order.php?message=0&purchase_id=<?php echo $purchase_id ?>&message=6";
</script>