ESH/select_stock_qty.php

24 lines
948 B
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?php
include ('includes/config/config.php');
$itemId = $_REQUEST['itemId'];
// echo $itemId;
//$query = "SELECT a.item_id,a.item_name,b.stock_qty FROM `tbl_items` a Left join item_stock_dispensary b on
//a.item_id = b.item_id where a.item_id = '".$itemId."' and b.ohc_location_id='" . $_SESSION['current_ohcttype'] . "' ";
$query="SELECT i.item_id, item_name, ifnull(d.stock_qty,0) as stock_qty, unit_id from tbl_items i left join (select item_id, stock_qty from item_stock_dispensary isd where ohc_location_id='" . $_SESSION['current_ohcttype'] . "') d on i.item_id=d.item_id where i.item_id = '".$itemId."'";
//echo $query;
if (! $result = @mysqli_query($conn,$query)) {
exit(mysqli_error($conn));
}
$data = array();
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$data = $row;
}
} else {
$data['status'] = 200;
$data['message'] = "Data not found!";
}
echo json_encode($data);
?>