<?php
ob_start();
session_start();
require_once("../conn/conn.php");
//include('../utility/chksession.php');
date_default_timezone_set("Asia/Bangkok");

$Cli_date=$_POST['Cli_date'];
$Item_id=$_POST['Item_id'];
//$Item_name=$_POST['Item_name'];
$Cli_code=$_POST['Cli_code'];
$Cli_ref=$_POST['Cli_ref'];
$Cli_record=$_POST['Cli_record'];

//echo $Cli_date;
//echo "item".$Item_id;
//echo "code".$Cli_code;
//echo "ref".$Cli_ref;
//echo "บันทึก".$Cli_record
//exit;


//$date = (date("Y")+543) ;
//date($Cli_date);

//$date1 =  date("Y-m-d");
//echo $date1; 

//$now = date("d")."/".date("m")."/".(date("Y")+543);
    //echo "วันนี้วันที่ ".$now;
    
    //exit;
    
    $strSQL = "SELECT * FROM qc_item where Item_id='$Item_id' ";
    $objQuery = mysqli_query($con,$strSQL);    
    $objResult = mysqli_fetch_array($objQuery);
    
    $Item_name=$objResult['Item_name'];
    echo $Item_name;
    
    
  
    $sql = "INSERT INTO `qc_checklistitem2` (`Cli_date`, `Item_id`,`Item_name`,
    `Cli_code`,`Cli_ref`,`Cli_record`,`Cli_daterecord`) 
    VALUES ('$Cli_date', '$Item_id', '$Item_name', '$Cli_code', '$Cli_ref', '$Cli_record', NOW())";
	$query = mysqli_query($con,$sql);
        if($query){
            ?>
                <script language="JavaScript" type="text/javascript">
                    <!--
                    alert("บันทึกข้อมูลเรียบร้อย");
                    location.href='../admin/data_sniftest.php';
                    //-->
                </script>
            <?php
        }else{
            
            echo "Error: " . $sql . "<br>" . mysqli_error($con);

        }
        mysqli_close($con);





?>