ESH/medical_examination_excel.php

65 lines
2.6 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?php
include('includes/config/config.php');
include('includes/functions.php');
header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=medical_examination_excel.xls');
?>
<html>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<table border="1" style="text-align: center;">
<tr bgcolor="#eeeeee">
<th width="5%">Sr No.</th>
<th width="10%">Date</th>
<th width="10%">Patient name</th>
<th width="10%">Patient Category</th>
<th width="10%">Medical examination name</th>
<th width="12%">Department</th>
<th width="12%">Designation</th>
</tr>
<?php
$startDate = date('Y-m-d', strtotime($_POST['startDate']));
$endDate = date('Y-m-d', strtotime($_POST['endDate']));
$sql = "SELECT a.checkup_date ,a.emp_id ,a.checkup_type_id ,b.type_state from checkup_form a INNER JOIN checkup_type b ON a.checkup_type_id =b.checkup_type_id left join patient_master p on p.id=a.emp_id where p.patient_cat_id='" . $_POST['pat_cat'] . "' and DATE_FORMAT(a.checkup_date,'%Y-%m-%d') between '$startDate' and '$endDate' and b.type_status='Active' and b.type_state!='Yes'";
error_log($sql . "query");
$result = mysqli_query($conn, $sql);
$i = 1;
while ($fetchData = mysqli_fetch_array($result)) { ?>
<tr style="text-align: center;">
<td><?php echo $i ?></td>
<?php $checkupDate = date('d-m-Y', strtotime($fetchData['checkup_date'])); ?>
<td><?php echo $checkupDate ?></td>
<td><?php echo getFieldFromTable('patient_name', 'patient_master', 'id', $fetchData['emp_id']); ?></td>
<td><?php echo getFieldFromTable('patient_cat_name', 'patient_category', 'patient_cat_id', $_POST['pat_cat']); ?>
</td>
<td><?php echo getFieldFromTable('checkup_type_name', 'checkup_type', 'checkup_type_id', $fetchData['checkup_type_id']); ?>
</td>
<?php $dept = getFieldFromTable('dept_id', 'patient_master', 'id', $fetchData['emp_id']); ?>
<td><?php echo getFieldFromTable('dept_name', 'department', 'dept_id', $dept); ?></td>
<?php $designation = getFieldFromTable('designation_id', 'patient_master', 'id', $fetchData['emp_id']); ?>
<td><?php echo getFieldFromTable('designation_name', 'designation', 'designation_id', $designation); ?></td>
</tr>
<?php
$i++;
}
?>
</table>
</body>
</html>