$query="select a.item_id, b.stock_qty,b.expiry_date, a.unit_id from tbl_items a left join item_stock b on a.item_id = b.item_id where a.item_id = '".$itemId."' and a.is_group_item = 'N' and b.ohc_type_id = '".$_SESSION['current_ohcttype']."' and stock_qty > 0 and item_batch_no!='' ";
error_log("query for available medicine : ".$query);
$query="select i.item_name, i.item_form_id, d.item_batch_no, i.is_prescription, i.unit_id, i.item_id from tbl_items i inner join item_stock d on i.item_id = d.item_id where d.expiry_date>=CURDATE() and d.item_batch_no!='' and d.ohc_type_id ='".$_SESSION['current_ohcttype']."' and i.item_id = '".$itemId."' and stock_qty > 0";