1583 lines
60 KiB
PHP
1583 lines
60 KiB
PHP
|
<form id="flex_appointment_form">
|
||
|
<input type="hidden" name="flex_appointment_id" id="flex_appointment_id" />
|
||
|
<input type="hidden" name="appointmentId" id="appointmentId" />
|
||
|
<input type="hidden" name="flex_opd_id" id="flex_opd_id" />
|
||
|
<input type="hidden" name="returnPage" id="returnPage" />
|
||
|
|
||
|
</form>
|
||
|
<div id="flex1" style="display: none"></div>
|
||
|
|
||
|
<form name="export_form" method="post" id="export_form" action="">
|
||
|
<input type="hidden" name="flex_employee_appointment_id" id="flex_employee_appointment_id" />
|
||
|
<input type="hidden" name="pdf_action" id="pdf_action" value="pdf_emp_appointment_list.php" />
|
||
|
|
||
|
<input type="hidden" name="excel_action" id="excel_action" value="excel_emp_appointment_list.php" />
|
||
|
</form>
|
||
|
<form name="flex_form_sickness" method="post" action="fitness.php" id="flex_form_sickness" name="flex_form_sickness">
|
||
|
|
||
|
<input type="hidden" name="flex_sickness_id" id="flex_sickness_id" />
|
||
|
|
||
|
</form>
|
||
|
|
||
|
<script>
|
||
|
function checkQty() {
|
||
|
var total_item = $("#count_treatment_item").val();
|
||
|
// alert(total_item);
|
||
|
for (var i = 0; i < total_item; i++) {
|
||
|
var item_id = $("#treatment_item_" + i).val();
|
||
|
var item_batch = $("#item_batch_no" + i).val();
|
||
|
var issue_qty = $("#treatment_item_qtygvn_" + i).val();
|
||
|
if (issue_qty == null || issue_qty == '') {
|
||
|
issue_qty = 0;
|
||
|
}
|
||
|
if (item_id == undefined || issue_qty == undefined) continue;
|
||
|
|
||
|
if (issue_qty < 0) {
|
||
|
BootstrapDialog.alert("Negative values are not allowed!!!");
|
||
|
$("#treatment_item_qtygvn_" + i).val("");
|
||
|
return false;
|
||
|
}
|
||
|
var avl_qty = $("#current_stock_" + i).val();
|
||
|
// alert("avl qty "+avl_qty);
|
||
|
if (avl_qty == undefined || avl_qty == '' || avl_qty == null || isNaN(avl_qty)) {
|
||
|
avl_qty = parseInt($("#current_stock_div" + i).text().split(" ")[0]);
|
||
|
if (avl_qty == undefined || avl_qty == '' || avl_qty == null || isNaN(avl_qty)) {
|
||
|
avl_qty = 0;
|
||
|
}
|
||
|
}
|
||
|
// alert("avl qty "+avl_qty);
|
||
|
$.ajax({
|
||
|
type: 'post',
|
||
|
async: false,
|
||
|
url: 'get_prev_issue_qty.php',
|
||
|
data: {
|
||
|
item_id: item_id,
|
||
|
appointment_id: appointment_id,
|
||
|
item_batch: item_batch,
|
||
|
},
|
||
|
success: function(data) {
|
||
|
let pre_issue = JSON.parse(data);
|
||
|
if (pre_issue == null || pre_issue == '') pre_issue = 0;
|
||
|
if (eval(avl_qty) + eval(pre_issue) < issue_qty) {
|
||
|
|
||
|
BootstrapDialog.alert('Issue quantity can not be greater than available quantity.!!!');
|
||
|
$("#treatment_item_qtygvn_" + i).val("");
|
||
|
return false;
|
||
|
}
|
||
|
},
|
||
|
error: function(data) {
|
||
|
console.log("Something went wrong in fetching the previous itme qty for checking")
|
||
|
}
|
||
|
});
|
||
|
// }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var flag_empty_ag = 0;
|
||
|
|
||
|
function validate_update(formId, appointment_id) {
|
||
|
<?php if ($rolecode == 'DOC') { ?>
|
||
|
if (document.getElementById("ipd").checked == true) {
|
||
|
document.getElementById("ipd").value = 1;
|
||
|
} else {
|
||
|
document.getElementById("ipd").value = 0;
|
||
|
}
|
||
|
<?php } ?>
|
||
|
checkQty(appointment_id);
|
||
|
|
||
|
|
||
|
let flag_success = 1;
|
||
|
var appointment_date = $('#appointment_date' + appointment_id).val();
|
||
|
if (appointment_date == '') {
|
||
|
BootstrapDialog.alert('Please Enter Appointment Date.!!!');
|
||
|
return false;
|
||
|
}
|
||
|
// var complaints = $('#complaints' + appointment_id).val();
|
||
|
// if (complaints == '') {
|
||
|
// document.getElementById("forwardButton").style.display = 'block';
|
||
|
// document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
// BootstrapDialog.alert('Please Enter Complaints.!!!');
|
||
|
// return false;
|
||
|
// }
|
||
|
var ailments = $('#ailment_new').val();
|
||
|
if (ailments == '' || ailments == null) {
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
BootstrapDialog.alert('Please Enter Diagnosis.!!!');
|
||
|
return false;
|
||
|
}
|
||
|
// if ($("#appointment_type").val() == 'O') {
|
||
|
|
||
|
// var ailment_system_new = $('#ailment_new').val();
|
||
|
// if (ailment_system_new == '' || ailment_system_new == null) {
|
||
|
// BootstrapDialog.alert('Please Select Diagnosis.!!!');
|
||
|
|
||
|
// return false;
|
||
|
// }
|
||
|
// }
|
||
|
var total_item = $("#count_treatment_item").val();
|
||
|
for (var i = 0; i < total_item; i++) {
|
||
|
var item_id = $("#treatment_item_" + i).val();
|
||
|
var issue_qty = $("#treatment_item_qtygvn_" + i).val();
|
||
|
var avl_qty = $("#current_stock_" + i).val();
|
||
|
// if (issue_qty > eval(avl_qty)) {
|
||
|
// BootstrapDialog.alert('Issue quantity can not be greater than available quantity.!!!');
|
||
|
// return false;
|
||
|
// }
|
||
|
}
|
||
|
|
||
|
var counter = $("#count_treatment_item").val();
|
||
|
for (var i = 0; i < counter; i++) {
|
||
|
var treatment_qty = $("#treatment_item_total_" + i).val();
|
||
|
var issued_qty = $("#treatment_item_qtygvn_" + i).val();
|
||
|
if (issued_qty == null || issued_qty == '') {
|
||
|
issued_qty = 0;
|
||
|
}
|
||
|
/** if(issued_qty>treatment_qty){
|
||
|
BootstrapDialog.alert(' Issue Qty should be less than or equal to Treatment Qty .!!!');
|
||
|
|
||
|
return false;
|
||
|
}*/
|
||
|
}
|
||
|
|
||
|
<?php if ($_SESSION['RoleCode'] != $__ROLE_DOCTOR) { ?>
|
||
|
for (let i = 0; i < counter; i++) {
|
||
|
let treatment_qty = $("#treatment_item_total_" + i).val();
|
||
|
let issued_qty = $("#treatment_item_qtygvn_" + i).val();
|
||
|
let treatment_item_id = $("#treatment_item_" + i).val();
|
||
|
// alert(issued_qty + " row " + i + " item id " + treatment_item_id);
|
||
|
if (treatment_item_id == undefined || treatment_item_id == '' || issued_qty == undefined) {
|
||
|
continue;
|
||
|
}
|
||
|
if (issued_qty == null || issued_qty == 0 || issued_qty == '') {
|
||
|
if (flag_empty_ag == 0) {
|
||
|
BootstrapDialog.confirm("Issued Qty For Some items is Empty or Zero.Are you ok with it?", function(
|
||
|
result) {
|
||
|
if (result) {
|
||
|
flag_empty_ag = 1;
|
||
|
flag_success = 0;
|
||
|
} else {
|
||
|
flag_empty_ag = 0;
|
||
|
flag_success = 0;
|
||
|
}
|
||
|
});
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
flag_success = 0;
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
<?php } ?>
|
||
|
|
||
|
if (flag_success == 1) update_appointment(formId, appointment_id);
|
||
|
}
|
||
|
|
||
|
function rest_to(val) {
|
||
|
$('#rest_to_time').val(val);
|
||
|
}
|
||
|
|
||
|
function rest_from(val) {
|
||
|
$('#rest_from_time').val(val);
|
||
|
}
|
||
|
|
||
|
function update_appointment(formId, appointment_id) {
|
||
|
// alert(check_allergy_alert());
|
||
|
var allergiatic = check_allergy_alert();
|
||
|
if (allergiatic != '' && allergiatic != null) {
|
||
|
BootstrapDialog.alert('Patient has Allergy With Below Medicines. Please Change Medicines');
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
return false;
|
||
|
} else {
|
||
|
if ($('#date_absent').val() || $('#date_absent_to')
|
||
|
.val()) {
|
||
|
if ($('#date_absent_to').val() == '' || $('#date_absent_to').val() == null) {
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
BootstrapDialog.alert('Please Add Leave date to !!');
|
||
|
return false;
|
||
|
}
|
||
|
if ($('#date_absent').val() == '' || $('#date_absent').val() == null) {
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
BootstrapDialog.alert('Please Add Leave date from !!');
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// if(document.getElementById("fit_day").checked==true && ($('#date_absent').val()=='' ||$('#date_absent').val()==null)){
|
||
|
// document.getElementById("forwardButton").style.display = 'block';
|
||
|
// document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
// BootstrapDialog.alert('Please Add Period Of Rest From !!');
|
||
|
// return false;
|
||
|
// }
|
||
|
|
||
|
// if(document.getElementById("fit_day").checked==true && ($('#date_absent_to').val()=='' ||$('#date_absent_to').val()==null)){
|
||
|
// document.getElementById("forwardButton").style.display = 'block';
|
||
|
// document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
// BootstrapDialog.alert('Please Add Period Of Rest To !!');
|
||
|
// return false;
|
||
|
// }
|
||
|
|
||
|
|
||
|
|
||
|
// if (document.getElementById("fit_day").checked == true && ($('#approval_date').val() == '' || $(
|
||
|
// '#approval_date').val() == null)) {
|
||
|
// document.getElementById("forwardButton").style.display = 'block';
|
||
|
// document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
// BootstrapDialog.alert('Please Add Fitness Date !!');
|
||
|
// return false;
|
||
|
// }
|
||
|
// if (document.getElementById("fit_day").checked == true && ($('#date_absent').val() == '' || $('#date_absent').val() == null) && ($('#date_absent_to').val() == '' || $('#date_absent_to').val() == null) ){
|
||
|
// check_sickness(formId);
|
||
|
// return;
|
||
|
// }
|
||
|
|
||
|
$.ajax({
|
||
|
url: 'save_opd.php',
|
||
|
type: "POST",
|
||
|
data: $("#" + formId).serialize(),
|
||
|
dataType: 'JSON',
|
||
|
success: function(data) {
|
||
|
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
|
||
|
if ($('#date_absent').val() || $('#date_absent_to')
|
||
|
.val()) {
|
||
|
$('#appointment_id').val(data['appointment_id']);
|
||
|
$('#followup_id').val(data['followup_id']);
|
||
|
save_leave();
|
||
|
}
|
||
|
BootstrapDialog.show({
|
||
|
message: 'Details Saved Successfully.',
|
||
|
buttons: [{
|
||
|
label: 'OK',
|
||
|
action: function(dialogItself) {
|
||
|
dialogItself.close();
|
||
|
|
||
|
if ($('#appointment_type').val() == 'I') {
|
||
|
|
||
|
|
||
|
|
||
|
open_item(data['appointment_id'], $('#appointment_type')
|
||
|
.val(),
|
||
|
$('#dept_mail').val(),
|
||
|
document.location, $('#emp_mail').val());
|
||
|
|
||
|
}
|
||
|
if (document.getElementById("ipd")) {
|
||
|
if (document.getElementById("ipd").checked == true && document.getElementById("ipd")) {
|
||
|
|
||
|
open_detention(data.appointment_id, data.$appointment_status, data.$emp_id, 'E');
|
||
|
// location.href ='detention_list.php';
|
||
|
|
||
|
} else {
|
||
|
|
||
|
|
||
|
location.href =
|
||
|
"<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
}
|
||
|
} else {
|
||
|
|
||
|
|
||
|
location.href =
|
||
|
"<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//window.location.reload();
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}]
|
||
|
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
return;
|
||
|
},
|
||
|
error: function(data) {
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
BootstrapDialog.alert('Error Updating Details');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function open_detention(appointmentId, appointment_status, emp_id, action) {
|
||
|
|
||
|
if (action == 'V') {
|
||
|
document.forms['flex_appointment_form'].action = "view_ipd.php";
|
||
|
} else if (action == 'E') {
|
||
|
document.forms["flex_appointment_form"].action = "edit_ipd.php";
|
||
|
|
||
|
}
|
||
|
$("#flex_appointment_form").method = "post";
|
||
|
$("#flex_appointment_form").find("#appointmentId").val(appointmentId);
|
||
|
$("#flex_appointment_form").find("#flex_opd_id").val(emp_id);
|
||
|
$("#flex_appointment_form").find("#returnPage").val("appointment_list.php");
|
||
|
$("#flex_appointment_form").submit();
|
||
|
}
|
||
|
|
||
|
|
||
|
function check_sickness(formId) {
|
||
|
var emp = $('#emp_id').val();
|
||
|
$.ajax({
|
||
|
async: false,
|
||
|
url: 'select_privious_sickness.php',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
emp: emp
|
||
|
|
||
|
},
|
||
|
dataType: 'JSON',
|
||
|
success: function(data) {
|
||
|
console.log(data);
|
||
|
if (data == 0) {
|
||
|
BootstrapDialog.confirm({
|
||
|
title: 'Confirmation',
|
||
|
message: 'The Patient Have No Registered Sickness. Are You Sure To Add Fitness only?',
|
||
|
closable: false, // <-- Default value is false
|
||
|
draggable: false, // <-- Default value is false
|
||
|
btnCancelLabel: 'No', // <-- Default value is 'Cancel',
|
||
|
btnOKLabel: 'Yes', // <-- Default value is 'OK',
|
||
|
|
||
|
callback: function(
|
||
|
result) {
|
||
|
if (result) {
|
||
|
|
||
|
$.ajax({
|
||
|
url: 'save_opd.php',
|
||
|
type: "POST",
|
||
|
data: $("#" + formId).serialize(),
|
||
|
dataType: 'JSON',
|
||
|
success: function(data) {
|
||
|
|
||
|
document.getElementById("forwardButton").style.display =
|
||
|
'block';
|
||
|
document.getElementsByClassName("loader")[0].style
|
||
|
.display = 'none';
|
||
|
|
||
|
$('#appointment_id').val(data['appointment_id']);
|
||
|
$('#followup_id').val(data['followup_id']);
|
||
|
save_leave();
|
||
|
|
||
|
BootstrapDialog.show({
|
||
|
message: 'Details Saved Successfully.',
|
||
|
buttons: [{
|
||
|
label: 'OK',
|
||
|
action: function(dialogItself) {
|
||
|
dialogItself.close();
|
||
|
|
||
|
|
||
|
if ($('#appointment_type').val() == 'I') {
|
||
|
console.log($("#attendedStatus").val() + " VAR ");
|
||
|
open_item(data['appointment_id'], $('#appointment_type')
|
||
|
.val(),
|
||
|
$('#dept_mail').val(),
|
||
|
document.location, $('#emp_mail').val());
|
||
|
// location.href =
|
||
|
// "<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
} else {
|
||
|
updateApp(data['appointment_id']);
|
||
|
location.href =
|
||
|
"<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}]
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
return;
|
||
|
},
|
||
|
error: function(data) {
|
||
|
document.getElementById("forwardButton").style.display =
|
||
|
'block';
|
||
|
document.getElementsByClassName("loader")[0].style
|
||
|
.display = 'none';
|
||
|
BootstrapDialog.alert('Error Updating Details');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
$.ajax({
|
||
|
url: 'save_opd.php',
|
||
|
type: "POST",
|
||
|
data: $("#" + formId).serialize(),
|
||
|
dataType: 'JSON',
|
||
|
success: function(data) {
|
||
|
|
||
|
document.getElementById("forwardButton").style.display =
|
||
|
'block';
|
||
|
document.getElementsByClassName("loader")[0].style
|
||
|
.display = 'none';
|
||
|
|
||
|
$('#appointment_id').val(data['appointment_id']);
|
||
|
$('#followup_id').val(data['followup_id']);
|
||
|
save_leave();
|
||
|
|
||
|
BootstrapDialog.show({
|
||
|
message: 'Details Saved Successfully.',
|
||
|
buttons: [{
|
||
|
label: 'OK',
|
||
|
action: function(dialogItself) {
|
||
|
dialogItself.close();
|
||
|
|
||
|
|
||
|
if ($('#appointment_type').val() == 'I') {
|
||
|
console.log($("#attendedStatus").val() + " VAR ");
|
||
|
open_item(data['appointment_id'], $('#appointment_type')
|
||
|
.val(),
|
||
|
$('#dept_mail').val(),
|
||
|
document.location, $('#emp_mail').val());
|
||
|
// location.href =
|
||
|
// "<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
} else {
|
||
|
updateApp(data['appointment_id']);
|
||
|
location.href =
|
||
|
"<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}]
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
return;
|
||
|
},
|
||
|
error: function(data) {
|
||
|
document.getElementById("forwardButton").style.display =
|
||
|
'block';
|
||
|
document.getElementsByClassName("loader")[0].style
|
||
|
.display = 'none';
|
||
|
BootstrapDialog.alert('Error Updating Details');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
},
|
||
|
error: function(data) {
|
||
|
BootstrapDialog.alert(
|
||
|
"something went wrong while loading the problem_response_details.");
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
function updateTotalMedicineQty(frequency_qty_fieild, treatment_item_days_fieild, treatment_item_total_fieild,
|
||
|
treatment_item_total_fieild_div) {
|
||
|
/** frequency_qty = $("#"+frequency_qty_fieild).val();
|
||
|
treatment_item_days=$("#"+treatment_item_days_fieild).val();
|
||
|
if(treatment_item_days==null || treatment_item_days=='' || treatment_item_days==0){
|
||
|
treatment_item_days =1;
|
||
|
}
|
||
|
$("#"+treatment_item_total_fieild).val(treatment_item_days*frequency_qty);
|
||
|
document.getElementById(treatment_item_total_fieild_div+"").innerText =treatment_item_days*frequency_qty;
|
||
|
**/
|
||
|
}
|
||
|
|
||
|
function updatePrice(qty_issued_field, item_id_field, current_rate_field, current_stock_field, price_field) {
|
||
|
|
||
|
/* qty_issued = $("#"+qty_issued_field).val();
|
||
|
item_id = $("#"+item_id_field).val();
|
||
|
current_rate = $("#"+current_rate_field).val();
|
||
|
current_stock = $("#"+current_stock_field).val();
|
||
|
if(parseFloat(current_stock)<parseFloat(qty_issued)){
|
||
|
BootstrapDialog.alert('You trying to issue more than the available qty. Available:'+current_stock+", issued qty:"+qty_issued);
|
||
|
|
||
|
}
|
||
|
price = $("#"+price_field).val(qty_issued*current_rate);
|
||
|
|
||
|
*/
|
||
|
}
|
||
|
|
||
|
function validate(attendedStatus) {
|
||
|
|
||
|
|
||
|
var appointment_date = $('#appointment_date').val();
|
||
|
if (appointment_date == '') {
|
||
|
BootstrapDialog.alert('Please Enter Appointment Date.!!!');
|
||
|
return false;
|
||
|
}
|
||
|
// var complaints = $('#complaints').val();
|
||
|
// if (complaints == '') {
|
||
|
// BootstrapDialog.alert('Please Enter Complaints.!!!');
|
||
|
// return false;
|
||
|
// }
|
||
|
var counter = $("#count_treatment_item").val();
|
||
|
for (var i = 0; i < counter; i++) {
|
||
|
var treatment_qty = $("#treatment_item_total_" + i).val();
|
||
|
var issued_qty = $("#treatment_item_qtygvn_" + i).val();
|
||
|
if (issued_qty == null || issued_qty == '') {
|
||
|
issued_qty = 0;
|
||
|
}
|
||
|
/* if(issued_qty>treatment_qty){
|
||
|
BootstrapDialog.alert(' Issue Qty should be less than or equal to Treatment Qty .!!!');
|
||
|
|
||
|
return false;
|
||
|
}*/
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
$("#attendedStatus").val(attendedStatus);
|
||
|
|
||
|
save_appointment();
|
||
|
}
|
||
|
|
||
|
function save_appointment() {
|
||
|
// alert(check_allergy_alert());
|
||
|
var allergiatic = check_allergy_alert();
|
||
|
if (allergiatic != '' && allergiatic != null) {
|
||
|
BootstrapDialog.alert('The Patient Have Allergy With salts: <br>' + allergiatic);
|
||
|
return false;
|
||
|
} else {
|
||
|
|
||
|
var comp = $("#complaints").val();
|
||
|
|
||
|
if ($('#date_absent').val() || $('#date_absent_to')
|
||
|
.val()) {
|
||
|
if ($('#date_absent_to').val() == '' || $('#date_absent_to').val() == null) {
|
||
|
BootstrapDialog.alert('Please Add Leave date to !!');
|
||
|
return false;
|
||
|
}
|
||
|
if ($('#date_absent').val() == '' || $('#date_absent').val() == null) {
|
||
|
BootstrapDialog.alert('Please Add Leave date from !!');
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
// if(document.getElementById("fit_day").checked==true && ($('#date_absent').val()=='' ||$('#date_absent').val()==null)){
|
||
|
// document.getElementById("forwardButton").style.display = 'block';
|
||
|
// document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
// BootstrapDialog.alert('Please Add Period Of Rest From !!');
|
||
|
// return false;
|
||
|
// }
|
||
|
|
||
|
// if(document.getElementById("fit_day").checked==true && ($('#date_absent_to').val()=='' ||$('#date_absent_to').val()==null)){
|
||
|
// document.getElementById("forwardButton").style.display = 'block';
|
||
|
// document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
// BootstrapDialog.alert('Please Add Period Of Rest To !!');
|
||
|
// return false;
|
||
|
// }
|
||
|
|
||
|
// if (document.getElementById("fit_day").checked == true && ($('#approval_date').val() == '' || $(
|
||
|
// '#approval_date').val() == null)) {
|
||
|
// document.getElementById("forwardButton").style.display = 'block';
|
||
|
// document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
// BootstrapDialog.alert('Please Add Fitness Date !!');
|
||
|
// return false;
|
||
|
// }
|
||
|
|
||
|
// if (document.getElementById("fit_day").checked == true && ($('#date_absent').val() == '' || $('#date_absent').val() == null) && ($('#date_absent_to').val() == '' || $('#date_absent_to').val() == null) ){
|
||
|
// check_sickness("opd_form");
|
||
|
// return;
|
||
|
// }
|
||
|
$.ajax({
|
||
|
url: 'save_opd.php',
|
||
|
type: "POST",
|
||
|
data: $("#opd_form").serialize(),
|
||
|
dataType: 'JSON',
|
||
|
success: function(data) {
|
||
|
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
|
||
|
if ($('#date_absent').val() || $('#date_absent_to')
|
||
|
.val()) {
|
||
|
$('#appointment_id').val(data['appointment_id']);
|
||
|
$('#followup_id').val(data['followup_id']);
|
||
|
save_leave();
|
||
|
}
|
||
|
BootstrapDialog.show({
|
||
|
message: 'Details Saved Successfully.',
|
||
|
buttons: [{
|
||
|
label: 'OK',
|
||
|
action: function(dialogItself) {
|
||
|
dialogItself.close();
|
||
|
|
||
|
if ($('#appointment_type').val() == 'I') {
|
||
|
|
||
|
|
||
|
|
||
|
open_item(data['appointment_id'], $('#appointment_type')
|
||
|
.val(),
|
||
|
$('#dept_mail').val(),
|
||
|
document.location, $('#emp_mail').val());
|
||
|
|
||
|
}
|
||
|
if (document.getElementById("ipd")) {
|
||
|
if (document.getElementById("ipd").checked == true && document.getElementById("ipd")) {
|
||
|
|
||
|
open_detention(data.appointment_id, data.$appointment_status, data.$emp_id, 'E');
|
||
|
// location.href ='detention_list.php';
|
||
|
|
||
|
} else {
|
||
|
|
||
|
|
||
|
location.href =
|
||
|
"<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
}
|
||
|
} else {
|
||
|
|
||
|
|
||
|
location.href =
|
||
|
"<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}]
|
||
|
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
return;
|
||
|
},
|
||
|
error: function(data) {
|
||
|
document.getElementById("forwardButton").style.display = 'block';
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
BootstrapDialog.alert('Error Updating Details');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$(function() {
|
||
|
var w = screen.width * .85;
|
||
|
var roleId = <?php echo $_SESSION['RoleId'] ?>;
|
||
|
var h = 0;
|
||
|
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .65;
|
||
|
|
||
|
|
||
|
$("#flex1").flexigrid({
|
||
|
|
||
|
url: 'specific_emp_appointment_history_script.php?emp_id=<?php echo ($_REQUEST['flex_opd_id'] != '' ? $_REQUEST['flex_opd_id'] : $_REQUEST['flex_patient_id']) ?>&RoleId=<?= $_SESSION['RoleId'] ?>&menu_key=<?= $menu_key ?>',
|
||
|
|
||
|
dataType: 'json',
|
||
|
colModel: [{
|
||
|
display: 'Sr',
|
||
|
name: 'count',
|
||
|
width: w * .02,
|
||
|
sortable: false,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: '',
|
||
|
name: 'link',
|
||
|
width: w * .07,
|
||
|
sortable: false,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Date',
|
||
|
name: 'appointment_date',
|
||
|
width: w * .1,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Ticket No',
|
||
|
name: 'ticket_no',
|
||
|
width: w * .07,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'ECode/G.Pass',
|
||
|
name: 'emp_code',
|
||
|
width: w * .08,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Patient Name',
|
||
|
name: 'patient_name',
|
||
|
width: w * .1,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
// {
|
||
|
// display: 'Emergency',
|
||
|
// name: 'IsEmergency',
|
||
|
// width: w * .07,
|
||
|
// sortable: true,
|
||
|
// align: 'left'
|
||
|
// },
|
||
|
{
|
||
|
display: 'Injury',
|
||
|
name: 'appointment_type',
|
||
|
width: w * .07,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Consulted By',
|
||
|
name: 'doctor_attended_flag',
|
||
|
width: w * .07,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Complaints',
|
||
|
name: 'complaints',
|
||
|
width: w * .1,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
|
||
|
{
|
||
|
display: 'Diagnosis',
|
||
|
name: 'injury_types_new',
|
||
|
width: w * .1,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Treatments',
|
||
|
name: 'hospital_treatment',
|
||
|
width: w * .15,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Absence Start',
|
||
|
name: 'date_absent',
|
||
|
width: w * .08,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
|
||
|
{
|
||
|
display: 'Rejoining Date',
|
||
|
name: 'date_return',
|
||
|
width: w * .08,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Days of Leaves',
|
||
|
name: 'date_difference',
|
||
|
width: w * .08,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
|
||
|
{
|
||
|
display: 'Referral',
|
||
|
name: 'referral',
|
||
|
width: w * .05,
|
||
|
sortable: true,
|
||
|
align: 'left'
|
||
|
},
|
||
|
|
||
|
{
|
||
|
display: 'Vitals',
|
||
|
name: 'checkup_results',
|
||
|
width: w * .07,
|
||
|
sortable: false,
|
||
|
align: 'left'
|
||
|
},
|
||
|
{
|
||
|
display: 'Doc Comment',
|
||
|
name: 'doc_comment',
|
||
|
width: w * .07,
|
||
|
sortable: false,
|
||
|
align: 'left'
|
||
|
}
|
||
|
],
|
||
|
buttons: [
|
||
|
|
||
|
|
||
|
{
|
||
|
name: 'PDF',
|
||
|
bclass: 'print',
|
||
|
onpress: pdf
|
||
|
},
|
||
|
{
|
||
|
separator: true
|
||
|
},
|
||
|
{
|
||
|
name: 'Excel',
|
||
|
bclass: 'print_excel',
|
||
|
onpress: excel
|
||
|
},
|
||
|
{
|
||
|
separator: true
|
||
|
}
|
||
|
],
|
||
|
searchitems: [
|
||
|
//{display: 'Appointment Id', name : 'appointment_id',isdefault: true},
|
||
|
{
|
||
|
display: 'Employee Code',
|
||
|
name: 'emp_code'
|
||
|
},
|
||
|
{
|
||
|
display: 'Ticket No',
|
||
|
name: 'ticket_no',
|
||
|
isdefault: true
|
||
|
},
|
||
|
{
|
||
|
display: 'Appointment Date (dd/mm/yyyy)',
|
||
|
name: 'appointment_date'
|
||
|
},
|
||
|
{
|
||
|
display: 'Appointment Date Between (dd/mm/yyyy-dd/mm/yyyy)',
|
||
|
name: 'appointment_date_between'
|
||
|
},
|
||
|
|
||
|
{
|
||
|
display: 'Complaints',
|
||
|
name: 'complaints',
|
||
|
},
|
||
|
{
|
||
|
display: 'Examination Findings',
|
||
|
name: 'examination_remarks'
|
||
|
},
|
||
|
{
|
||
|
display: 'Diagnosis',
|
||
|
name: 'ailment_name'
|
||
|
},
|
||
|
{
|
||
|
display: 'Treatments',
|
||
|
name: 'hospital_treatment'
|
||
|
},
|
||
|
// {
|
||
|
// display: 'Emergency',
|
||
|
// name: 'IsEmergency'
|
||
|
// },
|
||
|
{
|
||
|
display: 'Injury',
|
||
|
name: 'appointment_type'
|
||
|
},
|
||
|
{
|
||
|
display: 'Remarks',
|
||
|
name: 'remarks'
|
||
|
},
|
||
|
|
||
|
],
|
||
|
sortname: "appointment_date",
|
||
|
sortorder: "desc",
|
||
|
usepager: true, //pagination
|
||
|
//title:"Employee OPD",
|
||
|
useRp: true,
|
||
|
rp: 50, //records per page
|
||
|
showTableToggleBtn: false, //toggle button for the whole table
|
||
|
resizable: true,
|
||
|
// width: w,
|
||
|
height: h,
|
||
|
singleSelect: true
|
||
|
});
|
||
|
});
|
||
|
|
||
|
function pdf1(appointment_id_pdf) {
|
||
|
window.open('opd_form_pdf.php?appointment_id_pdf=' + appointment_id_pdf + '');
|
||
|
}
|
||
|
|
||
|
function pdf2(appointment_id_pdf) {
|
||
|
window.open('injury_form_pdf.php?appointment_id_pdf=' + appointment_id_pdf + '');
|
||
|
}
|
||
|
|
||
|
function pdf(appointment_id) {
|
||
|
window.open('ajax_pdf.php?appointment_id', 'OPD-Injury List');
|
||
|
}
|
||
|
|
||
|
function excel() {
|
||
|
window.open('ajax_excel.php', 'OPD-Injury List');
|
||
|
}
|
||
|
|
||
|
function loadAppointmentHistory(emp_id) {
|
||
|
$.ajax({
|
||
|
url: 'select_appointment_history.php?emp_id=' + emp_id + ' ',
|
||
|
type: 'POST',
|
||
|
success: function(data) {
|
||
|
|
||
|
jQuery(function($) {
|
||
|
$('#id-disable-check').on('click', function() {
|
||
|
var inp = $('#form-input-readonly').get(0);
|
||
|
if (inp.hasAttribute('disabled')) {
|
||
|
inp.setAttribute('readonly', 'true');
|
||
|
inp.removeAttribute('disabled');
|
||
|
inp.value = "This text field is readonly!";
|
||
|
} else {
|
||
|
inp.setAttribute('disabled', 'disabled');
|
||
|
inp.removeAttribute('readonly');
|
||
|
inp.value = "This text field is disabled!";
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$('[data-rel=tooltip]').tooltip({
|
||
|
container: 'body'
|
||
|
});
|
||
|
$('[data-rel=popover]').popover({
|
||
|
container: 'body'
|
||
|
});
|
||
|
|
||
|
autosize($('textarea[class*=autosize]'));
|
||
|
|
||
|
$('textarea.limited').inputlimiter({
|
||
|
remText: '%n character%s remaining...',
|
||
|
limitText: 'max allowed : %n.'
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
//datepicker plugin
|
||
|
//link
|
||
|
$('.date-picker').datepicker({
|
||
|
autoclose: true,
|
||
|
todayHighlight: true
|
||
|
})
|
||
|
//show datepicker when clicking on the icon
|
||
|
.next().on(ace.click_event, function() {
|
||
|
$(this).prev().focus();
|
||
|
});
|
||
|
|
||
|
//or change it into a date range picker
|
||
|
$('.input-daterange').datepicker({
|
||
|
autoclose: true,
|
||
|
format: 'dd/mm/yyyy',
|
||
|
startDate: '1d',
|
||
|
defaultDate: new Date()
|
||
|
});
|
||
|
|
||
|
|
||
|
//to translate the daterange picker, please copy the "examples/daterange-fr.js" contents here before initialization
|
||
|
$('input[name=date-range-picker]').daterangepicker({
|
||
|
'applyClass': 'btn-sm btn-success',
|
||
|
'cancelClass': 'btn-sm btn-default',
|
||
|
locale: {
|
||
|
applyLabel: 'Apply',
|
||
|
cancelLabel: 'Cancel',
|
||
|
}
|
||
|
})
|
||
|
.prev().on(ace.click_event, function() {
|
||
|
$(this).next().focus();
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
});
|
||
|
//end rerun of jquery UI element rendering
|
||
|
|
||
|
//resizeChosen();
|
||
|
//jQuery(window).on('resize', resizeChosen);
|
||
|
},
|
||
|
error: function(data) {
|
||
|
BootstrapDialog.alert('Error Populating Item');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
//$( document ).ready(function() {
|
||
|
// loadAppointmentHistory('<?php echo $_REQUEST['flex_patient_id'] ?>');
|
||
|
|
||
|
|
||
|
|
||
|
//});
|
||
|
function expandDetails(id) {
|
||
|
//$("#"+id).closest('tr').next().toggleClass('open');
|
||
|
//$("#"+id).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass('fa-angle-double-up');
|
||
|
}
|
||
|
|
||
|
|
||
|
var appointment_id = "";
|
||
|
|
||
|
function open_employee_appointment(appointmentId, appointment_type, emp_id, action) {
|
||
|
|
||
|
if (appointment_type == "O") {
|
||
|
if (action == 'V') {
|
||
|
document.forms['flex_appointment_form'].action = "view_opd.php";
|
||
|
} else if (action == 'E') {
|
||
|
document.forms["flex_appointment_form"].action = "edit_opd.php";
|
||
|
}
|
||
|
|
||
|
} else if (appointment_type == "I") {
|
||
|
if (action == 'V') {
|
||
|
document.forms['flex_appointment_form'].action = "view_injury.php";
|
||
|
} else if (action == 'E') {
|
||
|
document.forms['flex_appointment_form'].action = "edit_injury.php";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$("#flex_appointment_form").method = "post";
|
||
|
$("#flex_appointment_form").find("#appointmentId").val(appointmentId);
|
||
|
$("#flex_appointment_form").find("#flex_opd_id").val(emp_id);
|
||
|
$("#flex_appointment_form").find("#returnPage").val("appointment_list.php");
|
||
|
$("#flex_appointment_form").submit();
|
||
|
}
|
||
|
|
||
|
function open_item(appointmentId, appointment_type, dept_id, rowElement, emp_mail) {
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'block';
|
||
|
// alert(emp_mail);
|
||
|
$.ajax({
|
||
|
url: 'get_emp_app_details.php',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
'value': appointmentId,
|
||
|
'action': 'e'
|
||
|
},
|
||
|
dataType: 'json',
|
||
|
success: function(data) {
|
||
|
var app_id = data.appointment_id;
|
||
|
|
||
|
$("#appointmentId").val("");
|
||
|
$("#appointment_type").val("");
|
||
|
|
||
|
|
||
|
var to = emp_mail;
|
||
|
var to_dept = dept_id;
|
||
|
var emailContent = "";
|
||
|
|
||
|
if (appointment_type == "O") {
|
||
|
var app_root = '<?php echo getConfigKey('APP_ROOT') ?>';
|
||
|
var subject = 'OPD Report';
|
||
|
var to_list = "" + to + "," + to_dept +
|
||
|
",<?php echo getConfigKey('GENERAL_EMAIL_LIST_TO_OPD') ?>";
|
||
|
// alert(to_list);
|
||
|
var link = "" + app_root + "/opd_form_pdf.php?appointment_id_pdf=" + app_id;
|
||
|
ref_type = "OPD";
|
||
|
|
||
|
var email_list_to = to_list;
|
||
|
var email_list_cc = '<?php echo getConfigKey('GENERAL_EMAIL_LIST_CC_OPD') ?>';
|
||
|
$("#email_form").find("#subject").val(
|
||
|
'<?php echo getConfigKey('GENERAL_EMAIL_SUBJECT_OPD') ?>');
|
||
|
$("#email_form").find("#email_content").text(
|
||
|
"<div style=`text-transform: none; !important`><?php echo getConfigKey('GENERAL_EMAIL_TEXT_OPD') ?></div>"
|
||
|
);
|
||
|
emailContent += "<p>Dear Sir/Madam, </p><br>Please find below OPD case details.<br>" + "<table class=`table-bordered` width=`100%`><thead><tr><th>Date</th><th>Patient Name</th><th>Emp Code</th><th>Complaints</th><th>Findings</th></tr><thead><tbody>";
|
||
|
emailContent += "<tr><td>" + data['appointment_date'] + "</td><td>" + data['patient_name'] +
|
||
|
"</td><td>" +
|
||
|
data['emp_code'] +
|
||
|
"</td><td>" + data['complaints'] +
|
||
|
"</td><td>" + data['examination_remarks'] + "</td></tr>";
|
||
|
emailContent +=
|
||
|
"</tbody></table>";
|
||
|
emailContent += "<br><a href=" + link +
|
||
|
">OPD prescription</a> <br>";
|
||
|
message = emailContent;
|
||
|
|
||
|
} else if (appointment_type == "I") {
|
||
|
var subject = 'Injury Report';
|
||
|
var app_root = '<?php echo getConfigKey('APP_ROOT') ?>';
|
||
|
var to_list = "" + to + "," + to_dept +
|
||
|
",<?php echo getConfigKey('GENERAL_EMAIL_LIST_TO_INJURY') ?>";
|
||
|
// alert(to_list)
|
||
|
// var link = "" + app_root + "/form24_incident_report.php?appointment_id_pdf=" + app_id;
|
||
|
var link = "" + app_root + "/injury_form_pdf.php?appointment_id_pdf=" + app_id;
|
||
|
var ref_type = "INJURY";
|
||
|
var email_list_to = to_list;
|
||
|
var email_list_cc = '<?php echo getConfigKey('GENERAL_EMAIL_LIST_CC_INJURY') ?>';
|
||
|
$("#email_form").find("#subject").val(
|
||
|
'<?php echo getConfigKey('GENERAL_EMAIL_SUBJECT_INJURY') ?>');
|
||
|
emailContent +=
|
||
|
"<div style=`text-transform: none; !important`><?php echo getConfigKey('GENERAL_EMAIL_TEXT_INJURY') ?></div>";
|
||
|
|
||
|
|
||
|
emailContent += "<p>Dear Sir/Madam, </p><br>Please find below injury case details<br>" + "<table class=`table-bordered` width=`100%`><thead><tr><th>Date</th><th>Patient Name</th><th>Emp Code</th><th>Complaints</th><th>Findings</th></tr><thead><tbody>";
|
||
|
emailContent += "<tr><td>" + data['appointment_date'] + "</td><td>" + data['patient_name'] +
|
||
|
"</td><td>" +
|
||
|
data['emp_code'] +
|
||
|
"</td><td>" + data['complaints'] +
|
||
|
"</td><td>" + data['examination_remarks'] + "</td></tr>";
|
||
|
emailContent +=
|
||
|
"</tbody></table>";
|
||
|
emailContent += "<br><a href=" + link +
|
||
|
">Injury prescription</a><br> ";
|
||
|
message = emailContent;
|
||
|
|
||
|
}
|
||
|
|
||
|
// window.alert("{appointmentId}");
|
||
|
var id = appointmentId;
|
||
|
message = emailContent + "<br><p>Regards</p><br> <p>OHC Team</p>";
|
||
|
|
||
|
// resizeChosen();
|
||
|
// jQuery(window).on('resize', resizeChosen);
|
||
|
|
||
|
// send_email(ref_type, appointmentId, email_list_to, email_list_cc, subject,
|
||
|
// message);
|
||
|
},
|
||
|
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) {
|
||
|
|
||
|
$.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) {
|
||
|
document.getElementsByClassName("loader")[0].style.display = 'none';
|
||
|
location.href =
|
||
|
"<?php echo getTableFieldValue('role_master', 'role_home_page', 'role_id', $_SESSION['RoleId']) ?>"
|
||
|
},
|
||
|
error: function(data) {
|
||
|
BootstrapDialog.alert('Error in sending mail');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
$('.close').click();
|
||
|
}
|
||
|
|
||
|
function save_leave() {
|
||
|
// if (sickness_status == '' || sickness_status == null) {
|
||
|
// var box = document.getElementById("fit_day");
|
||
|
// alert(box.checked);
|
||
|
|
||
|
// if (box.checked == true) {
|
||
|
$("#sickness_status").val('DRA');
|
||
|
// } else {
|
||
|
// $("#sickness_status").val('DRP');
|
||
|
// }
|
||
|
// }
|
||
|
var sickness_status = $('#sickness_status').val();
|
||
|
flag = 1;
|
||
|
$.ajax({
|
||
|
url: 'save_sickness_for_opd_form.php',
|
||
|
type: "POST",
|
||
|
data: $("#opd_form").serialize(),
|
||
|
|
||
|
success: function(data) {
|
||
|
var history_record = $("#history_record").text();
|
||
|
|
||
|
$('#history_record').text(parseInt(history_record) + 1);
|
||
|
|
||
|
return;
|
||
|
|
||
|
},
|
||
|
error: function(data) {
|
||
|
BootstrapDialog.alert('Error Saving Fitness Details');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
var emp_id = $('#emp_id').val();
|
||
|
getProblemsData(emp_id, 'ADC', 'health_advice_name_new');
|
||
|
getProblemsData(emp_id, 'ALG', 'drug_allergy');
|
||
|
getProblemsDataForIllness(emp_id, 'abnormality');
|
||
|
getProblemsData(emp_id, 'INJ', 'injury_type_new');
|
||
|
|
||
|
function getProblemsData(emp_id, prob_code, feild_name) {
|
||
|
$.ajax({
|
||
|
url: 'getProblemData.php',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
emp_id: emp_id,
|
||
|
prob_code: prob_code,
|
||
|
form_type: 'opd',
|
||
|
},
|
||
|
dataType: 'JSON',
|
||
|
success: function(data) {
|
||
|
var id = '#' + feild_name;
|
||
|
|
||
|
var value = data.value;
|
||
|
|
||
|
$(id).val(value);
|
||
|
$(id).trigger("chosen:updated");
|
||
|
$('.select2').select2();
|
||
|
return;
|
||
|
},
|
||
|
error: function(data) {
|
||
|
BootstrapDialog.alert("something went wrong while loading the problem_response_details.");
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
function getProblemsDataForIllness(emp_id, field_name) {
|
||
|
$.ajax({
|
||
|
url: 'getProblemDataForIllness.php',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
emp_id: emp_id,
|
||
|
},
|
||
|
dataType: 'JSON',
|
||
|
success: function(data) {
|
||
|
var id = '#' + field_name;
|
||
|
|
||
|
// console.log(data);
|
||
|
// console.log(data.value);
|
||
|
// var value = data.value;
|
||
|
|
||
|
|
||
|
var valueArray = data.value;
|
||
|
var uppercaseValuesArray = valueArray.map(function(value) {
|
||
|
return value.toUpperCase();
|
||
|
});
|
||
|
var uniqueUppercaseValuesSet = new Set(uppercaseValuesArray);
|
||
|
var uniqueUppercaseValuesArray = Array.from(uniqueUppercaseValuesSet);
|
||
|
var commaSeparatedUniqueUppercaseValues = uniqueUppercaseValuesArray.join(', ');
|
||
|
|
||
|
if (commaSeparatedUniqueUppercaseValues === '') {
|
||
|
commaSeparatedUniqueUppercaseValues = 'None';
|
||
|
}
|
||
|
|
||
|
$("#abnormality_span").html(commaSeparatedUniqueUppercaseValues);
|
||
|
|
||
|
var valueIdArray = data.valueIds;
|
||
|
|
||
|
$("#abnormality").val(valueIdArray);
|
||
|
// console.log(valueIdArray);
|
||
|
|
||
|
// $(id).val(value);
|
||
|
// $(id).trigger("chosen:updated");
|
||
|
// $('.select2').select2();
|
||
|
return;
|
||
|
},
|
||
|
error: function(data) {
|
||
|
console.log("Chronic Illness Populating Error");
|
||
|
}
|
||
|
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function CommonItemsArray(array_1, array_2) {
|
||
|
var commonArray = []; // Create an array for common items in another two arrays.
|
||
|
for (var i = 0; i < array_1.length; i++) {
|
||
|
for (var j = 0; j < array_2.length; j++) {
|
||
|
if (array_1[i] == array_2[j]) { // If the item is common in both arrays
|
||
|
commonArray.push(array_1[i]); // Push common items to the array
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return commonArray; // Return the common items
|
||
|
}
|
||
|
|
||
|
function half_day_select(val) {
|
||
|
var box = document.getElementById("half_day");
|
||
|
|
||
|
if (box.checked == true) {
|
||
|
document.getElementById("half_day").value = 1;
|
||
|
} else {
|
||
|
document.getElementById("half_day").value = 0;
|
||
|
}
|
||
|
if (box.checked == true) {
|
||
|
const date = new Date();
|
||
|
|
||
|
let day = date.getDate();
|
||
|
let month = date.getMonth() + 1;
|
||
|
let year = date.getFullYear();
|
||
|
|
||
|
// This arrangement can be altered based on how we want the date's format to appear.
|
||
|
let currentDate = `${day}/${month}/${year}`;
|
||
|
|
||
|
$('#date_absent').val(currentDate);
|
||
|
$('#date_absent_to').val(currentDate);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
function intersect_safe(a, b) {
|
||
|
try {
|
||
|
var ai = 0,
|
||
|
bi = 0;
|
||
|
var result = '';
|
||
|
|
||
|
while (ai < a.length && bi < b.length) {
|
||
|
if (a[ai] < b[bi]) {
|
||
|
ai++;
|
||
|
} else if (a[ai] > b[bi]) {
|
||
|
bi++;
|
||
|
} else /* they're equal */ {
|
||
|
result += (a[ai]) + ',';
|
||
|
ai++;
|
||
|
bi++;
|
||
|
}
|
||
|
}
|
||
|
} catch (err) {
|
||
|
console.log("error in intersect safe ..");
|
||
|
}
|
||
|
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
function check_allergy_alert() {
|
||
|
|
||
|
|
||
|
var items_no = $("#count_treatment_item").val();
|
||
|
var exist_allergy = $('#drug_allergy').val();
|
||
|
var comman = '';
|
||
|
var item_salt = [];
|
||
|
|
||
|
var salt_name_arr = [];
|
||
|
|
||
|
console.log("item no " + items_no + " allery " + exist_allergy);
|
||
|
|
||
|
|
||
|
var x = 0;
|
||
|
while (x < items_no) {
|
||
|
|
||
|
|
||
|
var item_id = $('#treatment_item_' + x).val();
|
||
|
|
||
|
if (item_id != '' && item_id != null && item_id != undefined && item_id != 'undefined') {
|
||
|
|
||
|
$.ajax({
|
||
|
async: false,
|
||
|
url: 'get_item_salts_data.php',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
item_id: item_id
|
||
|
|
||
|
},
|
||
|
dataType: 'JSON',
|
||
|
success: function(data) {
|
||
|
console.log(data);
|
||
|
if (data.count > 0) {
|
||
|
|
||
|
for (var s = 0; s < data.count; s++) {
|
||
|
|
||
|
|
||
|
var salt_id = data[s];
|
||
|
|
||
|
item_salt.push(salt_id);
|
||
|
salt_name_arr[salt_id] = data.salt_name[salt_id];
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function(data) {
|
||
|
BootstrapDialog.alert(
|
||
|
"something went wrong while loading the problem_response_details.");
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
x++;
|
||
|
|
||
|
} else {
|
||
|
x++;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
comman += intersect_safe(item_salt, exist_allergy);
|
||
|
var allergiatic = ''
|
||
|
|
||
|
comman = comman.split(',');
|
||
|
for (var a = 0; a < comman.length; a++) {
|
||
|
var comman_salt_id = comman[a];
|
||
|
if (comman[a] != '' && comman[a] != null && comman[a] != 0 && comman[a] != undefined) {
|
||
|
allergiatic += '<b>' + salt_name_arr[comman_salt_id] + '</b><br>';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return allergiatic;
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
function open_pdf_fitness_certificate(sickness_id, certificate) {
|
||
|
var link = '';
|
||
|
if (certificate == 'rest') link = 'medical_certificate_rest_pdf.php';
|
||
|
else if (certificate == 'duty') link = 'medical_certificate_fitness_duty_pdf.php';
|
||
|
else if (certificate == 'fitness') link = 'fitness_certificate.php';
|
||
|
else if (certificate == 'experience') link = 'experience_certificate_pdf.php';
|
||
|
else link = '';
|
||
|
|
||
|
$("#flex_sickness_id").val(sickness_id);
|
||
|
$("#flex_form_sickness").attr('method', 'POST');
|
||
|
$("#flex_form_sickness").attr('target', '_blank');
|
||
|
$("#flex_form_sickness").attr('action', link);
|
||
|
$("#flex_form_sickness").submit();
|
||
|
}
|
||
|
|
||
|
function openFitDiv() {
|
||
|
|
||
|
var box = document.getElementById("fit_day");
|
||
|
if (box != '' && box != null) {
|
||
|
if (box.checked == true) {
|
||
|
|
||
|
$('#approval_date').datepicker("setDate", new Date(<?= $approval_date; ?>));
|
||
|
|
||
|
|
||
|
$("#fit_day").val(1);
|
||
|
$("#approval_status").val('<?= $fitness_status ?>');
|
||
|
$("#des").val('<?= $des ?>');
|
||
|
// $('#fitness_div').show();
|
||
|
|
||
|
} else {
|
||
|
//$('#fitness_div').hide();
|
||
|
$("#fit_day").val(0);
|
||
|
$("#approval_date").val('');
|
||
|
$("#des").val('');
|
||
|
$("#approval_status").val('');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// function updateApp(id){
|
||
|
// $.ajax({
|
||
|
// url: 'update_book_app.php',
|
||
|
// data: {
|
||
|
// id: id,
|
||
|
// app_type:'OPD',
|
||
|
// emp_id:$('#emp_id').val(),
|
||
|
// checkdown_date:$('#appointment_date').val(),
|
||
|
// },
|
||
|
|
||
|
// type: 'POST',
|
||
|
// success: function(data) {
|
||
|
// var checkId = JSON.parse(data);
|
||
|
// if(checkId!='' && checkId!=null){
|
||
|
// open_mail_book_app(checkId,'save');
|
||
|
// }
|
||
|
// },
|
||
|
// error: function(data) {
|
||
|
// BootstrapDialog.alert('Error Populating Checkup Form ');
|
||
|
// return;
|
||
|
// }
|
||
|
// });
|
||
|
|
||
|
// }
|
||
|
|
||
|
openFitDiv();
|
||
|
|
||
|
|
||
|
function open_mail_book_app(appointmentId, type) {
|
||
|
|
||
|
|
||
|
|
||
|
$.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 + "/opd_form_pdf.php?appointment_id_pdf=" + data.app_id;
|
||
|
// var link = "" + app_root + "/opd_form_pdf.php?appointment_id_pdf=" + app_id;
|
||
|
var emailContent = "";
|
||
|
var status = '';
|
||
|
var sub_status = '';
|
||
|
sub_status = 'completed';
|
||
|
status = "<font color=green>completed</font> ";
|
||
|
data.app_type = 'OPD/ Sickness/ Fitness';
|
||
|
|
||
|
|
||
|
var email_list_to = data.emp_mail;
|
||
|
var email_list_cc = data.doc_mail;
|
||
|
// var app_root = '<?php echo getConfigKey('APP_ROOT') ?>';
|
||
|
|
||
|
ref_type = "Appointments Booked";
|
||
|
|
||
|
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 +
|
||
|
">More Details</a> ";
|
||
|
|
||
|
emailContent += "<p> Regards,</p><p> Team OHC</p>";
|
||
|
|
||
|
message = emailContent;
|
||
|
|
||
|
|
||
|
var id = appointmentId;
|
||
|
message = emailContent;
|
||
|
|
||
|
send_email_book_app(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_book_app(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) {
|
||
|
|
||
|
return;
|
||
|
|
||
|
},
|
||
|
error: function(data) {
|
||
|
BootstrapDialog.alert('Error in sending mail');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
$('.close').click();
|
||
|
}
|
||
|
</script>
|