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

55 lines
2.0 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=injury_type_excel.xls');
?>
<html>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<table border="1" style="text-aling: center;">
<tr bgcolor="#eeeeee">
<th width="5%" ;>Sr No.</th>
<th width="10%" ;>Injury Date</th>
<th width="10%" ;>Patient name</th>
<th width="10%" ;>Employee Code</th>
<th width="12%" ;>Employer</th>
</tr>
<?php
$startDateInjury = date('Y-m-d', strtotime($_POST['startDateInjury']));
$endDateInjury = date('Y-m-d', strtotime($_POST['endDateInjury']));
$sql = "SELECT a.appointment_date , a.emp_id ,b.inj_class_id from employee_appointment a INNER JOIN injury_class b ON a.injury_classes_new = b.inj_class_id where DATE_FORMAT(appointment_date,'%Y-%m-%d') between '$startDateInjury' and '$endDateInjury'";
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 $appointment_date = date('d-m-Y', strtotime($fetchData['appointment_date'])); ?>
<td><?php echo $appointment_date ?></td>
<td><?php echo getFieldFromTable('patient_name', 'patient_master', 'id', $fetchData['emp_id']); ?></td>
<td><?php echo getFieldFromTable('emp_code', 'patient_master', 'id', $fetchData['emp_id']); ?></td>
<?php $employer = getFieldFromTable('employer_contractor_id', 'patient_master', 'id', $fetchData['emp_id']); ?>
<td><?php echo getFieldFromTable('employer_contractor_name', 'employer_contractor', 'id', $employer); ?></td>
</tr>
<?php
$i++;
}
?>
</table>
</body>
</html>