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

195 lines
9.7 KiB
PHP

<table border="1" height="150" width="100%">
<tr><th colspan="6" style="background-color: blue;color: white"><center>PRE-EMPLOYMENT MEDICAL EXAMINATION-<br><?php echo $date = date('d-m-Y');?></center></th></tr>
<tr>
<td><center><strong>DIVISION</strong></center></td>
<td width="10%" style="background-color: #5ae087"><center><strong >FIT</strong></center></td>
<td><center><strong>UNFIT</strong></center></td>
<td><center><strong>TOTAL</strong></center></td>
<td><center><strong>RAT Done</strong></center></td>
<td><center><strong>RAT +ve</strong></center></td>
</tr>
<?php $sql_car_fit = "select count(a.checkup_id) as count_med from checkup_form a left join patient_master b on a.emp_id = b.id where b.bu_id='3' and a.fit_unfit_status = 'FIT' and month(a.checkup_date) = month(curdate()) and checkup_type_id='20'";
$result_car_fit = mysqli_query($conn,$sql_car_fit);
$row_car_fit = mysqli_fetch_array($result_car_fit);
$car_fit = $row_car_fit['count_med'];?>
<tr>
<td><center><strong>CAR</strong></center></td>
<td style="background-color: #5ae087"><center><?php echo $row_car_fit['count_med'];?></center></td>
<?php $sql_car_unfit = "select count(a.checkup_id) as count_med from checkup_form a left join patient_master b on a.emp_id = b.id where b.bu_id='3' and a.fit_unfit_status = 'UNFIT' and month(a.checkup_date) = month(curdate()) and checkup_type_id='20'";
$result_car_unfit = mysqli_query($conn,$sql_car_unfit);
$row_car_unfit = mysqli_fetch_array($result_car_unfit);
$car_unfit = $row_car_unfit['count_med'];?>
<td><center><?php echo $row_car_unfit['count_med'];?></center></td>
<?php $sql_car_total = "select count(a.checkup_id) as count_med from checkup_form a left join patient_master b on a.emp_id = b.id where b.bu_id='3' and month(a.checkup_date) = month(curdate())";
$result_car_total = mysqli_query($conn,$sql_car_total);
$row_car_total = mysqli_fetch_array($result_car_total);
$car_total = $row_car_total['count_med'];?>
<td><center><?php echo $row_car_total['count_med'];?></center></td>
<?php $sql_car_rat = "select count(a.emp_id) as count_emp from covid_monitoring a left join patient_master b on a.emp_id = b.id where b.bu_id='3' and month(a.sample_date) = month(curdate()) ";
$result_car_rat = mysqli_query($conn,$sql_car_rat);
$row_car_rat = mysqli_fetch_array($result_car_rat);?>
<td><center><?php echo $row_car_rat['count_emp'];?></center></td>
<?php $sql_car_rat_pos = "select count(a.emp_id) as count_emp from covid_monitoring a left join patient_master b on a.emp_id = b.id where b.bu_id='3' and month(a.sample_date) = month(curdate()) and a.covid_test_result_id = '4'";
$result_car_rat_pos = mysqli_query($conn,$sql_car_rat_pos);
$row_car_rat_pos = mysqli_fetch_array($result_car_rat_pos);?>
<td><center><?php echo $row_car_rat_pos['count_emp'];?></center></td>
</tr>
<?php $sql_pwt_fit = "select count(a.checkup_id) as count_med from checkup_form a left join patient_master b on a.emp_id = b.id where b.bu_id='2' and a.fit_unfit_status = 'FIT' and month(a.checkup_date) = month(curdate()) and checkup_type_id='20'";
$result_pwt_fit = mysqli_query($conn,$sql_pwt_fit);
$row_pwt_fit = mysqli_fetch_array($result_pwt_fit);
$pwt_fit = $row_pwt_fit['count_med'];?>
<tr>
<td><center><strong>PWT</strong></center></td>
<td style="background-color: #5ae087"><center><?php echo $row_pwt_fit['count_med'];?></center></td>
<?php $sql_pwt_unfit = "select count(a.checkup_id) as count_med from checkup_form a left join patient_master b on a.emp_id = b.id where b.bu_id='2' and a.fit_unfit_status = 'UNFIT' and month(a.checkup_date) = month(curdate()) and checkup_type_id='20'";
$result_pwt_unfit = mysqli_query($conn,$sql_pwt_unfit);
$row_pwt_unfit = mysqli_fetch_array($result_pwt_unfit);
$pwt_unfit = $row_pwt_unfit['count_med'];?>
<td><center><?php echo $row_pwt_unfit['count_med'];?></center></td>
<?php $sql_pwt_total = "select count(a.checkup_id) as count_med from checkup_form a left join patient_master b on a.emp_id = b.id where b.bu_id='2' and month(a.checkup_date) = month(curdate())";
$result_pwt_total = mysqli_query($conn,$sql_pwt_total);
$row_pwt_total = mysqli_fetch_array($result_pwt_total);
$pwt_total = $row_pwt_total['count_med'];?>
<td><center><?php echo $row_pwt_total['count_med'];?></center></td>
<?php $sql_pwt_rat = "select count(a.emp_id) as count_emp from covid_monitoring a left join patient_master b on a.emp_id = b.id where b.bu_id='2' and month(a.sample_date) = month(curdate()) ";
$result_pwt_rat = mysqli_query($conn,$sql_pwt_rat);
$row_pwt_rat = mysqli_fetch_array($result_pwt_rat);
$tot_pwt_rat = $row_pwt_rat['count_emp'];?>
<td><center><?php echo $tot_pwt_rat;?></center></td>
<?php $sql_pwt_rat_pos = "select count(a.emp_id) as count_emp from covid_monitoring a left join patient_master b on a.emp_id = b.id where b.bu_id='2' and month(a.sample_date) = month(curdate()) and a.covid_test_result_id = '4'";
$result_pwt_rat_pos = mysqli_query($conn,$sql_pwt_rat_pos);
$row_pwt_rat_pos = mysqli_fetch_array($result_pwt_rat_pos);
$tot_pwt_rat_pos = $row_pwt_rat_pos['count_emp'];?>
<td><center><?php echo $tot_pwt_rat_pos;?></center></td>
</tr>
<tr>
<td><center><strong>TOTAL</strong></center></td>
<td style="background-color: #5ae087"><center><?php echo ($car_fit+$pwt_fit);?></center></td>
<td><center><?php echo ($car_unfit+$pwt_unfit)?></center></td>
<td><center><?php echo ($car_total+$pwt_total)?></center></td>
<td><center><?php echo ($tot_car_rat + $tot_pwt_rat);?></center></td>
<td><center><?php echo ($tot_car_rat_pos + $tot_pwt_rat_pos);?></center></td>
</tr>
</table>
<br>
<table border="1" height="150" width="100%">
<tr><th colspan="3" style="background-color: blue;color: white"><center>2022 COVID CASES</center></th></tr>
<?php $sql_covid = "select count(id) as covid_count from covid_monitoring where hq_fromdate != '' and prest_fromdate != ''";
$result_covid = mysqli_query($conn,$sql_covid);
$row_covid = mysqli_fetch_array($result_covid);?>
<tr>
<td colspan="2"><strong>Progressive</strong></td>
<td><center><?php echo $row_covid['covid_count'];?></center></td>
</tr>
<?php $sql_covid_active = "select count(id) as covid_count from covid_monitoring where hq_fromdate = '' and prest_fromdate = ''";
$result_covid_active = mysqli_query($conn,$sql_covid_active);
$row_covid_active = mysqli_fetch_array($result_covid_active);?>
<tr>
<td colspan="2" style="background-color: red"><strong>ACTIVE</strong></td>
<td style="background-color: red"><center><?php echo $row_covid_active['covid_count'];?></center></td>
</tr>
<?php $sql_covid_rat = "select count(id) as covid_count from covid_monitoring where covid_test_result_id='4'";
$result_covid_rat = mysqli_query($conn,$sql_covid_rat);
$row_covid_rat = mysqli_fetch_array($result_covid_rat);?>
<tr>
<td rowspan="2" width="30%"><strong>Reportable</strong></td>
<td width="30%"><strong>Detected in RAT</strong></td>
<td><center><?php echo $row_covid_rat['covid_count']?></center></td>
</tr>
<tr>
<td><strong>Reported From Out of Plant</strong></td>
<td></td>
</tr>
</table>
<br>
<table border="1" height="150" width="100%">
<tr><th colspan="6" style="background-color: blue;color: white"><center>2022 INJURY</center></th></tr>
<tr>
<td><center><strong></strong></center></td>
<td><center><strong>MFG</strong></center></td>
<td><center><strong>NON MFG</strong></center></td>
<td><center><strong>TOTAL</strong></center></td>
</tr>
<tr style="background-color: yellow">
<?php $sql_lti_mfg = "select count(appointment_id) as lti_count from employee_appointment where injury_classes_new like '%18%' and injury_area_type = 'M'";
$result_lti_mfg = mysqli_query($conn,$sql_lti_mfg);
$row_lti_mfg = mysqli_fetch_array($result_lti_mfg);
$sql_lti_non_mfg = "select count(appointment_id) as lti_count from employee_appointment where injury_classes_new like '%18%' and injury_area_type = 'NM'";
$result_lti_non_mfg = mysqli_query($conn,$sql_lti_non_mfg);
$row_lti_non_mfg = mysqli_fetch_array($result_lti_non_mfg);
$total_lti = $row_lti_mfg['lti_count'] + $row_lti_non_mfg['lti_count'];?>
<td><center><strong>LTI</strong></center></td>
<td><center><?php echo $row_lti_mfg['lti_count'];?></center></td>
<td><center><?php echo $row_lti_non_mfg['lti_count'];?></center></td>
<td><center><?php echo $total_lti;?></center></td>
</tr>
<tr style="background-color: green">
<?php $sql_fa_mfg = "select count(appointment_id) as fa_count from employee_appointment where injury_classes_new like '%17%' and injury_area_type = 'M'";
$result_fa_mfg = mysqli_query($conn,$sql_fa_mfg);
$row_fa_mfg = mysqli_fetch_array($result_fa_mfg);
$sql_fa_non_mfg = "select count(appointment_id) as fa_count from employee_appointment where injury_classes_new like '%17%' and injury_area_type = 'NM'";
$result_fa_non_mfg = mysqli_query($conn,$sql_fa_non_mfg);
$row_fa_non_mfg = mysqli_fetch_array($result_fa_non_mfg);
$total_fa = $row_fa_mfg['fa_count'] + $row_fa_non_mfg['fa_count']; ?>
<td><center><strong>FA</strong></center></td>
<td><center><?php echo $row_fa_mfg['fa_count'];?></center></td>
<td><center><?php echo $row_fa_non_mfg['fa_count'];?></center></td>
<td><center><?php echo $total_fa;?></center></td>
</tr>
<tr style="background-color: skyblue">
<td><center><strong>TOTAL</strong></center></td>
<td><center><?php echo ($row_lti_mfg['lti_count'] + $row_fa_mfg['fa_count']);?></center></td>
<td><center><?php echo ($row_lti_non_mfg['lti_count'] + $row_fa_non_mfg['fa_count']);?></center></td>
<td><center><?php echo ($total_lti+$total_fa);?></center></td>
</tr>
</table>