File "getProductPrice-20241115070342.php"
Full Path: /home/krishnamexports/public_html/panel/ajax/getProductPrice-20241115070342.php
File size: 1.18 KB
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8
<?php
session_start();
include('../../config/database.php');
$orderInvoice = array();
$barcode = $_GET['barcode'];
if(!empty($barcode))
{
$sqlProduct = mysqli_query($cn,"select `id`,`distributor_price`,`image` from `tbl_product` where `barcode`='$barcode' and `status`=1");
if(mysqli_num_rows($sqlProduct)>0)
{
$sqlProductData = mysqli_fetch_array($sqlProduct);
$sqlOrder = mysqli_query($cn,"select sum(qty) from `tbl_order` where `product_id`='".$sqlProductData['id']."'");
$sqlOrderData = mysqli_fetch_array($sqlOrder);
$sqlProductStock = mysqli_query($cn,"select * from `tbl_barcode` where `barcode`='$barcode'");
$stock = mysqli_num_rows($sqlProductStock) - $sqlOrderData['sum(qty)'];
$imgAll = explode('$',$sqlProductData['image']);
$arr = array("status"=>1, 'distributorPrice'=>$sqlProductData['distributor_price'], 'img'=>$imgAll[0],'stockQty'=>$stock);
echo json_encode($arr);
}
else
{
$arr = array("status"=>2, 'Msg'=>"Barocde Not Found.");
echo json_encode($arr);
}
}
else
{
$arr = array("status"=>2, 'Msg'=>"Enter correct barcode.");
echo json_encode($arr);
}
?>