<?php

include "../../root.class.php";


$db = new db_safeguard();
if (isset($_FILES['signature'])) {
    move_uploaded_file($_FILES['signature']['tmp_name'], "signatures/quality_control_" . date("Y_m_d_h_i") . '_' . $_FILES['signature']['name']);
    $file_name = "signatures/quality_control_" . date("Y_m_d_h_i") . '_' . $_FILES['signature']['name'];
}

if (
    $quality_process_control_id = $db->query('', "INSERT INTO `sorting_quality_control`(`sorting_id`, `date_time`, `shift`, `sample_size`, `product_samples_point`, `mouldy_kernal`, `germinated_kernal`, `insect_damaged`, `rancid_smell_kernal`, `foreign_matter`, `shell_in_kernal`, `uncracked_nuts`, `crushed_missing_kernal`, `moisture`, `env_temperature`, `env_humidity`, `magnet_inspection`, `person_inspecting`, `signature`) VALUES ('{$_POST['sorting_id']}','{$_POST['date_time']}','{$_POST['shift']}','{$_POST['sample_size']}','{$_POST['product_samples_point']}','{$_POST['mouldy_kernal']}','{$_POST['germinated_kernal']}','{$_POST['insect_damaged']}','{$_POST['rancid_smell_kernal']}','{$_POST['foreign_matter']}','{$_POST['shell_in_kernal']}','{$_POST['uncracked_nuts']}','{$_POST['crushed_missing_kernal']}','{$_POST['moisture']}','{$_POST['env_temperature']}','{$_POST['env_humidity']}','{$_POST['magnet_inspection']}','{$_POST['person_inspecting']}','$file_name')

")
) {



    echo 1;
} else {
    echo 0;
}

