<?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['id'];
 $unit_price = $_REQUEST['unit_price'];
 $total_unit = $_REQUEST['total_unit'];
 $total_amt = $_REQUEST['total_amt'];
 
 $flag = $_REQUEST['flag'];

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


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


if($total_unit>0) {
$up_sql = 'update cattle_medicine_issue  set unit_price="'.$unit_price.'", total_unit="'.$total_unit.'", total_amt="'.$total_amt.'", 
 edit_by="'.$entry_by.'", edit_at="'.$entry_at.'"  where id='.$order_no;
mysqli_query($conn,$up_sql);
}




echo 'Success!';
?>