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

421 lines
13 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>
<script>
function validate_update(formId, appointment_id){
var appointment_date = $('#appointment_date'+appointment_id).val();
if(appointment_date == ''){
BootstrapDialog.alert('Please Enter Appointment Name.!!!');
return false;
}
var complaints = $('#complaints'+appointment_id).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;
}*/
}
update_appointment(formId, appointment_id);
}
function update_appointment(formId, appointment_id){
$.ajax({
url : 'visitors_save_opd.php',
type : "POST",
data : $("#"+formId).serialize(),
success : function(data) {
BootstrapDialog.show({
message: 'Details Updated Successfully.',
buttons: [ {
label: 'OK',
action: function(dialogItself){
dialogItself.close();
window.location.reload();
}
}]
});
//window.location.reload();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Updating Details');
return;
}
});
//window.location.reload();
}
function getFrequenceyQty(frequency_id, qty_value_field_id, dosage_desc_field_id, appointment_id, counter){
/**
$.ajax({
url : 'select_frequency.php?frequency_id='+frequency_id,
type : "GET",
//data : $("#"+formId).serialize(),
success : function(data) {
var data = $.parseJSON(data);
//alert(data);
if(data.qty!=null){
$("#"+qty_value_field_id).val(data.qty);
$("#"+dosage_desc_field_id).val(data.frequency_description);
updateTotalMedicineQty('frequency_qty'+'_'+counter,'treatment_item_days'+'_'+counter,'treatment_item_total'+'_'+counter,'treatment_item_total_div'+counter)
}
//BootstrapDialog.alert('Injury Details Updated Successfully.');
//location.reload();
//return;
},
error : function(data) {
BootstrapDialog.alert('Error pulling frequency qty');
return;
}
});*/
}
function updateTotalMedicineQty(frequency_qty_fieild,treatment_item_days_fieild,treatment_item_total_fieild,treatment_item_total_fieild_div)
{
/** frequency_qt = $("#"+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 Name.!!!');
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(){
var comp= $("#complaints").val();
// alert(comp);
$.ajax({
url : 'visitors_save_opd.php',
type : "POST",
data : $("#opd_form").serialize(),
success : function(data) {
BootstrapDialog.show({
message: 'Details Saved Successfully.',
buttons: [ {
label: 'OK',
action: function(dialogItself){
dialogItself.close();
// $("#hide").attr("display","block");
$("#hide").show();
//window.location.reload();
}
}]
});
//var data = $.parseJSON(data);
if($("#appointment_id").val()==""){
var history_record= $("#history_record").text();
$('#history_record').text(parseInt(history_record)+1);
}
if(data[0].appointment_id!=null){
$("#appointment_id").val(data[0].appointment_id);
$("#appointment_id_pdf").val(data[0].appointment_id);
}
if(data[1]!=null && data[1]!=""){
for(var i=0;i<data[1].length;i++){
$("#treatment_id_"+i).val(data[1][i]);
}
}
$('#flex1').flexReload();
},
error : function(data) {
BootstrapDialog.alert('Error Saving 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: 'visitor_specific_appointment_history_script.php?emp_id=<?php echo ($_REQUEST['flex_opd_id']!=''?$_REQUEST['flex_opd_id']:$_REQUEST['flex_patient_id'])?>',
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: 'Doctor Consulted', name : 'doctor_attended_flag', width : w*.07, sortable : true, align: 'left'},
{display: 'Complaints', name : 'complaints', width : w*.1, sortable : true, align: 'left'},
{display: 'Examination Findings', name : 'examination_remarks', 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: 'Referral', name : 'referral', width : w*.05, sortable : true, align: 'left'},
{display: 'Follow-up', name : 'followup', width : w*.05, sortable : true, align: 'left'},
{display: 'Vitals', name : 'checkup_results', 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_visitor_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();
}
</script>