<?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 `lop_quality_process_control`(`date_time`, `shift`, `sample_size`, `trolley_number`, `trolley_position`, `mouldy_kernal`, `rancid_kernal_smell`, `kernal_moisture`, `env_temperature`, `env_humidity`, `discolouration`, `person_inspecting`, `signature`, `lop_id`) VALUES (NOW(),'{$_POST['shift']}',{$_POST['sample_size']},'{$_POST['trolley_number']}','{$_POST['trolley_position']}','{$_POST['mouldy_kernal']}','{$_POST['rancid_kernal_smell']}','{$_POST['kernal_moisture']}','{$_POST['env_temperature']}','{$_POST['env_humidity']}','{$_POST['discolouration']}','{$_POST['person_inspecting']}','$file_name','{$_POST['lop_id']}')")) {



    echo 1;
} else {
    echo 0;
}

