ESH/get_medicine_available_qty_store.php
2024-10-23 18:28:06 +05:30

23 lines
760 B
PHP

<?php
include('includes/config/config.php');
include('log_entry.php');
$value = $_REQUEST['value'];
$query = "select a.item_id, sum(b.stock_qty) as stock_qty, a.unit_id from tbl_items a left join item_stock b on a.item_id = b.item_id where a.item_id = '".$value."' and a.is_group_item = 'N' and b.ohc_type_id = '".$_SESSION['current_ohcttype']."' and b.expiry_date >= CURDATE() limit 1";
error_log("query for available medicine : ".$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);
?>