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

654 lines
26 KiB
PHP

<?php
$query = "SELECT * FROM sickness where emp_id='$flex_opd_id' AND doctor_last_attended='0' ";
// echo $query;
$existingAilmentList = "";
$result = @mysqli_query($conn, $query);
while ($row = mysqli_fetch_assoc($result)) {
$emp_id = $row['emp_id'];
$sickness_id = $row['sickness_id'];
$past_ticket_no = $row['ticket_no'];
$past_agency = $row['agency'];
$past_des = $row['des_future'];
$past_from_date = $row['from_date'];
$past_to_date = $row['to_date'];
$past_date_absent = $row['date_absent'];
$past_date_absent_to = $row['date_absent_to'];
$past_date_return = $row['date_return'];
$existingAilmentList = $row['ailment_name'];
$ailment_id = $row['ailment_system'];
$certificate_type=$row['certificate_type'];
}
?>
<form name="sickness_form_employee" id="sickness_form_employee" role="form-horizontal">
<div class="row">
<div class="col-xs-12 widget-container-col" id="widget-container-col-1">
<div class="widget-box box box-warning" id="widget-box-1">
<div class="widget-header">
<h5 class="widget-title">Fitness form &nbsp; <?= $patient_name ?> &nbsp;<a target="_blank"
href="emp_dashboard.php?flex_patient_id=<?= $flex_opd_id ?>"><i style="font-size: 17px;"
class="glyphicon glyphicon-user"></i></a>
<div class="widget-toolbar">
<div class="clearfix">
<div class="pull-right tableTools-container">
<div class="dt-buttons btn-overlap btn-group">
<a class="dt-button buttons-csv buttons-html5 btn btn-white btn-primary btn-bold"
id="forwardButton" tabindex="0" aria-controls="dynamic-table"
data-original-title="Send To Doctor" title="Save"><span><i
class="fa fa-save bigger-110 blue"></i> <span
class="hidden">Save</span></span></a>
<a class="dt-button buttons-print btn btn-white btn-primary btn-bold"
data-action="fullscreen" tabindex="0" aria-controls="dynamic-table"
data-original-title="Maximize" title="Maximize"><span><i
class="fa fa fa-expand bigger-110 grey"></i> <span
class="hidden">Maximize</span></span></a> <input type="hidden"
name="attendedStatus" id="attendedStatus" <?php if ($rolecode == 'DOC') { ?>
value="<?= $__STATUS_DOCTOR_ATTENDED ?>" <?php } ?>
<?php if ($rolecode == 'RCP') { ?>
value="<?= $__STATUS_RECEPTIONIST_ATTENDED ?>" <?php } ?> />
<input type="hidden" name="doctor_last_attended" id="doctor_last_attended"
<?php if ($rolecode == 'DOC') { ?> value="<?= $_SESSION['user_id'] ?>"
<?php } else { ?> value="<?= $row['doctor_last_attended'] ?>" <?php } ?> />
<!--<a class="dt-button buttons-print btn btn-white btn-primary btn-bold" data-action="fullscreen" tabindex="0" aria-controls="dynamic-table" data-original-title="" title=""><span><i class="fa fa fa-expand bigger-110 grey"></i> <span class="hidden">Maximize</span></span></a>-->
</div>
</div>
</div>
</div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-3">
<label class="control-label" for="appointment_id"><strong style="font-size: 11px">Fitness
No.:</strong></label>
<?php
//$ticket_no = getTableFieldValue('employee_appointment','max(appointment_id)');
if (isset($past_ticket_no)) {
$ticket_no = $past_ticket_no;
} else {
$ticket_no = creatingTicketNoFitness();
}
?>
<input id="ticket_no" type="hidden" name="ticket_no" value="<?php echo $ticket_no; ?>" />
<div class="input-group">
<?php echo $ticket_no; ?>
</div>
</div>
<!-- <div class="col-sm-3">
<label class="control-label" for="appointment_date"><strong
style="font-size: 11px">Token No</strong></label>
<div class="input-group">
<input id="token_no" name="token_no" type="text"
value="<?= $past_token_no; ?>" />
</div>
</div> -->
<input class=" form-control" name="certificate_type" id="certificate_type"
placeholder="Certificate Type" type='hidden' value="<?= $certificate_type?>">
<input type="hidden" name="emp_id" id="emp_id" value="<?= $flex_opd_id ?>">
<div class="col-sm-3">
<label for="role">Date</label>
<div class="input-group">
<input class="form-control" name="sickness_date" id="sickness_date" type="text" /> <span
class="input-group-addon"> <i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="col-sm-3" style="display: none;">
<label for="role">Approval Date</label>
<div class="input-group">
<input class="form-control" name="approval_date" id="approval_date" type="text" /> <span
class="input-group-addon"> <i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="col-sm-4">
<label class="control-label" for="followup_to_opd"><strong style="font-size: 11px">Follow up
to(if Applicable)</strong></label>
<div class="input-group">
<?php if ($rolecode != 'DOC' && $row['doctor_attended_flag'] == 'Y') { ?>
<?= ($row['followup_to_opd'] == '0') ? "None" : $row['followup_to_opd'] ?>
<input type="hidden" id="followup_to_opd" name="followup_to_opd"
value="<?= $row['followup_to_opd'] ?>" />
<?php } else { ?>
<select id="followup_to_opd" name="followup_to_opd">
<option value="">None</option>
<?php
$sql = "select CONCAT(ticket_no,' ',DATE_FORMAT(appointment_date,'%d-%b-%Y %l:%i %p ')) as nameCol,appointment_id from employee_appointment where appointment_type = 'I' and emp_id ='$flex_opd_id' order by appointment_date";
error_log("odddddd" . $sql);
$resultSet = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($resultSet)) {
echo "<option value='" . $row['appointment_id'] . "' selected=selected>" . $row['nameCol'] . "</option>";
} ?>
</select>
</div>
<?php } ?>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="form-group col-sm-3 ">
<label for="role">Treatment start Date</label>
<div class="input-group">
<input class="form-control" name="from_date" readOnly="readonly" id="from_date"
type="text" /> <span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="form-group col-sm-3">
<label for="role">Treatment End Date </label>
<div class="input-group">
<input class="form-control" name="to_date" readOnly="readonly" id="to_date"
type="text" /> <span class="input-group-addon"> <i
class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="form-group col-sm-3">
<label for="role">Unfit From Date</label>
<input type="hidden" class="form-control" name="sickness_id" id="sickness_id"
value="<?= $sickness_id ?>" required />
<div class="input-group">
<input class="form-control" name="date_absent" readOnly="readonly" id="date_absent"
type="text" /> <span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="form-group col-sm-3">
<label for="role">Unfit to Date</label>
<div class="input-group">
<input class="form-control" name="date_absent_to" readOnly="readonly"
id="date_absent_to" type="text" /> <span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="space-6"></div>
<!-- <div class="row"> -->
<!-- <div class="form-group col-sm-3 ">
<label for="role">Justifiable From Date</label>
<div class="input-group">
<input class="form-control" name="justifiable_from"
id="justifiable_from" type="text" /> <span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div> -->
<!-- <div class="form-group col-sm-3">
<label for="role">Justifiable To Date </label>
<div class="input-group">
<input class="form-control" name="justifiable_to"
id="justifiable_to" type="text" /> <span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="form-group col-sm-3">
<label for="role">Not Justifiable From Date</label>
<div class="input-group">
<input class="form-control" name="date_not_just"
id="date_not_just" type="text" /> <span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div> -->
<!-- <div class="form-group col-sm-3">
<label for="sickness">Not Justifiable To Date</label>
<div class="input-group">
<input class="form-control" name="date_not_just_to"
id="date_not_just_to" type="text" /> <span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div
</div> -->
<div class="space-6"></div>
<div class="form-group col-sm-3">
<label for="sickness">Date of Rejoining</label>
<div class="input-group">
<input class="form-control" name="date_return" readOnly="readonly" id="date_return"
type="text" /> <span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="space-6"></div>
<div class="form-group col-sm-3">
<label for="sickness">You Told the Dispensary About the Sickness</label>
<input type="text" class="form-control" name="des_dis" id="des_dis" placeholder=""
value="YES" required />
</div>
<div class="form-group col-sm-3">
<label for="sickness">Do You Think You Got Sick Because of Work?</label>
<select class="form-control" name="des_sick" id="des_sick" placeholder="" value=""
required />
<!-- <option value="" disabled selected>SELECT</option> -->
<option value="YES">YES</option>
<option value="NO">NO</option>
</select>
</div>
<div class="form-group col-sm-3">
<label for="sickness">What Can Be Done To Prevent It In Future?</label>
<input type="text" class="form-control" name="des_future" id="des_future" placeholder=""
value="<?= $past_des ?>" required />
</div>
</div>
<div class="space-6"></div>
<div class="row" >
<div class="form-group col-sm-3">
<label for="sickness">Treatment Given By</label> <input type="text" class="form-control"
name="agency" id="agency" placeholder="Enter Agency" value="<?= $past_agency; ?>"
required />
</div>
<div class="form-group col-sm-3">
<label for="sickness">Health status</label>
<select class="form-control" name="des" id="des" placeholder="Remarks" value="" required />
<!-- <option value="" disabled selected>SELECT</option> -->
<option value="NORMAL">NORMAL</option>
<option value="WEAK">WEAK</option>
<option value="SICK">SICK</option>
</select>
</div>
<div class="form-group col-sm-3">
<label class="control-label" for="ailment"><strong
style="font-size:11px">Diagnosis</strong></label>
<input name="ailment_system[]" type="hidden" data-placeholder="Ailments"
value="<?php echo $row['ailment_system_ids'] ?>">
<input name="injury_part[]" type="hidden" data-placeholder="Ailments"
value="<?php echo $row['injury_parts'] ?>">
<input name="health_advice_name[]" type="hidden" data-placeholder="Ailments"
value="<?php echo $row['health_advices'] ?>">
<input name="isEmergency" type="hidden" data-placeholder="Ailments"
value="<?php echo $row['IsEmergency'] ?>">
<div class="input-group">
<input name="ailment[]" type="hidden" data-placeholder="Ailments"
value="<?php echo $existingAilmentList; ?>">
<input type="text" class="form-control" id="ailment_new" name="ailment_new"
data-placeholder="Ailments">
</div>
</div>
<div class="form-group col-sm-3">
<label class="control-label" for="ailment_system"><strong style="font-size: 11px">Ailment
System</strong></label>
<?php error_log("ailment new:".$ailment_id);?>
<select class="chosen-select form-control" id="ailment_system_new" name="ailment_system_new"
data-placeholder="Ailment System">
<option value="">Select Ailment System</option>
<?php echo generateOptionForMultiple('ailment_system', 'ailment_sys_name', 'ailment_sys_id', $ailment_id, ''); ?>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<script>
$('#ailment_system_new').trigger('chosen:updated');
$('#ailment_name').trigger('chosen:updated');
$(".select2").select();
jQuery(function($) {
<?php if ($_SESSION['RoleCode'] == $_SESSION['RoleCode']) { ?>
$("#forwardButton").on("click", function() {
BootstrapDialog.show({
title: 'Forward',
message: '<select class="form-control" id="forward_status" >' +
'<option value="<?= $__STATUS_RECEPTIONIST_ATTENDED ?>">Save & Add Supporting Documents</option>' +
'<option value="<?= $__STATUS_DOCTOR_PENDING ?>">Forward To Doctor</option>',
buttons: [{
label: 'OK',
action: function() {
$("#attendedStatus").val($("#forward_status").val());
validation($("#forward_status").val())
if ($("#forward_status").val() ==
"<?= $__STATUS_RECEPTIONIST_ATTENDED ?>") {
$("#upload_sickness_docs_label").text(
'Upload Supporting Documents');
$("#sickness_upload_btn").attr('disabled', false);
} else {
BootstrapDialog.alert('Forwarded To Doctor');
location.href = "home_receptionist.php";
}
}
}]
});
});
<?php } else { ?>
validation()
<?php } ?>
if (!ace.vars['old_ie'])
$('#sickness_date').datetimepicker({
format: 'DD/MM/YYYY h:mm A', //use this option to display seconds
defaultDate: new Date(),
maxDate: new Date(),
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows ',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
}).next().on(ace.click_event, function() {
$(this).prev().focus();
});
$('#from_date').datepicker({
format: 'dd/mm/yyyy', //use this option to display seconds
//'setDate': new Date(),
endDate: "+30d",
//minDate: new Date()-10,
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows ',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
<?php if (isset($past_from_date)) { ?>
}).datepicker("setDate", new Date("<?= $past_from_date ?>"));
<?php } else { ?>
}).datepicker("setDate", new Date());
<?php } ?>
$('#to_date').datepicker({
format: 'dd/mm/yyyy', //use this option to display seconds
defaultDate: new Date("<?= $row['to_date'] ?>"),
endDate: "+30d",
//minDate: new Date()-10,
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows ',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
<?php if (isset($past_to_date)) { ?>
}).datepicker("setDate", new Date("<?= $past_to_date ?>"));
<?php } else { ?>
}).datepicker("setDate", new Date());
<?php } ?>
$('#date_absent').datepicker({
format: 'dd/mm/yyyy',
endDate: "+1d"
<?php if (isset($past_date_absent)) { ?>
}).datepicker("setDate", new Date("<?= $past_date_absent ?>"));
<?php } else { ?>
}).datepicker("setDate", new Date());
<?php } ?>
$('#date_absent_to').datepicker({
format: 'dd/mm/yyyy',
endDate: "+1d"
<?php if (isset($past_date_absent_to)) { ?>
}).datepicker("setDate", new Date("<?= $past_date_absent_to ?>"));
<?php } else { ?>
}).datepicker("setDate", new Date());
<?php } ?>
$('#date_return').datepicker({
format: 'dd/mm/yyyy', //use this option to display seconds
defaultDate: new Date("<?= $row['date_return'] ?>"),
endDate: "+30d",
//minDate: new Date()-10,
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows ',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
<?php if (isset($past_date_return)) { ?>
}).datepicker("setDate", new Date("<?= $past_date_return ?>"));
<?php } else { ?>
}).datepicker("setDate", new Date());
<?php } ?>
$('#date_not_just').datepicker({
format: 'dd/mm/yyyy',
endDate: new Date()
}).datepicker("setDate");
$('#date_not_just_to').datepicker({
format: 'dd/mm/yyyy',
endDate: new Date()
}).datepicker("setDate");
$('#justifiable_from').datepicker({
format: 'dd/mm/yyyy',
endDate: new Date()
}).datepicker("setDate");
$('#justifiable_to').datepicker({
format: 'dd/mm/yyyy',
endDate: new Date()
}).datepicker("setDate");
$('#approval_date').datepicker({
format: 'dd/mm/yyyy', //use this option to display seconds
defaultDate: new Date("<?= $row['approval_date'] ?>"),
endDate: "+30d",
//minDate: new Date()-10,
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows ',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
}).datepicker("setDate", new Date());
});
function validation() {
var date_absent = $('#date_absent').val();
if (date_absent == '') {
BootstrapDialog.alert('Please Enter Date Absent .!!!');
return false;
}
var date_return = $('#date_return').val();
if (date_return == '') {
BootstrapDialog.alert('Please Enter Date Return .!!!');
return false;
}
// var agency = $('#agency').val();
// if(agency == ''){
// BootstrapDialog.alert('Please Enter Agency .!!!');
// return false;
// }
// var name = $('#ailment').val();
// if(name == ''){
// BootstrapDialog.alert('Please Enter Ailment Name .!!!');
// return false;
// }
save();
}
$('#ailment_new').trigger('chosen:updated');
if ($('#ailment_new')) {
var ailments = new Array();
getAilments();
function getAilments() {
$.ajax({
url: 'select_ailments.php',
type: "GET",
success: function(data) {
ailments = $.parseJSON(data);
},
error: function(data) {
BootstrapDialog.alert('Error pulling Ailments');
return;
}
});
}
}
$(document).ready(function() {
if ($('#ailment_new')) {
setTimeout(function() {
var tag_input_ailments = $('#ailment_new');
try {
tag_input_ailments.tag({
placeholder: tag_input_ailments.attr('placeholder'),
source: ailments
})
//programmatically add/remove a tag
var $tag_obj = $('#ailment_new').data('tag');
//$tag_obj.add('Programmatically Added');
var existingAilments = "<?= $existingAilmentList ?>"
var existingAilments =
"<?= getCommaSeperatedValuesForInClause('select ailment_name from ailment', 'ailment_id', $existingAilmentList) ?>"
if (existingAilments != undefined && existingAilments != null && existingAilments !=
'') {
var existingAilmentsArr = existingAilments.split(",");
jQuery.each(existingAilmentsArr, function(i, val) {
$tag_obj.add(val.toUpperCase());
});
}
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch (e) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_ailments.after('<textarea id="' + tag_input_ailments.attr('id') + '" name="' +
tag_input_ailments.attr('name') + '" rows="3">' + tag_input_ailments.val() +
'</textarea>').remove();
//autosize($('#form-field-tags'));
}
var x = $("#from_date").width();
$('.tags > input').css('width', x + 30);
}, 500);
} //end Ailments*/
});
</script>
<?php include('common_ace.php'); ?>
<?php include 'support_sickness_document.php' ?>
<?php include 'image_popup_sickness.php' ?>