ESH/select_reports_accordingly.php

50 lines
2.0 KiB
PHP
Raw Permalink Normal View History

2024-10-23 18:28:06 +05:30
<?php
include('includes/config/config.php');
include('includes/functions.php');
include('log_entry.php');
error_log("Start Printing Request Attributes");
$requestStr = "";
foreach ($_REQUEST as $key => $value) {
$requestStr .= $key . " : " . $value . "\n";
error_log($key . " : " . $value . "<br />\r\n");
}
error_log("End Printing Request Attributes");
$need = $_POST['need'];
error_log("need:" . $need);
if ($need == "PSR") {
$value = 'Y';
$sql_report = "select br.* from business_reports_filter_master br left join report_master rm on br.report_id = rm.report_id left join assign_report ar on rm.report_id=ar.report_id where ar.role_id='" . $_SESSION['RoleId'] . "' and rm.report_type = 'D' and br.is_patient_specific= '" . $value . "' ";
error_log("sql_report: " . $sql_report);
if (!$result = @mysqli_query($conn,$sql_report)) {
exit(mysqli_error($conn));
}
if (mysqli_num_rows($result) > 0) {
while ($row = @mysqli_fetch_assoc($result)) {
$r_id = $row['report_id'];
$r_name = $row['report_name'];
$report_section.="<option value=$r_id>$r_name</option>";
}
}
} else if ($need == "CR") {
$value = 'N';
$sql_report = "select br.* from business_reports_filter_master br left join report_master rm on br.report_id = rm.report_id left join assign_report ar on rm.report_id=ar.report_id where ar.role_id='" . $_SESSION['RoleId'] . "' and rm.report_type = 'D' and br.is_patient_specific= '" . $value . "' ";
error_log("sql_report: " . $sql_report);
if (!$result = @mysqli_query($conn,$sql_report)) {
exit(mysqli_error($conn));
}
if(mysqli_num_rows($result) > 0) {
while ($row = @mysqli_fetch_assoc($result)) {
$r_id = $row['report_id'];
$r_name = $row['report_name'];
$report_section.="<option value=$r_id>$r_name</option>";
}
}
} else {
$report_section['status'] = 200;
$report_section['message'] = "Data not found!";
}
echo json_encode($report_section);
?>