ESH/patient_appointment.php

486 lines
14 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<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'); ?>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li class="#">Patient Management</li>
<li class="active">Employee Appointment</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div id="flexigridDiv" class="table-responsive">
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_action" id="pdf_action" value="pdf_appointment_list.php" />
<input type="hidden" name="excel_action" id="excel_action" value="excel_appointment_list.php" />
</form>
<form name="f1" method="post" action="" id="flex_form_city">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_city_id" id="flex_city_id" />
</form>
</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: 'patient_appointment_script.php',
dataType: 'json',
colModel: [{
display: 'Sr no.',
name: 'count',
width: w * .04,
sortable: false,
align: 'left'
},
{
display: 'Appointment Date',
name: 'appointment_date',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: 'Time',
name: 'time',
width: w * .08,
sortable: true,
align: 'left'
},
{
display: 'Patient Name',
name: 'patient_name',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: 'Doctor Name',
name: 'doctor_name',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: 'Appointment Type',
name: 'app_type',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: 'Status',
name: 'status',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: '',
name: '',
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
}, {
name: 'Update Multipal Appintments',
bclass: 'add',
onpress: addApp
}
],
searchitems: [
{
display: 'Patient Name',
name: 'patient_name',
isdefault: true
},
],
sortname: "id",
sortorder: "asc",
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 excel()
{
window.open('ajax_excel.php', 'Contractor List');
}
function pdf() {
//window.open('pdf_manage_item.php');
window.open('ajax_pdf.php', 'Contractor List');
}
function add() {
$(".save_button").show();
$("#city_id").val("");
$("#city").val("");
$("#AC_cost").val("");
$("#AC_amb_charge").val("");
$("#NON_AC_cost").val("");
$("#NON_AC_amb_charge").val("");
$("#city").prop('disabled', false);
$("#AC_cost").prop('disabled', false);
$("#AC_amb_charge").prop('disabled', false);
$("#NON_AC_cost").prop('disabled', false);
$("#NON_AC_amb_charge").prop('disabled', false);
$('#modal-add-city').modal("show");
}
function delete_section(cityId) {
$("#flex_city_id").val(cityId);
$("#city_id").val(cityId);
$("#status").val('CANCELLED');
BootstrapDialog.confirm('Are You Sure To Delete The Employee Appointment?', function(result) {
if (result) {
open_item('del');
}
});
}
function open_section(cityId, action) {
if (action == "V") {
$(".save_button").hide();
$("#city").prop('disabled', true);
$("#AC_cost").prop('disabled', true);
$("#AC_amb_charge").prop('disabled', true);
$("#NON_AC_cost").prop('disabled', true);
$("#NON_AC_amb_charge").prop('disabled', true);
} else {
$("#city").prop('disabled', false);
$("#AC_cost").prop('disabled', false);
$("#AC_amb_charge").prop('disabled', false);
$("#NON_AC_cost").prop('disabled', false);
$("#NON_AC_amb_charge").prop('disabled', false);
$(".save_button").show();
}
$.ajax({
url: 'select_app_data.php?cityId=' + cityId + ' ',
type: 'POST',
success: function(data) {
var data = $.parseJSON(data);
if (data.app_type == 'FIT') {
data.app_type = 'Sickness/Fitness';
} else if (data.app_type == 'MED') {
data.app_type = 'Periodic Health Checkup';
}
$("#city_id").val(data.id);
$("#appointment_date").val(data.date);
$("#time").val(data.slot);
$("#patient_name").val(data.patient_name);
$("#doctor_name").val(data.doctor_name);
$("#app_type").val(data.app_type);
$("#status").val(data.status);
$('#modal-add-city').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating city details');
return;
}
});
}
function loadSBUList(bu_id, selectId) {
$("#" + selectId).empty();
$.ajax({
url: 'getDynamicData.php?tableName=department&where_clause_field=bu_id&where_clause_value=' + bu_id,
type: 'GET',
success: function(data) {
var data = $.parseJSON(data);
for (i = 0; i < data.length; i++) {
var o = new Option(data[i].dept_name, data[i].dept_id)
$("#" + selectId).append(o);
}
},
error: function(data) {
BootstrapDialog.alert('Error Populating Section');
return;
}
});
}
function addApp() {
location.href = "bulk_appointments.php";
}
function save_section() {
open_item('save');
}
function open_item(type) {
var appointmentId = $('#city_id').val();
$.ajax({
url: 'select_app_data.php',
type: "POST",
data: {
'cityId': appointmentId,
},
dataType: 'json',
success: function(data) {
var app_id = data.id;
var link = data.app_root;
var emailContent = "";
var status = '';
var sub_status = '';
if ($('#status').val() == 'BOOKED') {
sub_status = 'Pending';
status = "<font color=red>Pending</font> ";
} else if ($('#status').val() == 'DRP') {
sub_status = 'Pending';
status = "<font color=red>Pending</font>";
} else if ($('#status').val() == 'DRA') {
sub_status = 'Completed';
status = "<font color=green>Completed</font> ";
} else if ($('#status').val() == 'CANCELLED') {
sub_status = 'Cancelled';
status = " <font color=red>Cancelled</font>";
}
if (data.app_type == 'FIT') {
data.app_type = 'Sickness/Fitness';
} else if (data.app_type == 'MED') {
data.app_type = 'Periodic Health Checkup';
}
var email_list_to = data.emp_mail;
var email_list_cc = data.doc_mail;
// var app_root = '<?php echo getConfigKey('APP_ROOT') ?>';
// var link = "" + app_root + "/opd_form_pdf.php?appointment_id_pdf=" + app_id;
ref_type = "Appointments Booked";
if(type=='del' ){
var subject = 'You missed your '+ data.app_type+' appointment in ' + data.ohc_type + ' OHC on ' + data
.date + '.';
emailContent +=
"<p>Dear Sir/Madam,</p><p>You have missed your " + data.app_type + " appointment in " + data.ohc_type + " OHC on " + data
.date + ".Request you to reschedule your appointment by clicking on below link.</p>"
}else if( $('#status').val() == 'CANCELLED'){
var subject = 'Your '+ data.app_type+' got ' + sub_status + ' in ' + data.ohc_type + ' OHC on ' + data
.date + '.';
emailContent +=
"<p>Dear Sir/Madam,</p><p>We regret to inform you that your " + data.app_type + " in " + data.ohc_type + " OHC got " +
status +
".due to administrativ reason. Apologies for inconvenience caused.</p><br><p>Request you to reschedule your appointment by clicking on below link.</p>"
}else{
var subject = 'Your '+ data.app_type+' got ' + sub_status + ' in ' + data.ohc_type + ' OHC on ' + data
.date + '.';
emailContent +=
"<p>Dear Sir/Madam,</p><p>Your " + data.app_type + " in " + data.ohc_type + " ohc got " +
status +
".<br>Below are more details of your booking </p><br><table class=`table-bordered` width=`100%`><thead><tr><th>Date</th><th>Time</th><th>Patient Name</th>";
// emailContent +="<th>Doc Name</th>";
emailContent +="<th> Appointment Type</th><th> status</th><th> Remarks</th></tr><thead><tbody>";
emailContent += "<tr><td>" + data.date + "</td><td>" + data.slot + '-' + data.slot_end +
"</td><td>" +
data.patient_name +
// "</td><td>" +
// data.doctor_name +
"</td><td>" + data.app_type +
"</td><td>" + status +
"</td><td>" + data.remarks + "</td></tr>";
emailContent +=
"</tbody></table>";
// emailContent += "<br><a href=`" + link +
// "`> Details</a> ";
}
if ($('#status').val() == 'CANCELLED') {
emailContent += "<br><a href=`" + link + "`> Book a appointment</a> ";
}
emailContent += "<p> Regards,</p><p> Team OHC</p>";
message = emailContent;
var id = appointmentId;
message = emailContent;
send_email(ref_type, appointmentId, email_list_to, email_list_cc, subject,
message,type);
},
error: function(data) {
BootstrapDialog.alert('Error In Pulling Id');
return id;
}
});
}
function send_email(ref_type, ref_identifier, email_list_to, email_list_cc, subject, message, type) {
$.ajax({
url: 'send_email.php',
type: 'POST',
data: {
ref_type: ref_type,
ref_identifier: ref_identifier,
email_list_to: email_list_to,
email_list_cc: email_list_cc,
subject: subject,
message: message,
},
success: function(data) {
if (type == 'del') {
$.ajax({
url: 'delete_emp_appointment.php',
type: "POST",
data: $("#flex_form_city").serialize(),
success: function(data) {
if (data.indexOf("SUCCESS") != -1) {
BootstrapDialog.alert('Employee Appointment Deleted Successfully.');
$("#flex1").flexReload();
} else {
BootstrapDialog.alert('Error Deleting Employee Appointment');
}
return;
},
error: function(data) {
BootstrapDialog.alert('Error Deleting Complaint');
return;
}
});
} else if(type == 'save'){
$.ajax({
url: 'save_app_status.php ',
type: "POST",
data: $("#city_form").serialize(),
success: function(data) {
BootstrapDialog.alert('Appointment Approved Successfully.');
$("#flex1").flexReload();
return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving Appointment');
return;
}
});
$('.close').click();
}
},
error: function(data) {
BootstrapDialog.alert('Error in sending mail');
return;
}
});
$('.close').click();
}
</script>
<?php include('form/send_mail.php'); ?>
<?php include('techsyn_footer.php'); ?>
<?php include('show_appointment.php'); ?>