<?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("cracking_quality_process_control", "INSERT INTO `cracking_quality_process_control` (`shift`, `sample_size`, `product_sample_point`, `wholes`, `halves`, `dust`, `shells`, `broken_chipped`, `shell_in_kernal`, `uncracked_missing_kernal`, `moisture`, `env_temperature`, `env_humidity`, `magnet_inspection`, `person_inspection`, `cracking_signature`, `cracking_id`) VALUES ('{$_POST['shift']}', '{$_POST['sample_size']}', '{$_POST['product_samples_point']}', '{$_POST['whole']}', '{$_POST['half']}', '{$_POST['dust']}', '{$_POST['shells']}', '{$_POST['broken_chipped']}', '{$_POST['shell_in_kernal']}', '{$_POST['crushed_missing_kernal']}', '{$_POST['moisture']}', '{$_POST['env_temperature']}', '{$_POST['env_humidity']}', '{$_POST['magnet_inspection']}', '{$_POST['person_inspecting']}', '$file_name', '{$_POST['cracking_id']}')

")
) {
    echo 1;
} else {
    echo 0;
}

