ESH/pending_medical_examination_list.php
2024-10-23 18:28:06 +05:30

570 lines
12 KiB
PHP

<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<style>
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
/* Semi-transparent black background */
z-index: 9999;
/* Set a high z-index to ensure it's displayed on top */
}
</style>
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<?php include('techsyn_sidebar.php');
error_reporting(E_ERROR | E_PARSE);
?>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="#">Home</a>
</li>
<li class="">Patient Visit</li>
<li class="active">Pending Medical Examination</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<form name="f1" method="post" action="" id="flex_form_checkup">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_checkup_id" id="flex_checkup_id" />
<input type="hidden" name="emp_id_history" id="emp_id_history" />
<input type="hidden" name="checkup_type_id_db" id="checkup_type_id_db" />
<input type="hidden" name="toPage" id="toPage" />
</form>
<form name="flex_medical_form" method="post" action="" id="flex_medical_form">
<input type="hidden" name="medical_exam_id" id="medical_exam_id" />
</form>
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="flex_medical_form" id="flex_medical_form" />
<input type="hidden" name="pdf_action" id="pdf_action" value="pdf_pending_medical_examination.php" />
<input type="hidden" name="excel_action" id="excel_action" value="excel_pending_medical_examination.php" />
</form>
<div id="flex1" style="width:100%">
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$(function() {
var w = screen.width * .90;
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
$("#flex1").flexigrid({
url: 'pending_medical_examination_list_script.php',
dataType: 'json',
colModel: [{
display: 'Select',
name: 'checkbox',
width: w * .07,
sortable: false,
align: 'left'
}, {
display: 'Sr',
name: 'count',
width: w * .03,
sortable: false,
align: 'left'
},
{
display: '',
name: '',
width: w * .1,
sortable: false,
align: 'center'
},
{
display: 'Examination Date',
name: 'checkup_date',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Ticket No',
name: 'ticket_no',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Patient Name',
name: 'patient_name',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'EMP Code',
name: 'emp_code',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Patient Category',
name: 'patient_cat_id',
width: w * .1,
sortable: true,
align: 'center'
},
{
display: 'Examination Type',
name: 'checkup_type_id',
width: w * .3,
sortable: true,
align: 'left'
},
{
display: 'Remarks',
name: 'remarks',
width: w * .1,
sortable: true,
align: 'left'
},
// {
// display: 'Test Categories',
// name: 'checkup_section_ids',
// width: w * .3,
// sortable: true,
// align: 'left'
// },
{
display: 'Ready for Examation',
name: 'current_status',
width: w * .1,
sortable: true,
align: 'left'
},
],
buttons: [{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
separator: true
},
{
separator: true
},
{
name: 'Download Template',
bclass: 'print_excel',
onpress: download_template
},
{
separator: true
},
{
name: 'Upload Excel',
bclass: 'print_excel',
onpress: upload_excel
},
{
separator: true
},
{
name: 'Download Excel',
bclass: 'print_excel',
onpress: download_excel
},
{
separator: true
},
{
name: 'Send For Doc Approval',
bclass: 'print_excel',
onpress: send_all
}, {
separator: true
}, {
name: 'Load Lab Data',
bclass: 'add',
onpress: get_lab_data
}
],
searchitems: [{
display: 'EMP code',
name: 'emp_code',
isdefault: true
},
{
display: 'Patient Name',
name: 'patient_name',
},
{
display: 'Examination Date(DD/MM/YYYY)',
name: 'checkup_date',
isdefault: true
},
{
display: 'Examination Date Range(DD/MM/YYYY)-(DD/MM/YYYY)',
name: 'medical_entry_date_between',
isdefault: true
},
{
display: 'Examination Type',
name: 'checkup_type_id',
isdefault: true
},
{
display: 'Patient Category',
name: 'patient_cat_name'
}
],
sortname: "a.last_modified",
sortorder: "desc",
usepager: true, //pagination
useRp: true,
rp: 50, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
//width: w,
height: h,
singleSelect: true
});
});
function get_lab_data() {
var ComAlert = BootstrapDialog.alert({
message: "Please wait loading the data from Lab Machines..",
closable: false,
});
showOverlay();
$.ajax({
async: 'false',
type: 'POST',
url: 'process_device_result.php',
success: function(data) {
var responseData = JSON.parse(data);
ComAlert.close();
if (responseData.success) {
BootstrapDialog.alert(responseData.message);
} else {
BootstrapDialog.alert(responseData.message);
}
},
error: function(data) {
ComAlert.close();
BootstrapDialog.alert("Something went wrong while loading the data from machine");
}
})
hideOverlay();
}
function showOverlay() {
var overlay = document.createElement('div');
overlay.className = 'overlay';
document.body.appendChild(overlay);
}
function hideOverlay() {
var overlay = document.querySelector('.overlay');
if (overlay) {
overlay.parentNode.removeChild(overlay);
}
}
let checkboxArr = [];
function send_all() {
BootstrapDialog.alert("Please wait auto approving process will take some time do not press anywhere else");
showOverlay();
checkboxArr = [];
document.querySelectorAll('.checkbox').forEach((component) => {
if (component.checked) {
checkboxArr.push(component.getAttribute('value'));
}
});
// console.log(checkboxArr);
if (checkboxArr.length == 0) {
BootstrapDialog.alert("Select some checkboxes to send for doc approval");
} else {
$.ajax({
type: 'post',
url: 'send_doc_approval.php',
data: {
checkupIds: checkboxArr
},
success: function(data) {
if (data == 400) {
BootstrapDialog.alert("Something went wrong while sending for approval");
} else if (data == 200) {
BootstrapDialog.alert("Sent For Doc Approval");
$("#flex1").flexReload();
hideOverlay();
}
},
error: function(data) {
BootstrapDialog.alert("Something went wrong while sending for approval");
hideOverlay();
}
})
}
}
function pdf() {
window.open('ajax_pdf.php', 'OPD-Injury List');
}
function excel() {
console.log("click");
$("#checkup_type_id_m").val("");
$('#modal-select-checkup-type-dd-ss').modal("show");
}
function upload_excel() {
window.location = 'upload_excel_medical.php';
}
function download_template() {
$(".save_button").show();
$("#checkup_type_id").val("");
$('#modal-select-checkup-type').modal("show");
}
function download_excel() {
window.location = 'download_excel_medical.php';
}
function delete_checkup(id) {
$("#flex_checkup_id").val(id);
BootstrapDialog.confirm('Are you sure to delete the checkup form?', function(result) {
if (result) {
$.ajax({
url: 'delete_checkup.php',
type: "POST",
data: $("#flex_form_checkup").serialize(),
success: function(data) {
if (data.indexOf("SUCCESS") != -1) {
BootstrapDialog.alert('checkup form Deleted Successfully.');
$("#flex1").flexReload();
} else {
BootstrapDialog.alert('Error Deleting checkup form');
}
return;
},
error: function(data) {
BootstrapDialog.alert('Error Deleting checkup form');
return;
}
});
}
});
}
function open_checkup(checkupId, empId, action, checkup_type_id) {
//window.location = 'checkup.php?checkup_id='+checkupId+'';
console.log(checkupId + ':' + empId + ' ; ' + action + ' : ' + checkup_type_id);
if (checkupId != null && checkupId != '') {
$("#flex_checkup_id").val(checkupId);
$("#checkup_type_id_db").val(checkup_type_id);
$("#emp_id_history").val(empId);
$("#toPage").val(action);
$("#flex_form_checkup").attr('method', 'POST');
$("#flex_form_checkup").attr('action', 'checkup_from_before.php');
$("#flex_form_checkup").submit();
}
}
function generate_barcode(checkup_id, id, checkup_section_ids,appointment_lab_id,followup_lab_id) {
$("#checkup_id").val(checkup_id);
// $("#flex_checkup_type_id").val(checkup_type_id);
$("#appointment_lab_id").val(appointment_lab_id);
$("#followup_lab_id").val(followup_lab_id);
$("#emp_id_barcode").val(id);
$("#emp_id").val(id);
$("#checkup_sections").val(checkup_section_ids);
$("#modal-barcode").modal("show");
$.ajax({
url: 'select_checkup_section_ids.php',
type: 'POST',
data: {
checkup_id: checkup_id
},
dataType: 'json',
success: function(data) {
var checkup_cat ="";
// var opt = $.parseJSON(data);
// console.log("DATA:"+data);
for (var i = 0; i < data.length; i++) {
checkup_cat += "<option value='" + data[i].section_id + "'>" +
data[i].section_name + "</option>"
}
$("#checkup_section_id").html(checkup_cat);
$("#param_name").val("");
$("#param_name").trigger('chosen:updated');
},
error: function(data) {
BootstrapDialog.alert('Error');
return;
}
});
}
function open_medical_examination_form(medical_exam_id, patient_id, task) {
if (medical_exam_id != null && medical_exam_id != '' && patient_id != null && patient_id != '') {
$("#medical_exam_id").val(medical_exam_id);
$("#flex_medical_form").attr('method', 'POST');
if (task == 'pme') {
$("#flex_medical_form").attr('action', 'add_patient_physical_parameters_pme.php');
} else if (task == 'ime_short') {
$("#flex_medical_form").attr('action', 'add_patient_physical_parameters_ime_short_term.php');
} else if (task == 'annual') {
$("#flex_medical_form").attr('action', 'add_initial_medical_examination_longterm.php');
} else if (task == 'semi_annual') {
$("#flex_medical_form").attr('action', 'add_patient_physical_parameters_ame_below_40.php');
}
if (task == 'ime_long' || task == 'pre_employment') {
$("#flex_medical_form").attr('action', 'add_patient_physical_parameters.php');
}
$("#flex_medical_form").submit();
}
}
$(document).ready(function() {
document.body.getElementsByTagName('th')[0].innerHTML = '<div style="text-align: left; width: 69.552px;"><input type="checkbox" name="selectAll" id="selectAll" onchange></div>'
let element = document.getElementById("selectAll");
element.addEventListener('click', (event) => {
const isChecked = event.target.checked;
document.querySelectorAll('.checkbox').forEach((component) => {
component.checked = isChecked;
});
});
});
</script>
<?php include('techsyn_footer.php'); ?>
<?php
include('form/select_checkup_type.php');
?>
<?php
include('select_checkup_type_s.php');
include('form/add_barcode.php');
?>