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

332 lines
13 KiB
PHP

<?php //include('pdf_header_reverse.php');
include('includes/config/config.php');
include_once('includes/functions.php');
$from_date = $_REQUEST['startDate2'];
$to_date = $_REQUEST['endDate2'];
//include('pop_up_top.php');
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<style>
* {
font-family: 'Times New Roman', Times, serif !important;
}
.tbl2 {
font-size: 12px;
border: 1px solid black;
border-collapse: collapse;
}
.ver-write {
font-size: 10px;
border: 1px solid black;
border-collapse: collapse;
padding: 2px;
writing-mode: vertical-rl !important;
width: 20px;
transform: rotate(180deg);
transform: rotate(180deg);
}
.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;
}
}
/* .test2 {
writing-mode: vertical-rl !important;
} */
</style>
<table width="100%" class="tbl1">
<tr>
<div style="font-size:15px">
<td width="100%" align="center" style="font-size:20px;"><strong>FORM 7</strong></td>
</tr>
<tr>
<td align="center">(Prescribed under Rule 68-T and 102)</td>
</tr>
<tr>
<div style="font-size:15px">
<td width="100%" align="center" style="font-size:20px"><strong>Health Register</strong></td>
</tr>
<?php
$sql_1 = "SELECT a.*,b.patient_name,b.gender,b.dob,b.emp_code,b.hazardous_process,b.dangerous_process,b.raw_materials_exposed FROM checkup_form a left join patient_master b on a.emp_id = b.id WHERE a.checkup_id = '" . $_REQUEST['checkup_id'] . "'";
error_log("FORM32:" . $sql_1);
$result_1 = mysqli_query($conn, $sql_1);
$row_1 = mysqli_fetch_array($result_1);
?>
<tr>
<td width="30%">1.Serial Number in the register of adult worker: <b> <?php echo $row_1['emp_code'] ?></b></td>
</tr>
<tr>
<td align="left">2.Name of worker: <b> <?php echo $row_1['patient_name'] ?></b></td>
</tr>
<tr>
<td>3.Sex: <?php if ($row_1['gender'] == 'M') { ?>
<b>Male</b>
<?php } else if ($row_1['gender'] == 'F') { ?>
<b>Female</b>
<?php } ?>
</td>
</tr>
<tr>
<td align="left">4.Date of Birth:<b> <?php echo date("d-M-Y", strtotime($row_1['dob'])) ?> </b>
</td>
</tr>
</table>
<br>
<table border="1" width="100%" class="tbl2">
<?php
$sql_32 = "select *,c.emp_id,c.checkup_type_id from form_32 f left join checkup_form c on c.checkup_id=f.checkup_id where f.checkup_id = '" . $_REQUEST['checkup_id'] . "'";
$result_32 = mysqli_query($conn, $sql_32);
$num = mysqli_num_rows($result_32);
$row_32 = mysqli_fetch_assoc($result_32);
error_log("query::" . $sql_32);
error_log("number of rows:" . $num);
if ($num > 0) {
$sql = "SELECT distinct(a.checkup_id), a.*,b.hazardous_process,b.dangerous_process,b.nature_of_job,b.dept_id,b.raw_materials_exposed,b.doj,c.checkup_type_id,c.doc_findings,c.checkup_section_ids,c.fit_unfit_status,c.approve_date,c.doc_attend FROM form_32 a left join checkup_form c on a.checkup_id = c.checkup_id left join patient_master b on c.emp_id = b.id WHERE c.checkup_type_id = '" . $row_32['checkup_type_id'] . "' and c.emp_id='" . $row_32['emp_id'] . "'";
error_log("FORM32::" . $sql);
} else {
$sql = "SELECT b.*,c.* from checkup_form c left join patient_master b on c.emp_id = b.id WHERE c.checkup_type_id = '" . $row_32['checkup_type_id'] . "' and c.emp_id='" . $row_32['emp_id'] . "'";
error_log("FORM data::" . $sql);
}
$result = mysqli_query($conn, $sql);
?>
<tr>
<th width="4%" rowspan="2" class="ver-write">Department/works</th>
<th width="4%" rowspan="2" class="ver-write">Name of hazardous process</th>
<th width="4%" rowspan="2" class="ver-write">Dangerous process/operation</th>
<th width="4%" rowspan="2" class="ver-write">Nature of job/occupation</th>
<th width="4%" rowspan="2" class="ver-write">Raw materials,products or by-products likely to be exposed to</th>
<th width="4%" rowspan="2" class="ver-write">Date of joining</th>
<th width="4%" rowspan="2" class="ver-write">Date of leaving/transfer other work</th>
<th width="4%" rowspan="2" class="ver-write">Reason for discharge/transfer to other work</th>
<th colspan="4" width="40%">Medical examination Results therefore</th>
<th colspan="4" width="25%">If declared unfit for work</th>
<th rowspan="2" width="5%" class="ver-write">Signature with date of the factory Medical Officer/ the Certifying Surgeon.</th>
</tr>
<tr>
<th width="6%">Date</th>
<th width="6%">Signs and symptoms Observed during examination</th>
<th width="22%">Nature of tests & results thereof</th>
<th width="6%">Result Fit/Unfit</th>
<th width="6%">Period of temporary Withdrawal from that work</th>
<th width="7%">Reasons for such withdrawal</th>
<th width="6%">Date of declaring him Unfit for that work</th>
<th width="6%">Date of issuing fitness Certificate</th>
</tr>
<tr>
<th width="4%">1</th>
<th width="4%">2</th>
<th width="4%">3</th>
<th width="4%">4</th>
<th width="4%">5</th>
<th width="4%">6</th>
<th width="4%">7</th>
<th width="4%">8</th>
<th width="6%">9</th>
<th width="6%">10</th>
<th width="22%">11</th>
<th width="6%">12</th>
<th width="6%">13</th>
<th width="7%">14</th>
<th width="6%">15</th>
<th width="6%">16</th>
<th width="4%">17</th>
</tr>
<?php
$count = 1;
while ($row1 = mysqli_fetch_assoc($result)) {
// @extract($row1);
$doj = "";
$dateStrVal = $row1['doj'];
error_log("date joining " . $dateStrVal);
if (empty($dateStrVal) || $dateStrVal == '30-Nov-0001' || $dateStrVal == '00-00-0000' || $dateStrVal == '0000-00-00') {
$doj = 'NA';
} else {
$doj = date_format(date_create($row1['doj']), "d-m-Y");
}
$date_leaving = "NA";
$date_leavingVal = $row1['date_leaving'];
error_log("date leaving " . $date_leavingVal);
if (empty($date_leavingVal) || $date_leavingVal == '30-Nov-0001' || $date_leavingVal == '00-00-0000' || $date_leavingVal == '0000-00-00' || $date_leavingVal == null) {
$date_leaving = 'NA';
} else {
$date_leaving = date_format(date_create($row1['date_leaving']), "d-m-Y");
}
$date_unfit = "NA";
$date_unfitVal = $row1['date_unfit'];
error_log("date unfit " . $date_unfitVal);
if (empty($date_unfitVal) || $date_unfitVal == '30-Nov-0001' || $date_unfitVal == '00-00-0000' || $date_unfitVal == '0000-00-00' || $date_unfitVal == null) {
$date_unfit = 'NA';
} else {
$date_unfit = date_format(date_create($row1['date_unfit']), "d-m-Y");
}
$date_fitness = "NA";
$date_fitnessVal = $row1['date_fitness'];
error_log("date fitness " . $date_fitnessVal);
if (empty($date_fitnessVal) || $date_fitnessVal == '30-Nov-0001' || $date_fitnessVal == '00-00-0000' || $date_fitnessVal == '0000-00-00' || $date_fitnessVal == null) {
$date_fitness = 'NA';
} else {
$date_fitness = date_format(date_create($row1['date_fitness']), "d-m-Y");
}
// $ValforIn = getCommaSeperatedValuesToInClause($row1['checkup_section_ids']);
// $tests = "select group_concat(section_name) as section_name from checkup_form_section where section_name not like '%history%' and section_id in $ValforIn";
// error_log("test name " . $tests);
// $result_test = mysqli_query($conn, $tests);
// $row_test = mysqli_fetch_assoc($result_test);
$hardcode_val = "General Physical Examination,Eye Examination,Blood Investigations,Urine Investigations,Systemic Examination,Ecg,Audiometry,Spirometry,X Ray Chest.";
$tests_final = explode(",", $hardcode_val);
if ($row1['signs_symptoms'] != '' && $row1['signs_symptoms'] != null) {
$tests_final = explode(",", $row1['signs_symptoms']);
}
error_log("tests " . print_r($tests_final, true));
?>
<tr>
<td width="4%"><?php echo getFieldfromTable('dept_name', 'department', 'dept_id', $row1['dept_id']) ?></td>
<td width="4%"><?php echo getFieldFromTable('hazardous_process', 'department', 'dept_id', $row1['dept_id']); ?></td>
<td width="4%"><?php echo getFieldFromTable('dangerous_process', 'department', 'dept_id', $row1['dept_id']); ?></td>
<td width="4%"><?php echo getFieldFromTable('nature_of_job', 'department', 'dept_id', $row1['dept_id']); ?></td>
<td width="4%"><?php echo getFieldFromTable('raw_materials_exposed', 'department', 'dept_id', $row1['dept_id']); ?></td>
<td width="4%"><?php echo $doj ?></td>
<td width="4%"><?php echo $date_leaving ?></td>
<td width="4%"><?php echo $row1['reason_for_discharge'] == '' ? 'NA' : $row1['reason_for_discharge'] ?></td>
<td width="6%"><?php echo date_format(date_create($row1['approve_date']), "d-m-Y") ?></td>
<td width="6%"><?php echo $row1['doc_findings'] ?></td>
<td width="22%">
<u><b>Test Performed: </b></u>
<?php
for ($i = 0; $i < count($tests_final); $i++) {
echo "$tests_final[$i]";
?>
<br>
<?php
}
?>
<u><b>Result:</b></u> GC- GOOD, TPR/BP-Normal,Mentally sound <br> Test Reports - WNL.
</td>
<td width="6%"><?php echo $row1['fit_unfit_status'] ?></td>
<td width="6%"><?php echo $row1['period_temp_withdrawal'] == '' ? 'NA' : $row1['period_temp_withdrawal'] ?></td>
<td width="7%"><?php echo $row1['reason_withdrawal'] == '' ? 'NA' : $row1['reason_withdrawal'] ?></td>
<td width="6%"><?php echo $date_unfit ?></td>
<td width="6%"><?php echo $date_fitness ?></td>
<?php
$sql_sign = "select * from employee_signature where emp_id='" . $row1['doc_attend'] . "'";
$result_sign = mysqli_query($conn, $sql_sign);
$row_sign = mysqli_fetch_assoc($result_sign);
@extract($row_sign);
error_log("sign query " . $sql_sign);
?>
<td width="4%"><img id='sign' style="align:center; width:70px; height:30px;" class="card-img-bottm" src="data:<?= $row_sign['image_type']; ?>;base64,<?= base64_encode($row_sign['emp_sign']) ?>"><br></td>
</tr>
<?php
$count++;
}
?>
</table>
<div style="margin-top: 20px; font-size: 15px;">
<div><b>Notes:</b></div>
<ol>
<li>1.Separate page should be maintained for individual worker.</li>
<li>2. Fresh entry should be made for each examination</li>
</ol>
</div>
<?php
//include('pdf_footer.php');
?>
<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>