<?php 
include "config.php";
include "financial_year_calculation.php";
session_start();
$user=$_SESSION['log'];
$code = $_POST['code'];
$date = $_POST['date'];

$jaw_feeder_opening = $_POST['jaw_feeder_opening'];
$jaw_feeder_closing = $_POST['jaw_feeder_closing'];
$jaw_machine_opening=$_POST['jaw_machine_opening'];
$jaw_machine_closing=$_POST['jaw_machine_closing'];

$cone_feeder_opening = $_POST['cone_feeder_opening'];
$cone_feeder_closing = $_POST['cone_feeder_closing'];
$cone_machine_opening=$_POST['cone_machine_opening'];
$cone_machine_closing=$_POST['cone_machine_closing'];

$vsi_feeder_opening = $_POST['vsi_feeder_opening'];
$vsi_feeder_closing = $_POST['vsi_feeder_closing'];
$vsi_machine_opening=$_POST['vsi_machine_opening'];
$vsi_machine_closing=$_POST['vsi_machine_closing'];


$eb_opening = $_POST['eb_opening'];
$eb_closing = $_POST['eb_closing'];


$remark = $_POST['remark'];
$accountyear    = $financialYearStart."-".$financialYearEnd;
$year_code = substr($financialYearEnd,2);
$code_validate = mysqli_query($connect,"select count(code) as code from cash_handling where code='$code' && status!='deleted'");
$code_count=mysqli_fetch_assoc($code_validate);
$code_val = $code_count['code'];
if($code_val==0)
{
$sql = "INSERT INTO machine_units(date, code, jaw_feeder_opening, jaw_feeder_closing, jaw_machine_opening, jaw_machine_closing, cone_feeder_opening, cone_feeder_closing, cone_machine_opening, cone_machine_closing, vsi_feeder_opening, vsi_feeder_closing, vsi_machine_opening, vsi_machine_closing, eb_opening, eb_closing, user, time,financialyear, editdate, edittime, status) VALUES ('$date','$code', '$jaw_feeder_opening', '$jaw_feeder_closing', '$jaw_machine_opening', '$jaw_machine_closing', '$cone_feeder_opening', '$cone_feeder_closing', '$cone_machine_opening', '$cone_machine_closing', '$vsi_feeder_opening', '$vsi_feeder_closing', '$vsi_machine_opening', '$vsi_machine_closing', '$eb_opening', '$eb_closing','$user',CURRENT_TIME(),'$accountyear','','','')";
echo $sql;
 $go = mysqli_query($connect,$sql);
}
  header('Location:machine_units.php');

?>