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

139 lines
5.1 KiB
PHP

<?php //include('pdf_header_reverse.php');
include('includes/config/config.php');
include('includes/functions.php');
$month = $_POST['month_cov'];
$year = $_POST['year_cov'];
$month_name = date("F", mktime(0, 0, 0, $month, 10));
?>
<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>
<?php include('pdf_ohc_header.php'); ?>
<table width="100%">
<tr>
<td align="center" style="font-size: 15px"><strong>Covid Monitoring Report</strong></td>
</tr>
<tr>
<td align="left" style="font-size: 12px"><strong>For Month: <?php echo $month_name; ?></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
$sql = "select a.*, b.patient_name,b.emp_code,b.emp_cadre,b.gender, b.dob, b.primary_phone, b.village, b.post,b.ps,b.tehsil,b.district,b.state,b.pin_code,b.employer_contractor_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 where month(a.date_added) = '$month' and year(a.date_added)='$year' and b.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' ";
//echo $sql;
error_log("query: " . $sql);
$result = @mysqli_query($conn,$sql);
//echo $result;
?><tr bgcolor="#eeeeee">
<th width="3%">SL.NO</th>
<th width="4%">Emp No/GPass No</th>
<th width="4%">Date Of Reporting</th>
<th width="10%">Name of Patient</th>
<th width="3%">Age/Sex</th>
<th width="4%">Contractor</th>
<th width="7%">Department</th>
<th width="10%">Address</th>
<th width="7%">Mobile No.</th>
<th width="5%">Diagnosis</th>
<th width="5%">Category</th>
<th width="9%">Date of Recovery or Joining Duty</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']);
$address = "";
$address .= $row['village'] . ',' . $row['post'] . ',' . $row['ps'] . ',' . $row['tehsil'] . ',' . $row['district'] . ',' . $row['state'];
$cadre = getFieldFromTable('emp_cadre', 'emp_cadre', 'emp_cadre_id', $row['emp_cadre']);
$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']));
}
?><tr>
<td><?php echo ++$i ?></td>
<td><?php echo $row['emp_code'] ?></td>
<td><?php echo $date_added ?></td>
<td><?php echo $row['patient_name'] ?></td>
<td><?php echo $age ?>/<?php echo $row['gender'] ?></td>
<td><?php echo $emp_con ?></td>
<td><?php echo $row['dept_name'] ?></td>
<td><?php echo $address ?></td>
<td><?php echo $row['primary_phone'] ?></td>
<td><?php echo $row['result_name'] ?></td>
</td>
<td><?php echo $cadre ?></td>
<td><?php echo $resumed_duties_from ?></td>
</tr><?php
}
?>
</table>
<br>
<?php
//include('pdf_footer.php');
?>
<script>
$(document).ready(function() {
window.print();
});
</script>