<?php 
include "../config.php";
error_reporting(0);
$customer = $_POST['customer'];
$product = $_POST['product'];
//echo $customer;
//echo $product;
if (!empty($customer)&& !empty($product))
{
$sql = "select productdetail.productcode,productdetail.price,productname,unittokg from productdetail where productdetail.productcode = '$product' && productdetail.status !='deleted'";
//echo $sql;
$conn=mysqli_query($connect,$sql);
while($row=mysqli_fetch_array($conn))
{
    
         $proprice = $row['price'];
         $proname = $row['productname'];
         $unit_conversion = $row['unittokg'];
         $product_rate = $proprice."||".$proname."||".$unit_conversion."||".$proprice;
   
}
$cuspro = "SELECT customerrate.price as price,customerrate.price_est as price_est,customerrate.productname from customerrate where customerrate.customer = '$customer' && customerrate.productcode = '$product' && status !='deleted'";
$connn=mysqli_query($connect,$cuspro);
while($roww=mysqli_fetch_array($connn))
{
    
         $propricecus = $roww['price'];
         $propricecus_est = $roww['price_est'];
         $product_cus_rate = $propricecus."||".$proname."||".$unit_conversion."||".(empty($propricecus_est)?$proprice :$propricecus_est);
         //echo $propricecus;
   
}
echo empty($propricecus)?$product_rate:$product_cus_rate;
}
else
{
 echo "";
}

?>
