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

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

$job_card_no = $_GET['job_card_no'];

$table_name = $_SESSION['db_prefix']."_mworks_jobs";
$job_query = "SELECT cust_id   FROM $table_name WHERE job_card_no = '".$job_card_no."'  ";
$job_result = mySQL_query($job_query);
$cust_id = mysql_result($job_result, 0, "cust_id");

$table_name = $_SESSION['db_prefix']."_mworks_jobs";
$void_query = "UPDATE $table_name SET captured = 'void', compiled = 'void', completion_date = '".$entry_date."'  WHERE job_card_no = '".$job_card_no."' ";
execsql($void_query);


$table_name = $_SESSION['db_prefix']."_tracking_production";
$trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '109', '','".$cust_id."','voided','".$job_card_no."' )";
$trackingResult = mySQL_query($trackingQuery);

?>

<script language="javascript" type="text/javascript">
          window.location="production_main.php";
</script>