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