";
}
if($hasWriteAccess)
{
$edit_link="";
}
if($hasExecuteAccess)
{
if(!hasChildData('item_stock','item_id',$item_id) && !hasChildData('item_stock_dispensary','item_id',$item_id)){
$delete_link="";
}
}
$space=" ";
$links = $view_link.$space.$edit_link.$space.$delete_link;
$medicine_usage_cat_name=getTableFieldValue('medicine_usage_cat','medicine_usage_cat_name','medicine_usage_cat_id',$row1['medicine_usage_cat_id']);
$cat=getTableFieldValue('tbl_categories','cat_name','cat_id',$row1['cat']);
$item_form=getTableFieldValue('medicine_form','form_name','form_id',$row1['item_form_id'],'');
//$subcat=getTableFieldValue('sub_category','sub_cat_name','sub_cat_id',$row1['subcat'],'');
$unit=getTableFieldValue('unit_master','unit_name','unit_id',$row1['unit_id'],'');
/*$item_ingredients =getCommaSeperatedValuesForInClause("select ingredient_name from ingredient ","ingredient_id",$row1['active_ingredients']);*/
$item_ailment_systems = getCommaSeperatedValuesForInClause("select ailment_sys_name from ailment_system ","ailment_sys_id",$row1['ailments']);
$item_alternate_med = getCommaSeperatedValuesForInClause("select item_name from tbl_items ","item_id",$row1['item_alternate']);
$subclass = getCommaSeperatedValuesForInClause("select subclass_name from sub_classification ","subclass_id",$row1['sub_classification']);
$composition = getCommaSeperatedValuesForInClause("select composition_name from composition ","composition_id",$row1['composition']);
$indication = getCommaSeperatedValuesForInClause("select indication_name from indication ","indication_id",$row1['indication']);
$contra_indication = getCommaSeperatedValuesForInClause("select cindication_name from contra_indication ","cindication_id",$row1['contra_indication']);
$side_effect = getCommaSeperatedValuesForInClause("select sideeffect_name from side_effects ","sideeffect_id",$row1['side_effects']);
$data['rows'][] = array(
'id' => $row1['item_id'],
'cell' => array($links,$count++,$item_code,$item_name,$item_ailment_systems,$item_form,$cat,$medicine_usage_cat_name,$item_alternate_med,$row1['min_indent_level'],$row1['max_indent_level'],($status==1?'Active':'Inactive'),$is_prescription==1?'Yes':'No',$reorder_stock_level)
);
}
$data['rows'][] = array(
'id' => $row['filterkey'],
'cell' => array('','', "", "", '','', '', '', '', '', '', '', '','', '', '','', '', '','')
);
echo json_encode($data);
?>