<?php
include('../include/session.php');

$user_id = $_SESSION['username'];
date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$order_reference = $_GET['order_reference'];
$delivery_date = $_GET['delivery_date'];
$new_delivery_date = $_GET['new_delivery_date'];

$table_name = $_SESSION['db_prefix']."_orders";
$update_query = "UPDATE $table_name SET delivery_date = '".$new_delivery_date."' WHERE order_reference = '".$order_reference."' ";
execsql($update_query);

$table_name = $_SESSION['db_prefix']."_tracking_orders";
$trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '47', '".$order_reference."', '".$delivery_date."','".$new_delivery_date."', '' )";
$trackingResult = mySQL_query($trackingQuery);

?>


<script language="javascript" type="text/javascript">
          window.location="../store/outstanding_orders_list.php?order_reference=<?php echo $order_reference?>";
</script>
