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

66 lines
1.6 KiB
PHP

<?php
// include('pdf_header.php');
include ('includes/config/config.php');
include ('includes/functions.php');
header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=opd_report_excel.xls');
error_reporting ( E_ERROR | E_PARSE );
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<table width="100%" >
<tr><div style="font-size:12px">
<td width="25%" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
<td width="50%" align="center" style="font-size:10px"><strong>OPD Report </strong></td>
<td width="25%" align="left"> User : <?php echo $username ?></td>
</tr>
</table>
<table border="1" width="100%">
<strong><tr bgcolor="#eeeeee"><td align="left" width="2%" >Sr.</td><td align="left" width="10%">MONTH</td><td align="left" width="10%">NO. OF CASES</td></tr>
<?php
$year= $_POST['year'];
for ($i = 1;$i<=12;$i++){
if($i<10){
$var="0".$i;
}
else{
$var=$i;
}
error_log($var);
$sql="SELECT count(*) as total,MONTHNAME(STR_TO_DATE($var, '%m')) as months FROM `employee_appointment` a WHERE a.appointment_type='O' AND DATE_FORMAT(a.appointment_date, '%m')='".$var."' and year(a.appointment_date)='".$year."'";
$result=mysqli_query($conn,$sql);
$total=mysqli_num_rows($result);
$row0= mysqli_fetch_assoc($result);
error_log($sql);
?>
<tr>
<td><?php echo $i?>
</td>
<td><?php echo $row0['months']?>
</td>
<td><?php echo $row0['total']?>
</td>
</tr>
<?php }?>
</table>
</body>