<?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');


$ref_no = $_REQUEST['ref_no'];
$item_id = $_REQUEST['item_id'];
$sales_price = $_REQUEST['sales_price'];
 
 $flag = $_REQUEST['flag'];
 
$entry_by =  $_SESSION['user']['id'];
$entry_at = $now=date('Y-m-d H:i:s');
 
 if($flag>0){
 
  $up_sql = 'update customer_sales_price  set sales_price="'.$sales_price.'", edit_by="'.$entry_by.'", edit_at="'.$entry_at.'"  where item_id='.$item_id;
  mysqli_query($conn,$up_sql);
  
 }else{
 
 $sql_ins='INSERT INTO customer_sales_price (ref_no,  item_id,  sales_price, entry_by,  entry_at)
	VALUES ("'.$ref_no.'",  "'.$item_id.'", "'.$sales_price.'", "'.$entry_by.'", "'.$entry_at.'")';
$query_sql_ins=mysqli_query($conn, $sql_ins);

}
 
 

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




echo 'Success!';
?>