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

371 lines
10 KiB
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>
<!--breadcrumb-->
<!-- End of breadcrumb -->
<div class="well" style="margin-left:5px;">
<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="toPage" id="toPage" />
</form>
<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_checkup.php" />
<input type="hidden" name="excel_action" id="excel_action" value="excel_chcekup.php" />
</form>
</div>
</div><!-- /.page-content -->
<!-- /.main-content -->
<script type="text/javascript">
var hiddenid = "";
$(function() {
hiddenid = $('#emp_id').val();
//var empIdHis=$('#emp_id_history').val();
//alert(empIdHis);
//alert(hiddenid);
$("#hidden_flexi_id").val(hiddenid);
$("#emp_id_history").val(hiddenid);
var w = screen.width * .90;
var h = screen.height * .50;
//document.getElementById('emp_id_history').value = var hiddenid;
//document.getElementById("emp_id_history").value = hiddenid;
$("#flex1").flexigrid({
url: 'checkup_list_by_emp_id.php?emp_id="<?php echo $_REQUEST['flex_opd_id']!=''?$_REQUEST['flex_opd_id']:$_REQUEST['emp_id_history']?>"',
dataType: 'json',
colModel: [
{
display: 'Sr',
name: 'count',
width: w * .04,
sortable: true,
align: 'left'
},
{
display: 'Checkup Date ',
name: 'checkup_date',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Ticket No',
name: '',
width: w * .07,
sortable: true,
align: 'left'
},
{
display: 'Employee',
name: 'patient_name',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'BMI ',
name: 'sbp',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'IsHyperTensed',
name: 'dbp',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Health Score',
name: 'dvrt',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: '',
name: '',
width: w * .1,
sortable: false,
align: 'left'
},
],
buttons: [
{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
separator: true
}
],
searchitems: [{
display: 'Ticket No ',
name: 'ticket_no',
isdefault: true
},
{
display: 'Employee Name ',
name: 'name'
},
{
display: 'Checkup Date (dd/mm/yyyy)',
name: 'checkup_date'
},
{
display: 'BMI',
name: 'bmi'
},
{
display: 'IsHyperTensed(Y/N)',
name: 'isHyperTensed'
},
{
display: 'Checkup Date Between (dd/mm/yyyy)-(dd/mm/yyyy)',
name: 'checkup_date_between'
},
{
display: 'Health Score',
name: 'health_score'
},
],
sortname: "checkup_id",
sortorder: "asc",
usepager: true, //pagination
useRp: true,
rp: 20, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
//width: w,
height: h,
singleSelect: true
});
});
function add() {
$("#emp_id_history").val(hiddenid);
$(".save_button").show();
$("#history_id").val("");
$("#sickness_date_history").val("");
$("#from_date_history").val("");
$("#to_date_history").val("");
$("#date_absent_History").val("");
$("#date_return_History").val("");
$("#agency_History").val("");
$("#name_History").val("");
$("#des_History").val("");
$('#modal-add-history').modal("show");
}
function pdf(appointment_id) {
window.open('ajax_pdf.php?appointment_id', 'OPD-Injury List');
//window.open('pdf_checkup.php');
}
function excel() {
var hiddenid = $('#emp_id').val();
window.location = 'excel_checkup.php?hiddenid=' + hiddenid + '';
}
function delete_checkup(checkupId) {
$("#flex_checkup_id").val(checkupId);
BootstrapDialog.confirm('Are you sure to delete the checkup?', function(result) {
if (result) {
$.ajax({
url: 'delete_checkup.php',
type: "POST",
data: $("#flex_form_checkup").serialize(),
success: function(data) {
if (data.indexOf("SUCCESS") != -1) {
var history_record = $("#history_record").text();
$('#history_record').text(parseInt(history_record) - 1);
BootstrapDialog.alert('checkup Deleted Successfully.');
$("#flex1").flexReload();
} else {
BootstrapDialog.alert('Error Deleting Checkup');
}
return;
},
error: function(data) {
BootstrapDialog.alert('Error Deleting Checkup');
return;
}
});
}
});
}
function save_history() {
$.ajax({
url: 'save_history_sickness.php',
type: "POST",
data: $("#history_form").serialize(),
success: function(data) {
BootstrapDialog.alert('History Saved Successfully.');
$("#flex1").flexReload();
},
error: function(data) {
BootstrapDialog.alert('Error Saving History');
}
});
//$('.close').click();
}
var history_id = "";
function open_history(historyId, action) {
var history_id = "";
if (action == "V") {
$(".save_button").hide();
} else {
$(".save_button").show();
}
$.ajax({
url: 'select_history_sickness.php?historyId=' + historyId + ' ',
type: 'POST',
success: function(data) {
//alert(data);
var data = $.parseJSON(data);
//alert(data);
$("#history_id").val(data.sickness_id);
$("#sickness_date_history").val(myDateFormater(data.sickness_date));
$("#from_date_history").val(myDateFormater(data.from_date));
$("#to_date_history").val(myDateFormater(data.to_date));
$("#date_absent_History").val(myDateFormater(data.date_absent));
$("#date_return_History").val(myDateFormater(data.date_return));
$("#agency_History").val(data.agency);
$("#name_History").val(data.sickness_name);
$("#des_History").val(data.des);
$("#emp_id_history").val(data.emp_id);
$('#modal-add-history').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating History');
return;
}
});
}
function myDateFormater(myDate) {
var d = new Date(myDate);
var m = d.getMonth() + 1;
var y = d.getFullYear();
var date = d.getDate();
var date = d.getDate();
// alert(date+"/"+m+"/"+y);
return date + "/" + m + "/" + y;
}
function open_checkup(checkupId, empId, action) {
//window.location = 'checkup.php?checkup_id='+checkupId+'';
//alert(id);
if (checkupId != null && checkupId != '') {
$("#flex_checkup_id").val(checkupId);
$("#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();
}
}
var emp_id =
'<?php echo ($_REQUEST['patient_id'] != '' && $_REQUEST['patient_id'] != null) ? $_POST['patient_id'] : $_REQUEST['emp_id_history']; ?>';
getProblemsData(emp_id, 'RSK', 'health_risk_name');
getProblemsData(emp_id, 'ADC', 'health_advice_name');
getProblemsData(emp_id, 'PPI', 'past_present_illness_data');
getProblemsData(emp_id, 'ABT', 'abnormalities_data');
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: 'checkup',
},
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;
}
});
}
//$("#emp_id_history").val(hiddenid);
</script>
<?php include('techsyn_footer.php'); ?>
<?php include('form/add_history_sickness.php');?>