"; } if ($hasWriteAccess) { $edit_link = ""; } if ($hasExecuteAccess) { $delete_link = ""; } $space = "   "; $links = $assign_link . $space . $view_link . $space . $edit_link . $space . $delete_link; //$waste_category_name = getTableFieldValue ( 'waste_category', 'waste_category_name', 'waste_category_id', $row1['waste_category'] ); //$ohc_type_name = getTableFieldValue ( 'ohc_type ', 'ohc_type_name', 'ohc_type_id ', $row1['ohc_type_id '] ); $client_id = getFieldFromTable('client_id', 'patient_master', 'id', $row1['patient_id']); $location_id = getFieldFromTable('client_location_id', 'patient_master', 'id', $row1['patient_id']); $paramedic_ids = $row1['paramedic_id']; $paramedic_ids_array = array(); $paramedic_ids_array = explode(",", $paramedic_ids); $paramedics = ""; for ($i = 0; $i < count($paramedic_ids_array); $i++) { if ($i == 0) { if (is_numeric($paramedic_ids_array[$i])) { $paramedics = getTableFieldValue('staff_master', 'staff_name', 'staff_id', $paramedic_ids_array[$i]); } else { $paramedics = $paramedic_ids_array[$i]; } } else { if (is_numeric($paramedic_ids_array[$i])) { $paramedics = $paramedics . "," . getTableFieldValue('staff_master', 'staff_name', 'staff_id', $paramedic_ids_array[$i]); } else { $paramedics = $paramedics . "," . $paramedic_ids_array[$i]; } } } $data['rows'][] = array( 'id' => $row1['ambulance_usage_id'], 'cell' => array( $count++, $links, date_format(date_create($row1['usage_date']), "d-m-Y"), getTableFieldValue('ambulance_details_new', 'ambulance_number', 'id', $row1['ambulance_id']), getTableFieldValue('staff_master', 'staff_name', 'staff_id', $row1['driver_id']), $paramedics, getTableFieldValue('patient_master', 'patient_name', 'id', $row1['patient_id']), getFieldFromTable('client_name', 'client_master', 'id', $client_id), getFieldFromTable('client_location', 'client_location', 'client_location_id', $location_id), getTableFieldValue('duty_type_master', "CONCAT(duty,' ( ' , duty_code , ' ) ')", 'duty_id', $row1['duty_type']), $row1['ambulance_from'], $row1['ambulance_to'], ) ); } commit(); $data['rows'][] = array( 'id' => $row['filterkey'], 'cell' => array('', "", "", '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '') ); echo json_encode($data); ?>