<?php
ini_set('display_errors', 0);
//error_reporting(E_ALL);
//ini_set('display_errors', 1);

session_start();
ob_start();

require_once('configuration/server_connect.php');
require_once('configuration/all_function.php');

$order_no = $_REQUEST['order_no'];
$total_unit = $_REQUEST['total_unit'];
$flag = $_REQUEST['flag'];

		
		
if($total_unit==0){
$sql_del = 'delete from milk_record where id="'.$order_no.'"';
mysqli_query($conn,$sql_del);
}	
		
		
		


$entry_by=$_SESSION['user']['id'];
$entry_at=date('Y-m-d H:i:s');

$up_sql = 'update milk_record  set total_unit="'.$total_unit.'", 
 edit_by="'.$entry_by.'", edit_at="'.$entry_at.'"  where id='.$order_no;
mysqli_query($conn,$up_sql);



//if($day_count>0){
//$ins_sql = 'INSERT INTO  employee_daily_attendance (emp_code, tr_no, att_date, mon, year, schedule_intime, att_hour, att_min, att_intime, att_datetime,  entry_at, entry_by, late_min, grace_no, duty_type, day_count, remarks, grace_time, grace_time_no) VALUES
//("'.$emp_code.'", "'.$tr_no.'", "'.$att_date.'", "'.$mon.'", "'.$year.'", "'.$schedule_intime.'",  "'.$hour.'",  "'.$minute.'", "'.$access_time.'", "'.$access_datetime.'", "'.$entry_at.'", "'.$entry_by.'", "'.$late_min.'", "'.$grace_no.'", "'.$duty_type.'", "'.$day_count.'", "'.$remarks.'", "'.$grace_time.'", "'.$grace_time_no.'")';
//	
//mysqli_query($conn,$ins_sql);
//}


echo 'Success!';
?>