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


$order_no = $_GET['order_no_text'];
$order_book_no = $_GET['order_book_no_text'];

$table_name = $_SESSION['db_prefix']."_install_orders";
$saved_order_book_no_query = "SELECT order_book_no FROM $table_name WHERE order_no = '".$order_no."' ";
$saved_order_book_no_result = mySQL_query($saved_order_book_no_query);
$saved_order_book_no = mysql_result($saved_order_book_no_result, 0, "order_book_no");


$table_name = $_SESSION['db_prefix']."_install_orders";
$order_no_query = "UPDATE $table_name SET order_book_no = '".$order_book_no."' WHERE order_no = '".$order_no."' ";
execsql($order_no_query);


if ($saved_order_book_no!=$order_book_no) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
	    $trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '55', '".$order_no."' ,'".$saved_order_book_no."','".$order_book_no."','Book order no' )";
		$trackingResult = mySQL_query($trackingQuery);
}

?>

       <script>
	 		 window.location="../sales/install_order_display.php?order_no=<?php echo $order_no ?> ";
		</script>


