ESH/covid_monitoring_excel.php

85 lines
4.4 KiB
PHP
Raw Permalink Normal View History

2024-10-23 18:28:06 +05:30
<?php //include('pdf_header.php');
include('includes/config/config.php');
//include('pop_up_top.php');
include('includes/functions.php');
header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=covid_monitoring.xls');
?>
<table border="1">
<?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";
$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
while($row=@mysqli_fetch_array($result)){
$emp_con = getFieldFromTable('employer_contractor_name','employer_contractor','id',$row['employer_contractor_id']);
$bu = getFieldFromTable('bu_name','bussiness_unit','bu_id',$row['bu_id']);
// calculate age by dob
$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>
<?php
//include('pdf_footer.php');
?>