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

222 lines
5.6 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
$year = $_POST['year'];
error_log('year'.$year);
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<style>
@page {
margin: 15px;
}
.btn {
background-color: #4CAF50;
border-radius: 5%;
/* Green */
border: none;
color: white;
padding: 5px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
margin: 4px 2px;
cursor: pointer;
}
@media print {
#printPageButton {
display: none;
}
}
</style>
<body>
<?php include('pdf_ohc_header.php') ?>
<table width="100%">
<tr>
<td align="center" style="font-size: 15px"><strong>Pending Medical Examination Report</strong></td>
</tr>
<tr>
<td align="left" style="font-size: 12px"><strong>For Year: <?php echo $year; ?></strong></td>
<td align="right" style="font-size: 15px"><button align="center" id="printPageButton"
class="btn btn-success" onClick="window.print();">Print</button></td>
</tr>
</table>
<br>
<table border="1" width="100%" cellspacing="0">
<?php
//$month=$_POST['month'];
//$results= mysqli_query($conn,$sql_waste);
$sqll="SELECT count(*) as total FROM `medical_examination` a WHERE DATEDIFF(a.next_due_date,NOW()) <= 30 AND year(a.medical_entry_date) ='$year' ORDER BY a.medical_entry_date ASC";
$result_sqll=mysqli_query($conn,$sqll);
$num_rows=mysqli_num_rows($result_sqll);
$row0= mysqli_fetch_assoc($result_sqll);
$sql="SELECT DATE_FORMAT(a.medical_entry_date, '%d-%m-%y') as date,a.*,b.patient_name,b.dept_id,b.employer_contractor_id,b.blood_group,b.primary_phone FROM `medical_examination` a left JOIN patient_master b on a.patient_id=b.id WHERE DATEDIFF(next_due_date,NOW()) <= 30 AND year(a.medical_entry_date) ='$year' ORDER BY a.medical_entry_date ASC";
error_log($sql);
$result = mysqli_query($conn,$sql);
?>
<strong>
<tr bgcolor="#eeeeee">
<td align="left" width="2%">SR.</td>
<td align="left" width="10%">EMP CODE</td>
<td align="left" width="10%">LAST MEDICAL EXAM DATE</td>
<td align="left" width="10%"> EXAMINATION TYPE </td>
<td align="left" width="10%"> NAME </td>
<td align="left" width="8%">CONTRACTOR</td>
<td valign="top" align="left" width="5%">DEPARTMENT</td>
<td width="5%" valign="top" align="left">DUE DATE</td>
<td valign="top" align="left" width="2%">CONTACT NO</td>
</tr>
<td width="5%" valign="top" align="left">BP SCORE</td>
<td width="5%" valign="top" align="left">BMI SCORE</td>
<td width="5%" valign="top" align="left">RBS SCORE</td>
<td width="5%" valign="top" align="left">CHOLESTROL SCORE</td>
<td width="5%" valign="top" align="left">TOTAL SCORE</td>
<?php
$count=1;
while ($row1= mysqli_fetch_assoc($result)){
extract($row1);
$bp = explode("/", $row1['bp']);
$bmi_score = 0;
$bp_score = 0;
$tc_score = 0;
$rbs_score = 0;
if($row1['bmi'] > 30){
$bmi_score = 0;
}
elseif ($row1['bmi'] > 25 && $row1['bmi'] < 30) {
$bmi_score = 2;
}
else{
$bmi_score = 4;
}
if($bp[0]>140 && $bp[1]>90){
$bp_score = 0;
}
elseif ($bp[0]>120 && $bp[0]<140 && $bp[1]>80 && $bp[1]<90) {
$bp_score = 2;
}
else{
$bp_score = 4;
}
if($row1['blood_sugar_rbs'] > 200){
$rbs_score = 0;
}
elseif ($row1['blood_sugar_rbs'] > 139 && $row1['blood_sugar_rbs'] < 200) {
$rbs_score = 2;
}
else{
$rbs_score = 4;
}
if($row1['bmi'] > 30){
$bmi_score = 0;
}
elseif ($row1['bmi'] > 25 && $row1['bmi'] < 30) {
$bmi_score = 2;
}
else{
$bmi_score = 4;
}
if($row1['total_cholestrol'] > 240){
$tc_score=0;
}
else if($row1['total_cholestrol'] > 200 && $row1['total_cholestrol'] < 240){
$tc_score=2;
}
else{
$tc_score=4;
}
$total_score = $bmi_score + $bp_score + $rbs_score + $tc_score;
if($row1['task']=='peme'){
$form_name="PEME";
}else if($row1['task']=='peme_short'){
$form_name="PEME SHORT DURATION";
}else if($row1['task']=='pohc'){
$form_name="POHC";
}else if($row1['task']=='eye_check'){
$form_name="EYE CHECKUP";
}else if($row1['task']=='foodhand_exam'){
$form_name="FOOD HANDLER EXAMINATION";
}
?>
<tr>
<td><?php echo $count?></td>
<td><?php echo $row1['emp_code']?></td>
<td><?php echo date('d-m-Y', strtotime($row1['medical_entry_date']))?></td>
<td><?php echo $form_name;?></td>
<td><?php echo $row1['patient_name']?></td>
<td><?php echo getTableFieldValue('employer_contractor','employer_contractor_name',$row1['employer_contractor_id'],'id')?>
</td>
<td><?php echo getTableFieldValue('department','dept_name',$row1['dept_id'],'dept_id')?></td>
<td><?php echo date('d-m-Y', strtotime($row1['next_due_date']))?></td>
<td><?php echo $row1['primary_phone']?></td>
<td><?php echo $bmi_score?></td>
<td><?php echo $bp_score?></td>
<td><?php echo $rbs_score?></td>
<td><?php echo $tc_score?></td>
<td><?php echo $total_score;?></td>
</tr>
<?php
$count++;
}
?>
<tr Height="10px">
<td colspan="8"><b>TOTAL: &nbsp;<?php echo $row0['total']?></b></td>
</tr>
</table>
</body>
<script>
$(document).ready(function() {
window.print();
});
</script>