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

927 lines
25 KiB
PHP

<?php session_start();
include('includes/config/config.php');
include_once("includes/functions.php");
include_once("log_entry.php");
mysqli_query($conn, 'SET character_set_results=utf8');
error_reporting(0);
$query = "select * from company_profile where company_id =5 ";
//echo $query;
$result = mysqli_query($conn, $query);
$row_for_company = mysqli_fetch_array($result);
@extract($row_for_company);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lora&display=swap" rel="stylesheet">
<title>Medical Examinatuin For Driving License </title>
<style>
/* .sign{
position: relative;
padding: 0 , 50px , 0 , 20px;
} */
.single_line {
padding: 10px;
}
.logo_td {
position: relative;
top: -20%;
padding-top: -20%;
}
.space {
padding-bottom: 10px;
}
.plant {
left: 37%;
}
.free {
/* top: 25px; */
left: 10%;
margin-top: -30px;
/* background-color: black; */
font-size: 19px;
color: black;
/* padding-left: 10%;
padding-right: 10%; */
}
.table_free {
position: relative;
/* left: 10%; */
/* margin-top: -50px; */
width: 70%;
}
b {
font-weight: lighter;
}
.table_2 {
left: 10%;
width: 100%;
text-align: left;
}
td.table_2 {
height: 20px;
text-align: left;
font-weight: unset;
}
.div {
padding-left: 10px;
}
th,
tr {
border-radius: 40px;
}
table {
width: 1000px;
margin-right: 50px;
border-radius: 100px;
}
.table_2_th {
background-color: powderblue;
}
.table_3 {
left: 10%;
width: 100%;
}
.table_sign {
left: 10%;
width: 100%;
}
.tt {
height: 50px;
text-align: left;
}
.table_sign_2 {
left: 10%;
width: 100%;
}
body {
font-family: Arial, Helvetica, sans-serif
}
.trans_border {
border-color: #ffffff;
}
.table_header {
border: 1px solid black;
background-color: powderblue;
}
.logo {
position: relative;
/* padding-right: 50%; */
/* margin-left: 50%; */
left: 15%;
top: 20%;
border-radius: 100px;
}
.comname {
position: relative;
left: -10%;
}
.comadd {
position: relative;
}
.btn {
position: relative;
background-color: #4CAF50;
top: -40px;
border-radius: 5%;
/* Green */
border: none;
color: white;
padding: 5px 8px;
text-align: right;
text-decoration: none;
left: 87%;
font-size: 12px;
margin: 4px 2px;
cursor: pointer;
}
@media print {
#printPageButton {
display: none;
}
}
</style>
</head>
<body>
<div class="container trans_border">
<center>
<?php
include("pdf_ohc_header.php");
?>
</center>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<button id="printPageButton" class="btn btn-success" onClick="window.print();">Print</button>
<center>
<h2 class="free">
Medical Examinatuin For Driving License
</h2>
</center>
</div>
<?php
$patient_id = $_POST['patient_id'];
$response_id = $_POST['forUpdate'];
$dlf_no = $_POST['dlf_no'];
error_log("patient_id" . $patient_id . " response_id " . $response_id . " dlf_no " . $dlf_no);
$sql_patient = "select a.*,b.question_id,b.question_remarks,
b.question_answer,date_format(a.screen_date,'%d-%m-%Y %H:%i') as screening_date,c.primary_phone,c.section_id,c.id,c.patient_name,c.blood_group,c.designation_id,c.bu_id,c.dept_id,c.dob,c.gender,c.emp_code from questionaire_master_response a
left join questionaire_master_response_details b on a.response_id = b.response_id left join patient_master c on a.patient_id = c.id where a.form_type='dlf' and a.patient_id='" . $_REQUEST['patient_id'] . "' and a.response_id='" . $_REQUEST['response_id'] . "'";
error_log("query " . $sql_patient);
$result_patient = mysqli_query($conn, $sql_patient);
$row_patient = mysqli_fetch_assoc($result_patient);
@extract($row_patient);
?>
<center>
<table class="table_free" style="border-color: grey; width:1000px">
<tr class="table_header">
<td class="table_header">
EXAMINATION NO.
</td>
<td width="15%" class="table_header">
<?= $row_patient['medical_examination_no'] ?>
</td>
<td class="table_header">
EXAMINATION DATE:
</td>
<td width="15%" class="table_header">
<?= $row_patient['screen_date']?>
</td>
</tr>
<tr class="table_header">
<td width="5%" class="table_header">
PATIENT NAME:
</td>
<td width="15%" class="table_header">
<?= $row_patient['patient_name'] ?>
</td>
<td class="table_header">
EMPLOYEE ID:
</td>
<td width="15%" class="table_header">
<?= $row_patient['emp_code']?>
</td>
</tr>
<tr class="table_header">
<td class="table_header">Age.</td>
<td width="5%" class="table_header"><?php echo datediff($row_patient['dob'],"age") ?></td>
<td width="5%" class="table_header">
GENDER
</td class="table_header">
<td width="5%" class="table_header"><?php
if ($row_patient['gender'] == "M" || $row_patient['gender'] == "m") {
echo "MALE";
} else if ($row_patient['gender'] == "F" || $row_patient['gender'] == "f") {
echo "FEMALE";
}
else
{echo "OTHER";}
?></td>
</tr>
<tr class="table_header">
<td width="5%" class="table_header">
BLOOD GROUP:
</td>
<td width="15%" class="table_header">
<?= $row_patient['blood_group'] ?>
</td>
<td width="5%" class="table_header">
DESIGNATION:
</td>
<td width="15%" class="table_header">
<?php
$desig = "select `designation_name` from `designation` where `designation_id`='" . $row_patient['designation_id'] . "'";
error_log($desig);
$designation = @mysqli_query($conn, $desig);
$desig_row = @mysqli_fetch_assoc($designation);
echo $desig_row['designation_name'];
?>
</td>
</tr>
<tr class="table_header">
<td width="5%" class="table_header">
DIVISION
</td>
<td width="15%" class="table_header">
<?php
$bu_uni = "select `bu_name` from `bussiness_unit` where `bu_id`='" . $row_patient['bu_id'] . "'";
error_log($bu_uni);
$division = @mysqli_query($conn, $bu_uni);
$div = @mysqli_fetch_assoc($division);
echo $div['bu_name'];
?>
</td>
<td width="5%" class="table_header">
DEPARTMENT
</td>
<td width="15%" class="table_header">
<?php
$dept = "select `dept_name` from `department` where `dept_id`= '" . $row_patient['dept_id'] . "'";
error_log($dept);
$department = @mysqli_query($conn, $dept);
$depart = @mysqli_fetch_assoc($department);
echo $depart['dept_name'];
?>
</td>
</tr>
<tr class="table_header">
<td class="table_header">UTE:</td>
<td width="10%" class="table_header"> <?php
$ute = "SELECT * FROM `section` WHERE `section_id`='".$row_patient['section_id']."'";
error_log('ute'.$ute);
$U = @mysqli_query($conn, $ute);
$ROW_UTE= @mysqli_fetch_assoc($U);
echo $ROW_UTE['section_name']; ?></td>
<td width="5%" class="table_header">
Contact:
</td>
<td width="15%" class="table_header">
<?= $row_patient['primary_phone'] ?>
</td>
</tr>
</table>
<table class="form-control" style="margin-top: 20px ;width: 1000px; text-align:left; margin-bottom: 20px ">
<tr class="table_header">
<td width="1%" class="table_header">
1) Identification Mark
</td>
<td class="table_header" style="text-align:left;"><?php echo $row_patient['id_mark1'] ?></td>
</tr>
<tr class="table_header">
<td width="1%" class="table_header">
2) Identification Mark
</td>
<td width="10%" class="table_header" style="text-align:left;"><?php echo $row_patient['id_mark2'] ?>
</td>
</tr>
</table>
<table class="table_free" style="border-color: grey; width: 1000px;">
<?php
$sql_dl = "select * from patient_master WHERE id ='" . $_REQUEST['patient_id'] . "' ";
// echo $_REQUEST ['flex_patient_id'] ;
$result_dl = mysqli_query($conn, $sql_dl);
$row_dl = mysqli_fetch_assoc($result_dl);
error_log('sql'.$sql_dl);
?>
<tr class="table_header">
<td width="15%" class="table_header">
HEIGHT
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['height']." Cms" ?>
</td>
<td width="15%" class="table_header">
WEIGHT
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['weight']." Kg" ?>
</td>
</tr>
<tr class="table_header">
<td width="15%" class="table_header">
BMI
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['bmi'] ?>
</td>
<td width="15%" class="table_header">
BP
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['bp']." Mm/Hg" ?>
</td>
</tr>
<tr class="table_header">
<td width="15%" class="table_header">
PULSE
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['pulse']." P/Min" ?>
</td>
<td width="15%" class="table_header">
DISTANCE VISION RT EYE
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['distance_vis_rt']
?>
</td>
</tr>
<tr class="table_header">
<td width="15%" class="table_header">
DISTANCE VISION LT EYE
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['distance_vis_lt']
?>
</td>
<td width="15%" class="table_header">
NEAR VISION RT EYE
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['near_vis_rt'] ?>
</td>
</tr>
<tr class="table_header">
<td width="15%" class="table_header">
NEAR VISION LT EYE
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient['near_vis_lt'] ?>
</td>
<td width="15%" class="table_header">
COLOR VISION AS PER (ISHIHARA CHART)
</td>
<td width="15%" class="table_header">
<?php echo " ".$row_patient["color_vis"] ?>
</td>
</tr>
</table>
<br>
<h4 style="text-align: left ; width:1000px; margin-bottom: 8px; ">
Declaration: </h4>
<table class="table_2" style="width: 1000px">
<?php
$sql_sub_section = "select sub_section_order,section_name from questionaire_master where
question_type='dlf' and sub_section_available='Y' group by sub_section_order";
$result_sub_section = mysqli_query($conn, $sql_sub_section);
$i = 0;
if (mysqli_num_rows($result_sub_section) > 0) {
while ($row_sub_section = mysqli_fetch_assoc($result_sub_section)) {
$section_name = $row_sub_section['section_name'];?>
<thead>
<tr class="table_2_th" style="display: none">
<?php
$sql_config = "select value from config where key_name = 'QUESTIONNAIRE_LANGUAGE'";
$result_config = @mysqli_query($conn, $sql_config);
$row_config = @mysqli_fetch_array($result_config);
if ($row_config['value'] == 'LOCAL_LANGUAGE') { ?>
<th>क्रमांक</th>
<th><?= $section_name ?></th>
<th>हां/नहीं</th>
<?php } elseif ($row_config['value'] == 'ENGLISH') { ?>
<th>Sr.No</th>
<th><?= $section_name ?></th>
<th>Yes/No</th>
<th>Observation and remark</th>
<?php } else { ?>
<th>क्रमांक / Sr.No</th>
<th><?= $section_name ?></th>
<th>हां/नहीं / Yes/No</th>
<th>Observation and remark</th>
<?php }?>
</tr>
</thead>
<tbody class="table_header">
<?php
$sql = "select patient_name from patient_master WHERE id ='" . $_REQUEST['patient_id'] . "' ";
// echo $_REQUEST ['flex_patient_id'] ;
if (!$result = @mysqli_query($conn, $sql)) {
exit(mysqli_error($conn));
}
if (mysqli_num_rows($result) > 0) {
while ($row = @mysqli_fetch_array($result)) {
//echo $row ['patient_name'];
}
}
error_log($sql);
?>
<?php
$row = null;
$sql = "select * from questionaire_master where question_type='dlf' and sub_section_order='" . $row_sub_section['sub_section_order'] . "' ";
$result = @mysqli_query($conn, $sql);
$num_rows = @mysqli_num_rows($result);
$row = @mysqli_fetch_array($result);
do {
?>
<tr class="table_header">
<td style="width:5%" class="table_header"><?php echo $i + 1; ?></td>
<td style="width: 60%" class="table_header">
<?php
if ($row_config['value'] == 'LOCAL_LANGUAGE') { ?>
<?php echo $row['question_hindi'] ?>
<?php } elseif ($row_config['value'] == 'ENGLISH') { ?>
<?php echo $row['question'] ?>
<?php } else { ?>
<?php echo $row['question'] ?> <?php echo $row['question_local_lang'] ?>
<?php } ?>
</td>
<?php
$sql_r = "select question_remarks,question_answer from questionaire_master_response_details a left join questionaire_master_response b on a.response_id = b.response_id where b.patient_id='" . $_REQUEST['patient_id'] . "' and a.question_id='" . $row['question_id'] . "' and b.medical_examination_no='" . $dlf_no . "'";
error_log("remarks sql " . $sql_r);
$result_r = mysqli_query($conn, $sql_r);
$row_r = mysqli_fetch_assoc($result_r);
?>
<td style="width: 20%" class="table_header">
<?php
if ($row_r['question_answer'] == 'Y') {
?>
Yes
<?php
} else {
?>
No
<?php
}
?>
</td>
<td style="width: 30%;" class="table_header">
<?php echo $row_r['question_remarks'] ?>
</td>
</tr>
<?php
$i++;
} while ($row = @mysqli_fetch_array($result));
}
?>
<?php
} else {
?>
<thead>
<tr style="display: none ;">
<?php
$sql_config = "select value from config where key_name = 'QUESTIONNAIRE_LANGUAGE'";
$result_config = @mysqli_query($conn, $sql_config);
$row_config = @mysqli_fetch_array($result_config);
if ($row_config['value'] == 'LOCAL_LANGUAGE') { ?>
<th>क्रमांक</th>
<th>कृपया नीचे दिये गए प्रश्न के उत्तर हाँ या ना मे दीजिये </th>
<th>हां/नहीं</th>
<?php } elseif ($row_config['value'] == 'ENGLISH') { ?>
<th>Sr.No</th>
<th>Please answer the questions in Yes or No</th>
<th>Yes/No</th>
<th>Observation and remark</th>
<?php } else { ?>
<th>क्रमांक / Sr.No</th>
<th>कृपया नीचे दिये गए प्रश्न के उत्तर हाँ या ना मे दीजिये / Please answer the questions in Yes
or No</th>
<th>हां/नहीं / Yes/No</th>
<th>Observation and remark</th>
<?php } ?>
</tr>
</thead>
<tbody class="table_header">
<?php
$sql = "select patient_name from patient_master WHERE id ='" . $_REQUEST['flex_patient_id'] . "' ";
// echo $_REQUEST ['flex_patient_id'] ;
if (!$result = @mysqli_query($conn, $sql)) {
exit(mysqli_error($conn));
}
if (mysqli_num_rows($result) > 0) {
while ($row = @mysqli_fetch_array($result)) {
//echo $row ['patient_name'];
}
}
error_log($sql);
?>
<?php $i = 0;
$row = null;
$sql = "select * from questionaire_master where question_type='dlf'";
$result = @mysqli_query($conn, $sql);
$num_rows = @mysqli_num_rows($result);
$row = @mysqli_fetch_array($result);
do {
$count = 0;
?>
<tr class="table_header">
<td style="width:5%" class="table_header"><b> <?php echo $i + 1; ?><b></td>
<td style="width: 60%" class="table_header">
<?php
if ($row_config['value'] == 'LOCAL_LANGUAGE') { ?>
<b><?php echo $row['question_hindi'] ?><b>
<?php } elseif ($row_config['value'] == 'ENGLISH') { ?>
<b><?php echo $row['question'] ?><b>
<?php } else { ?>
<b><?php echo $row['question'] ?> / <?php echo $row['question_hindi'] ?></b>
<?php } ?>
</td>
<?php
$sql_r = "select question_remarks,question_answer from questionaire_master_response_details a left join questionaire_master_response b on a.response_id = b.response_id where b.patient_id='" . $_REQUEST['patient_id'] . "' and a.question_id='" . ($i + 1) . "' and b.medical_examination_no='" . $dlf_no . "'";
error_log("remarks sql " . $sql_r);
$result_r = mysqli_query($conn, $sql_r);
$row_r = mysqli_fetch_assoc($result_r);
?>
<td style="width: 20%" class="table_header">
<?php
if ($row_r['question_answer'] == 'Y') {
?>
Yes
<?php
} else {
?>
No
<?php
}
?>
</td>
</tr>
<?php
$i++;
} while ($row = @mysqli_fetch_array($result));
//end of while
}
?>
</tbody>
</table>
</center>
<br>
<table class="table_sign" style="width:910px;margin-left: 90px; ;">
<tr>
<td style="height: 100px;text-align:right">
<span
style="position: relative; font-weight: bold; text-align: right; top: 30%; width: fit-content;">(Signature
Of
Individual)</span>
</td>
</tr>
</table>
<br>
<table class="form-control" style="width: 910px ;margin-left: 50px; margin-bottom:20px">
<tr>
<th style=" text-decoration: underline; padding-bottom: 10px;">
Medical Fitness Certificate
</th>
</tr>
<tr>
<td class="tt" width="20%" style="height: 0px;">
<span>This is certifying that I have personally examined the applicant</span>
</td>
</tr>
<tr>
<td class="tt" width="20%" style="height: 0px;">
<span> (i) that while examining the applicant I have directed special attention to his/her distant
vision.</span>
</td>
</tr>
<tr>
<td class="tt" width="20%" style="height: 0px;">
<span> (ii) while examining the applicant, I have directed special attention to his/her hearing
ability,</span>
</td>
</tr>
<tr>
<td class="tt" width="20%" style="height: 0px;">
<span>the condition of the arms, legs, hands and joints of both extremities of the applicant.</span>
</td>
</tr>
<tr>
<td class="tt" width="20%" style="height: 0px;">
<span> (iii) I have personally examined the applicant for reaction time, side vision, and
therefore</span>
I certify that, to the best of my judgment, he is medically
<?php if ($row_patient['remarks'] == 'FIT') {
?>
<span style="font-weight: bold">FIT</span>
<?php
} else if ($row_patient['remarks'] == 'NOT FIT') {
?>
<span style="font-weight: bold">UNFIT</span>
<?php
} else {
?>
Unhealthy but can return to work after
<?php
}
?>
to hold a driving license.
</td>
</tr>
</table>
<table class="table_sign">
<tr>
<?php
if ($row_patient['approval_user'] == null || $row_patient['approval_user'] == '' ) {?>
<td style="height: 100px;">
<center> <span>(Name of
Medical Assistant )</span></center>
</td>
<?php }else{
$medical_officer ="select b.*,c.patient_name from tbl_users a left join employee_signature b on a.emp_id = b.emp_id left join patient_master c on a.emp_id = c.id where a.user_id ='" . $row_patient['medical_attend'] . "'";
error_log("PDF EMPI ". $row_patient['medical_attend']."--". $medical_officer);
$sign_medical = @mysqli_query($conn, $medical_officer);
$sign_medical_officer = @mysqli_fetch_assoc($sign_medical);
@extract($sign_medical_officer);
?>
<td>
<center><img style=" width:150px; height:80px;" class="card-img-bottm"
src="data:<?= $sign_medical_officer['image_type']; ?>;base64,<?= base64_encode($sign_medical_officer['emp_sign']) ?>">
</center>
<center> <span><?= $sign_medical_officer['patient_name'];?></span></center>
<center> <span>(Name of Medical Assistant)
</span></center>
<?php
} ?>
</td>
<?php
if ($row_patient['approval_user'] == null || $row_patient['approval_user'] == '' ) {?>
<td style="height: 100px;">
<center> <span>(Factory Medical Officer)</span> </center>
</td>
<?php }else{
$medical_officer1 ="select b.*,c.patient_name from tbl_users a left join employee_signature b on a.emp_id = b.emp_id left join patient_master c on a.emp_id = c.id where a.user_id='" . $row_patient['approval_user'] . "'";
error_log("PDF EMPI ". $row_patient['approval_user']."--". $medical_officer1);
$sign_medical1 = @mysqli_query($conn, $medical_officer1);
$sign_medical_officer1 = @mysqli_fetch_assoc($sign_medical1);
@extract($sign_medical_officer1);
?>
<td>
<center><img style=" width:150px; height:80px;" class="card-img-bottm"
src="data:<?= $sign_medical_officer1['image_type']; ?>;base64,<?= base64_encode($sign_medical_officer1['emp_sign']) ?>">
</center>
<center> <span><?= $sign_medical_officer1['patient_name'];?></span></center>
<center> <span>(Factory Medical
Officer
)</span></center>
<?php
} ?>
</td>
</tr>
</table>
</html>
</div>