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

355 lines
14 KiB
PHP

<?php session_start();
// error_log($_REQUEST['patient_id']);
// error_log('Abcde');
include('log_entry.php');
include_once("includes/functions.php");
?>
<?php $sql_for_fitness = "select g.*, e.file_name,f.state, e.emp_sign as sign, e.qualification,e.registration_no,e.emp_id as sign_id, f.ohc_type_name, f.ohc_logo, f.icon_text, f.image_type from ohc_type f, sickness g left join employee_signature e on g.doctor_last_attended=e.emp_id where g.sickness_id = '" . $_REQUEST['flex_sickness_id'] . "' ";
//echo $sql_for_fitness;
//print_r($_POST);
$result_for_fitness = mysqli_query($conn, $sql_for_fitness);
$row_for_fitness = mysqli_fetch_assoc($result_for_fitness);
@extract($row_for_fitness);
$attended_doc = $row_for_fitness['doctor_last_attended'];
$doc_user_id = ($attended_doc != null && $attended_doc != 0 && $attended_doc != "") ? $attended_doc : $row_for_fitness['modified_by'];
$doc_emp_id = getTableFieldValue('tbl_users', 'emp_id', 'user_id', $doc_user_id, '');
error_log($doc_emp_id);
$doc_name = getTableFieldValue('patient_master', 'patient_name', 'id', $doc_emp_id, '');
$sickness = getTableFieldValue('ailment_system', 'ailment_sys_name', 'ailment_sys_id', $row_for_fitness['sickness_name']);
$from_date = strtoupper(date_format(date_create($row_for_fitness['from_date']), "d-M-Y "));
$to_date = strtoupper(date_format(date_create($row_for_fitness['to_date']), "d-M-Y "));
$date_return = strtoupper(date_format(date_create($row_for_fitness['date_return']), "d-M-Y "));
$justifiable_from = strtoupper(date_format(date_create($row_for_fitness['justifiable_from']), "d-M-Y "));
$justifiable_to = strtoupper(date_format(date_create($row_for_fitness['justifiable_to']), "d-M-Y "));
$not_justifiable_from = strtoupper(date_format(date_create($row_for_fitness['not_justifiable_from']), "d-M-Y "));
$not_justifiable_to = strtoupper(date_format(date_create($row_for_fitness['not_justifiable_to']), "d-M-Y "));
$appointment_date = strtoupper(date_format(date_create($row_for_fitness['sickness_date']), "d-M-Y "));
$doc_id = $row_for_fitness['doctor_last_attended'];
$mod_id = $row_for_fitness['modified_by'];
if ($doc_id != 0) {
$doc_name = getFieldFromTable('patient_name', 'patient_master', 'id', $doc_id);
} else {
$doc_name = getFieldFromTable('patient_name', 'patient_master', 'id', $doc_id);
}
error_log("doc:" . $doc_name);
$query_for_patient = "SELECT a.* , s.* from patient_master a INNER JOIN sickness s ON a.id = s.emp_id where id='" . $row_for_fitness['emp_id'] . "' ";
error_log('$query_for_patient' . $query_for_patient);
$result_for_patient = @mysqli_query($conn, $query_for_patient);
$row_for_patient = @mysqli_fetch_array($result_for_patient);
// echo $row_emp_sign['modified_by'];
$query_for_company = "select * from company_profile ";
//echo $query_for_company;
$result_for_company = @mysqli_query($conn, $query_for_company);
if ($row_for_company = @mysqli_fetch_array($result_for_company)) {
@extract($row_for_company);
}
error_log("asasasasasasas" . $row_for_patient['patient_name']);
$query_sign_master = "select * from employee_signature where emp_id='" . $row_for_fitness['doctor_last_attended'] . "' ";
error_log("sssssssssssssssssss" . $query_sign_master);
$result_sign_master = @mysqli_query($conn, $query_sign_master);
$row_sign_master = @mysqli_fetch_array($result_sign_master);
$appr_doc_sign_img = $row_sign_master['emp_sign'];
error_log("aaaaaaaaaaaaaavvvvvvvvvvvvvvvv" . $appr_doc_sign_img);
$appr_doc_image_type = $row_sign_master['image_type'];
?>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style type="text/css">
@page {
margin: 20px;
}
.btn {
background-color: #4CAF50;
border-radius: 5%;
/* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
@media print {
#printPageButton {
display: none;
}
}
</style>
<?php
$query_for_company = "select company_name, company_logo,right_com_logo, image_type,address ,ohc_details from company_profile ";
//echo $query_for_company;
$result_for_company = @mysqli_query($conn, $query_for_company);
if ($row_for_company = @mysqli_fetch_array($result_for_company)) {
@extract($row_for_company);
}
$query_for_ohc = "SELECT * FROM ohc_type WHERE ohc_type_id = '" . $_SESSION['current_ohcttype'] . "'";
//echo $query_for_ohc;
$result_for_ohc = @mysqli_query($conn, $query_for_ohc);
if ($row_for_ohc = @mysqli_fetch_array($result_for_ohc)) {
@extract($row_for_ohc);
}
?>
<table cellspacing="0" width="100%">
<tr>
<td width="20%">
<?php if ($row_for_company['company_logo'] != "" || $row_for_company['company_logo'] != null) { ?>
<center><img src="data:image/jpeg;base64,<?php echo base64_encode($row_for_company['company_logo']) ?>" style="width: 100px; height: 100px; border-radius: 10px;" /></center>
<?php } ?>
</td>
<td width="60%">
<div style="text-align: center;">
<b style="font-size:20px;font-weight: 800;color:red">
<?php echo $row_for_company['company_name'] ?>
</b>
</div>
<div style="text-align: center; margin-top:10px">
<b style="color:black;font-size:13px;">
Primary Health Care Clinic
</b>
</div>
</td>
<td width="20%">
<?php if (isset($row_for_company['right_com_logo']) && $row_for_company['right_com_logo'] != null) { ?>
<center><img src="data:image/jpeg;base64,<?php echo base64_encode($row_for_company['right_com_logo']) ?>" style="width: 100px; height: 100px;border-radius: 10px;" /></center>
<?php } ?>
</td>
</tr>
</table>
<!-- <button id="printPageButton" class="btn btn-success print" onClick="window.print();">Print</button> -->
<br>
<table align="center" width="90%">
<tr>
<td align="none" style="border: none !important;">
<b> </b><?php echo $row_for_fitness['ticket_no'] ?></b>
</td>
<td align="right">
<?php if ($appointment_date != '' && $appointment_date != null) {
echo '<b>Date:</b>' . date("d-M-Y", strtotime($appointment_date));
} ?>
</td>
</tr>
<br>
</table>
<br>
<table cellspacing="0" align="center" width="90%">
<!--
<tr>
<td align="center"><b style="font-size: 20px;font-weight: 800;text-decoration: underline;">
<?php
// $status = "";
// if ($row_for_patient['fitness_status'] == "APPROVED") {
// echo "FITNESS CERTIFICATE";
// $status = "FIT";
// } else if ($row_for_patient['fitness_status'] == "REVIEW") {
// echo "TEMPORARY UNFIT CERTIFICATE";
// $status = "TEMPORARY UNFIT";
// } else if ($row_for_patient['fitness_status'] == "REJECTED") {
// echo "UNFIT CERTIFICATE";
// $status = "UNFIT";
// }
?>
</b></td>
</tr> -->
<tr>
<td align="center"><b style="font-size: 18px;font-weight: 800;">MEDICAL CERTIFICATE</b></td>
</tr>
<tr>
<td align="center"><b style="font-size: 15px;font-weight: 500;">THIS IS TO CERTIFY THAT </b></td>
</tr>
</table>
<br>
<br>
<table align="center" width="70%">
<tr>
<td style="font-weight: 1200;border: none !important; display: flex; justify-content: center; height:40px">
<p style="width: 120.590; text-align:left;margin-top: 0px;"> Mr./Mrs./Miss</p>
<p style="width: 480px; text-align:center ;text-decoration: none; border-bottom:1px dashed;margin-top: 0px;">
<?php echo $row_for_patient['patient_name'] . ' '.$row_for_patient['father_surname']; ?> </p>
</td>
</tr>
<tr>
<td style="font-weight: 1200;border: none !important; display: flex; justify-content: center; height:40px">
<p style="width: 120.590; text-align:left;margin-top: 0px;"> clock No.</p>
<p style="width: 480px; text-align:center ;text-decoration: none; border-bottom:1px dashed;margin-top: 0px;">
<?php echo $row_for_patient['emp_code']; ?> </p>
</td>
</tr>
<tr>
<td style="font-weight: 1200;border: none !important; display: flex; justify-content: center;height:40px ">
<p style="width: 130.590; text-align:left;margin-top: 0px;"> Consulted me on</p>
<p style="width: 470px; text-align:center ;text-decoration: none; border-bottom:1px dashed;margin-top: 0px;">
<?php if ($row_for_fitness['date_absent'] != '' && $row_for_fitness['date_absent'] != null) {
echo date("d-M-Y", strtotime($row_for_fitness['date_absent']));
} ?> </p>
</td>
</tr>
<tr>
<td style="font-weight: 1200;border: none !important; display: flex; justify-content: center;height:40px ">
<p style="width: 600.590; text-align:left;margin-top: 0px;">In my opinion he is not fit for work</p>
</td>
</tr>
<tr>
<td style="font-weight: 1200;border: none !important; display: flex; justify-content: center;height:40px ">
<p style="width: 50; text-align:left;margin-top: 0px;"> From</p>
<p style="width: 215px; text-align:center ;text-decoration: none; border-bottom:1px dashed;margin-top: 0px;">
<?= date('d-m-Y',strtotime($row_for_fitness['date_absent'])) ?> </p>
<p style="width: 50px; text-align:center;margin-top: 0px;"> till</p>
<p style="width: 190px; text-align:center ;text-decoration: none; border-bottom:1px dashed;margin-top: 0px;">
<?= date('d-m-Y',strtotime($row_for_fitness['date_absent'])) ?> </p>
<p style="width: 100px; text-align:center;margin-top: 0px;"> inclusive</p>
</td>
</tr>
<tr>
<td style="font-weight: 1200;border: none !important; display: flex; justify-content: center;height:40px ">
<p style="width: 250.590; text-align:left;margin-top: 0px;"> He /She will be fit to resume duty on</p>
<p style="width: 350px; text-align:center ;text-decoration: none; border-bottom:1px dashed;margin-top: 0px;">
<?php
$fit_date=date('d-m-Y',strtotime($row_for_fitness['date_return']));
if ($fit_date != '' && $fit_date != null && $row_for_fitness['date_return']!='0000-00-00') {
echo date("d-M-Y", strtotime($fit_date));
} ?> </p>
</td>
</tr>
<tr>
<td style="font-weight: 1200;border: none !important; display: flex; justify-content: center;height:40px ">
<p style="width: 130.590; text-align:left;margin-top: 0px;"> Nature of illness:</p>
<p style="width: 470px; text-align:center ;text-decoration: none; border-bottom:1px dashed;margin-top: 0px;">
<?php
echo $row_for_fitness['comments'];
?> </p>
</td>
</table>
<br>
<table align="center" width="90%">
<tr>
<td align="left">
<?php if (!empty($row_sign_master['emp_sign'])) { ?>
<img src="data:<?php echo $row_sign_master['doc_sign_image_type'] ?>;base64,<?php echo base64_encode($row_sign_master['emp_sign']) ?>" style="width: 160px; height: 60px;" />
</td><?php } ?>
<td align="right" style="font-weight: 1200;border: none !important;"><p style="width: 200px; text-align:center ;text-decoration: none; border-bottom:1px dashed;margin-top: 0px;"><?php if ($appointment_date != '' && $appointment_date != null) {
echo '<b>Date:</b>' . date("d-M-Y", strtotime($appointment_date));
} ?></p></td>
</tr>
<!--
<tr>
<td align="right" style="font-weight: 1200;border: none !important;"><?php echo $doc_name ?></td>
</tr> -->
<tr>
<td align="right" colspan="2" style="font-weight: 1200;border: none !important;">(Date)</td>
</tr>
</table>
<div align="center">
<button align="center" id="printPageButton" class="btn btn-success" onClick="window.print();">Print</button>
</div>
<!--
<script>
$(document).ready(function() {
window.print();
});
</script> -->