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



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

$production_no = $_GET['production_no'];
$production_date = $_GET['production_date'];
$mix_design_no = $_GET['mix_design_id_select'];
$qty = $_GET['qty_text'];

$table_name = $_SESSION['db_prefix']."_store_items";
$name_query = "SELECT item_name FROM $table_name WHERE mix_design_id = '".$mix_design_no."'  ";
$name_result = mySQL_query($name_query);
$mix_design_name = mysql_result($name_result, 0, "item_name");


$table_name = $_SESSION['db_prefix']."_production_plan_lines";
$add_query = "INSERT INTO $table_name (production_no, mix_design_no, mix_design_name, skip_quantity, production_date) VALUES ('".$production_no."', '".$mix_design_no."', '".$mix_design_name."', '".$qty."', '".$production_date."') ";
execsql($add_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']."', '70', '".$production_no."' , '".$mix_design_no."', '".$mix_design_name."', '".$qty."' )";
execsql($trackingQuery);


?>


<script language="javascript" type="text/javascript">
      //   window.location="../production/production_plan_edit.php?production_no=<?php echo $production_no ?>&e=";
</script>