ESH/covid_monitoring_pdf.php

141 lines
5.5 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?php
//include('pdf_header_reverse.php');
include('includes/config/config.php');
include('includes/functions.php');
include("pdf_ohc_header.php");
include('log_entry.php');
//include('pop_up_top.php');
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<style>
.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>
<br>
<table width="100%">
<tr>
<div style="font-size: 12px">
<td width="25%" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
<td width="50%" align="center" style="font-size: 20px"><strong>COVID MONITORING REPORT</strong></td>
<td width="25%" align="center"> User : <?php echo $username ?></td>
</tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0" cellpadding="0"
style="font: Arial, Helvetica, sans-serif; font-size: XX-SMALL;">
<?php
$sql="select a.*, b.patient_name, b.gender, b.dob, b.primary_phone, b.village,b.emp_code ,b.employer_contractor_id,b.bu_id,c.name, d.result_name, e.type_name, f.dept_name from covid_monitoring a left join patient_master b on a.emp_id = b.id left join covid_patient_staying c on a.staying_id = c.id left join covid_test_result_master d on a.covid_test_result_id = d.id left join covid_contact_type_master e on a.covid_contact_id = e.id left join department f on b.dept_id = f.dept_id";
//echo $sql;
error_log("query: ".$sql);
$result = @mysqli_query($conn,$sql);
//echo $result;
?><tr bgcolor="#eeeeee"><th rowspan="2" width="2%">Sl. NO.</th><th rowspan="2" width="3%">Date</th><th rowspan="2" width="5%">Name of Employee</th><th rowspan="2" width="4%">Company/Contractor</th><th rowspan="2" width="3%">Age</th><th rowspan="2" width="3%">Gender</th><th rowspan="2" width="3%">P.No.</th><th rowspan="2" width="4%">Dept. </th><th rowspan="2" width="4%">DIV </th><th rowspan="2" width="5%">Mobile No.</th><th rowspan="2" width="4%">Health Problems/Symptoms</th><th rowspan="2" width="5%">Date of Testing/Sample Given</th><th rowspan="2" width="5%">Date of report confirmed</th><th rowspan="2" width="4%">Reports</th><th rowspan="2" rowspan="2" width="5%">Reason of home quarantine</th><th colspan="2" width="11%">Protocol Rest Duration</th><th colspan="2" width="11%">Home quarantine</th><th rowspan="2" width="5%">Date of Rejoining</th><th rowspan="2" width="5%">Travel History</th><th rowspan="2" width="5%">Remarks/Advise</th></tr>
<tr bgcolor="#eeeeee">
<th>From Date</th>
<th>To Date</th>
<th>From Date</th>
<th>To Date</th>
</tr>
<?php
$i=0;
while($row=@mysqli_fetch_array($result)){
// calculate age by dob
$emp_con = getFieldFromTable('employer_contractor_name','employer_contractor','id',$row['employer_contractor_id']);
$bu = getFieldFromTable('bu_name','bussiness_unit','bu_id',$row['bu_id']);
$age = date_diff(date_create($row['dob']), date_create('now'))->y;
$date_added=date_create($row['date_added']);
$date_added=date_format($date_added,"d-m-Y");
$dateStrVal = strtotime($row['resumed_duties_from']);
if(empty($dateStrVal)) {
$resumed_duties_from = 'NA';
} else {
$resumed_duties_from = date( 'd-m-Y', strtotime($row['resumed_duties_from']));
}
$dateStrVal2 = strtotime($row['tested_positive_on']);
if(empty( $dateStrVal2)) {
$tested_positive_on = 'NA';
} else {
$tested_positive_on = date( 'd-m-Y h:i A', strtotime($row['tested_positive_on']));
}
$dateStrVal3 = strtotime($row['discharge_on']);
if(empty($dateStrVal3)) {
$discharge_on = 'NA';
} else {
$discharge_on = date( 'd-m-Y h:i A', strtotime($row['discharge_on']));
}
$dateStrVal4 = strtotime($row['prest_fromdate']);
if(empty($dateStrVal4)) {
$prest_from = 'NA';
} else {
$prest_from = date( 'd-m-Y ', strtotime($row['prest_fromdate']));
}
$dateStrVal5 = strtotime($row['prest_todate']);
if(empty($dateStrVal5)) {
$prest_to = 'NA';
} else {
$prest_to = date( 'd-m-Y', strtotime($row['prest_todate']));
}
$dateStrVal6 = strtotime($row['hq_fromdate']);
if(empty($dateStrVal6)) {
$hq_from = 'NA';
} else {
$hq_from = date( 'd-m-Y', strtotime($row['hq_fromdate']));
}
$dateStrVal7 = strtotime($row['hq_todate']);
if(empty($dateStrVal7)) {
$hq_to = 'NA';
} else {
$hq_to = date( 'd-m-Y', strtotime($row['hq_todate']));
}
?><tr><td><?php echo ++$i?></td><td><?php echo $date_added?></td><td><?php echo $row['patient_name']?></td><td><?php echo $emp_con?></td><td><?php echo $age?></td><td><?php echo $row['gender']?></td><td><?php echo $row['emp_code']?></td><td><?php echo $row['dept_name']?></td><td><?php echo $bu?></td><td><?php echo $row['primary_phone']?></td><td><?php echo $row['health_problems']?></td><td><?php echo date( 'd-m-Y ', strtotime($row['sample_date']));?></td><td><?php echo $tested_positive_on?></td><td><?php echo $row['result_name']?></td><td><?php echo $row['type_name']?></td><td><?php echo $prest_from?></td><td><?php echo $prest_to?></td><td><?php echo $hq_from?></td><td><?php echo $hq_to?></td><td><?php echo $resumed_duties_from?></td><td><?php echo $row['travel_history']?></td><td><?php echo $row['remarks']?></td></tr><?php
}
?>
</table>
<br>
<div align="center" >
<button align ="center" id="printPageButton" class="btn btn-success" onClick="window.print();">Print</button>
</div>
<?php
//include('pdf_footer.php');
?>
<script>
$(document).ready(function(){
window.print();
});
</script>