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

85 lines
2.9 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=ailment_list.xls');
?>
<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>Ailment wise Report </strong></td>
<td width="25%" align="left"> User : <?php echo $username ?></td>
</tr>
</table>
<table border="1" width="100%">
<?php
$month=$_POST['month'];
$year = $_POST['year1'];
//$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);
$ailments="SELECT * FROM `ailment_system`";
$result_ailments=mysqli_query($conn,$ailments);
$num_rows_ailments=mysqli_num_rows($result_ailments);
error_log("num_rows_ailments".$num_rows_ailments);
// $sqll="SELECT count(*) as total FROM `medical_examination` a JOIN patient_master b on a.patient_id=b.id WHERE MONTHNAME(STR_TO_DATE(DATE_FORMAT(a.medical_entry_date, '%m'), '%m'))='".$month."' AND year(a.medical_entry_date) =$year and task='ime_long' ORDER BY a.medical_entry_date ASC";
// $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 b.ailment_sys_name as name,COUNT(a.ailment_systems_new) as total FROM `employee_appointment` a , ailment_system b WHERE a.ailment_systems_new=b.ailment_sys_id AND appointment_type='O' AND ailment_systems_new!='' AND MONTHNAME(STR_TO_DATE(DATE_FORMAT(a.appointment_date, '%m'), '%m'))='".$month."' and year(a.appointment_date)='".$year."' GROUP BY b.ailment_sys_name";
error_log($sql);
$result = mysqli_query($conn,$sql);
// $row1= mysqli_fetch_assoc($result)
$num_rows=mysqli_num_rows($result);
error_log("asasasas".$row1);
?>
<strong><tr bgcolor="#eeeeee"><td align="left" width="2%" >Sr.</td><td align="left" width="10%">Ailment Name</td><td align="left" width="10%">No OF Cases</td></tr>
<?php
$count=1;
// error_log($row1['employer_contractor_id']);
while($row1= mysqli_fetch_assoc($result)){
extract($row1);
?>
<tr>
<td><?php echo $count?></td>
<td><?php echo $row1['name']?></td>
<td><?php echo $row1['total']?></td>
</tr>
<?php $count++;
}
?>
</table>
</body>
<?php
//include('pdf_footer.php');
?>