ESH/covid_screening_report_excel.php

137 lines
4.7 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');
header("Content-type:application/octet-stream");
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=covid_screening_report_excel.xls");
header("Pragma: no-cache");
header("Expires: 0");
$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('excel_ohc_header.php'); ?>
<table width="100%">
<tr>
<td align="center" style="font-size: 15px"><strong>Covid Screening Report</strong></td>
</tr>
<tr>
<td align="left" style="font-size: 12px"><strong>For :<?php echo $year ?>-<?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>
<table border="1" width="100%" cellspacing="0">
<?php
//$sql_waste="SELECT c.ohc_type_name,a.waste_category_name,b.* FROM `waste_category` a inner join bio_medical_waste b on a.waste_category_id=b.waste_category inner join ohc_type c on c.ohc_type_id=b.ohc_type_id where b.ohc_type_id='".$_SESSION['current_ohcttype']."' ";
//$results_issue_items = mysqli_query($conn,$sql_issue_items);
//$sql=base64_decode($filterkey);
//$results= mysqli_query($conn,$sql_waste);
$sqll = "select count(*) as total from covid_screening_details AS a INNER JOIN patient_master AS b ON a.patient_id=b.id INNER JOIN answer_covid AS c ON a.patient_id=c.patient_id where month(a.test_date) = '$month' and year(a.test_date)='$year' and a.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' ";
error_log("dskfncdsk" . $sqll);
$result_sqll = mysqli_query($conn,$sqll);
$num_rows = mysqli_num_rows($result_sqll);
$row0 = mysqli_fetch_assoc($result_sqll);
// error_log("total".$row0['total']);
$sql = "SELECT a.*,date_format(a.test_date,'%d-%m-%Y') as test_dt,c.rac_test,c.rac_result,c.remarks,b.patient_name,b.aadhar_no,b.primary_phone,b.designation_id,b.dept_id,b.employer_contractor_id FROM covid_screening_details AS a INNER JOIN patient_master AS b ON a.patient_id=b.id INNER JOIN answer_covid AS c ON a.patient_id=c.patient_id where month(a.test_date) = '$month' and year(a.test_date)='$year' and a.ohc_type_id='" . $_SESSION['current_ohcttype'] . "'";
error_log($sql);
$result = mysqli_query($conn,$sql);
?>
<strong>
<tr bgcolor="#eeeeee">
<td align="left" width="2%">Sr.</td>
<td align="left" width="10%">Date</td>
<td align="left" width="10%"> Name </td>
<td align="left" width="10%"> Designation </td>
<td align="left" width="10%"> Employer </td>
<td align="left" width="10%"> Department </td>
<td align="left" width="8%">Aadhar No.</td>
<td valign="top" align="left" width="5%">Phone No. </td>
<td width="5%" valign="top" align="left">RAT</td>
<td valign="top" align="left" width="2%">RAT Result</td>
<td align="left" width="10%"> Remarks </td>
</tr>
<?php
$count = 1;
while ($row1 = mysqli_fetch_assoc($result)) {
extract($row1);
// error_log($row1['employer_contractor_id']);
$designation = getFieldFromTable('designation_name', 'designation', 'designation_id', $row1['designation_id']);
$employer = getFieldFromTable('employer_contractor_name', 'employer_contractor', 'id', $row1['employer_contractor_id']);
$department = getFieldFromTable('dept_name', 'department', 'dept_id', $row1['dept_id']);
?>
<tr>
<td><?php echo $count ?></td>
<td><?php echo $row1['test_dt'] ?></td>
<td><?php echo $row1['patient_name'] ?></td>
<td><?php echo $designation ?> </td>
<td><?php echo $employer ?> </td>
<td><?php echo $department ?> </td>
<td><?php echo $row1['aadhar_no'] ?></td>
<td><?php echo $row1['primary_phone'] ?></td>
<td><?php echo $row1['rac_test'] ?></td>
<td><?php echo $row1['rac_result'] ?></td>
<td><?php echo $row1['remarks'] ?></td>
</tr>
<?php
$count++;
}
?>
<tr Height="10px">
<td colspan="8"><b>TOTAL: &nbsp;<?php echo $row0['total'] ?></b></td>
</tr>
</table>
</body>