118 lines
5.0 KiB
PHP
118 lines
5.0 KiB
PHP
|
<?php
|
||
|
include('includes/config/config.php');
|
||
|
include('includes/auth/auth.php');
|
||
|
include('includes/functions.php');
|
||
|
include('access.php');
|
||
|
error_reporting(E_ERROR | E_PARSE);
|
||
|
?>
|
||
|
<?php
|
||
|
|
||
|
// Connect to mysqli database
|
||
|
$page = 1; // The current page
|
||
|
$sortname = 'a.last_modified'; // Sort column
|
||
|
$sortorder = 'desc'; // Sort order
|
||
|
$qtype = ''; // Search column
|
||
|
$query = ''; // Search string
|
||
|
// Get posted data
|
||
|
if (isset($_POST['page'])) {
|
||
|
$page = mysqli_real_escape_string($conn, $_POST['page']);
|
||
|
}
|
||
|
if (isset($_POST['sortname'])) {
|
||
|
$sortname = mysqli_real_escape_string($conn, $_POST['sortname']);
|
||
|
}
|
||
|
if (isset($_POST['sortorder'])) {
|
||
|
$sortorder = mysqli_real_escape_string($conn, $_POST['sortorder']);
|
||
|
}
|
||
|
if (isset($_POST['qtype'])) {
|
||
|
$qtype = mysqli_real_escape_string($conn, $_POST['qtype']);
|
||
|
}
|
||
|
if (isset($_POST['query'])) {
|
||
|
$query = mysqli_real_escape_string($conn, $_POST['query']);
|
||
|
}
|
||
|
if (isset($_POST['rp'])) {
|
||
|
$rp = mysqli_real_escape_string($conn, $_POST['rp']);
|
||
|
}
|
||
|
// Setup sort and search SQL using posted data
|
||
|
$hasReadAccess = isAccessible($_SESSION['RoleId'], $menu_key, 'R');
|
||
|
$hasWriteAccess = isAccessible($_SESSION['RoleId'], $menu_key, 'W');
|
||
|
$hasExecuteAccess = isAccessible($_SESSION['RoleId'], $menu_key, 'E');
|
||
|
$sortSql = "order by $sortname $sortorder";
|
||
|
|
||
|
if ($qtype == 'dept_name') {
|
||
|
$searchSql = " where dept_id in (select dept_id from department where dept_name like '%$query%') ";
|
||
|
} else {
|
||
|
$searchSql = ($qtype != '' && $query != '') ? "where upper($qtype) like upper('%$query%')" : '';
|
||
|
}
|
||
|
|
||
|
$ohc_type = $_SESSION['current_ohcttype'];
|
||
|
// Get total count of records
|
||
|
$sql = "SELECT count(a.response_id) from questionaire_master_response a left join questionaire_master_response_details b on a.response_id = b.response_id left join patient_master c on a.patient_id = c.id WHERE a.form_type = 'dlf' and a.approval_status = 'N' AND a.f_status = 'DRP' group by a.response_id $searchSql";
|
||
|
|
||
|
//echo $sql;
|
||
|
$result = mysqli_query($conn, $sql);
|
||
|
$row = mysqli_fetch_array($result);
|
||
|
$total = $row[0];
|
||
|
// Setup paging
|
||
|
if (!isset($rp)) {
|
||
|
$rp = 10;
|
||
|
}
|
||
|
//echo $_REQUEST[emp_id];
|
||
|
$pageStart = ($page - 1) * $rp;
|
||
|
$limitSql = "limit $pageStart, $rp";
|
||
|
// Return JSON data
|
||
|
$data = array();
|
||
|
$data['page'] = $page;
|
||
|
$data['total'] = $total;
|
||
|
$data['rows'] = array();
|
||
|
$sql_medical_examination = "SELECT a.response_id , a.medical_examination_no, a.patient_id, c.patient_name, a.screen_date,c.emp_code,c.employer_contractor_id from questionaire_master_response a left join questionaire_master_response_details b on a.response_id = b.response_id left join patient_master c on a.patient_id = c.id WHERE a.form_type = 'dlf' and a.approval_status = 'N' AND a.f_status = 'DRP' group by a.response_id";
|
||
|
|
||
|
error_log("dlf pending grid " . $sql_medical_examination);
|
||
|
$sql_medical_examination .= " $searchSql $sortSql $limitSql ";
|
||
|
$results_medical_examination = mysqli_query($conn, $sql_medical_examination);
|
||
|
$count = ($page - 1) * $rp + 1;
|
||
|
|
||
|
|
||
|
//echo $sql_checkup;
|
||
|
//echo $access_level;
|
||
|
|
||
|
while ($row_medical_examination = mysqli_fetch_assoc($results_medical_examination)) {
|
||
|
|
||
|
|
||
|
$patient_id = $row_medical_examination['patient_id'];
|
||
|
$department = getTableFieldValue('department', 'dept_name', 'dept_id', $row_medical_examination['dept_id']);
|
||
|
error_log("Department :::::". $department . $row_medical_examination['dept_id']);
|
||
|
$emp_cont = getTableFieldValue('employer_contractor', 'employer_contractor_name', 'id', $row_medical_examination['employer_contractor_id']);
|
||
|
$dlf_no = $row_medical_examination['medical_examination_no'];
|
||
|
$response_id = $row_medical_examination['response_id'];
|
||
|
error_log($emp_cont);
|
||
|
error_log('---------');
|
||
|
$view_link = "";
|
||
|
$edit_link = "";
|
||
|
$delete_link = "";
|
||
|
$pdf_link = "";
|
||
|
$links = "";
|
||
|
|
||
|
if ($hasWriteAccess) {
|
||
|
|
||
|
$edit_link = "<a href=\"#\" class=\"blue\" onclick=\"open_dlf_form('" . $row_medical_examination['patient_id'] . "','" . $dlf_no . "','" . $response_id . "');\"><span style=\"font-size:12px\" class=\"glyphicon glyphicon-edit\"></span></a>";
|
||
|
|
||
|
$pdf_link = "<a href=\"#\" class=\"red\" onclick=\"open_dlf_pdf('" . $row_medical_examination['patient_id'] . "','" . $response_id . "','" . $dlf_no . "');\"><i class=\"fa fa-file-pdf-o\" style=\"font-size: 12px;\"></i></a>";
|
||
|
}
|
||
|
if ($hasExecuteAccess) {
|
||
|
$delete_link = "<a href=\"#\" class=\"blue\" onclick=\"delete_ffi_form('" . $row_medical_examination['patient_id'] . "','" . $response_id . "','" . $dlf_no . "');\"><span style=\"font-size:20px\" class=\"ace-icon fa fa-trash bigger-130\"></span></a>";
|
||
|
}
|
||
|
|
||
|
|
||
|
error_log("*** datata ***".$row_medical_examination['patient_name']);
|
||
|
|
||
|
$space = " ";
|
||
|
$links = $assign_link . $space . $view_link . $space . $edit_link . $space . $delete_link . $space . $pdf_link;
|
||
|
|
||
|
$data['rows'][] = array(
|
||
|
'id' => $row_medical_examination['patient_id'],
|
||
|
|
||
|
'cell' => array($links,$count++, $row_medical_examination['patient_name'], $row_medical_examination['screen_date'], $row_medical_examination['emp_code'], $department, $emp_cont)
|
||
|
);
|
||
|
}
|
||
|
echo json_encode($data);
|
||
|
?>
|