82 lines
5.1 KiB
PHP
82 lines
5.1 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=excel_bio_medical_waste_list.xls');
|
|
?>
|
|
<body>
|
|
<table width="100%" >
|
|
<tr>
|
|
<td colspan="5" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
|
|
<td colspan="6" align="center" ><strong>BIO WASTE GENERATION REPORT<br>Collected & Disposed By: Indo Water management & Pollution Control Corporation,Satna
|
|
</strong></td>
|
|
<td colspan="2" align="right"> User : <?php echo $username ?></td>
|
|
</tr>
|
|
</table>
|
|
<table border="1" width="100%">
|
|
<tr><td colspan="2"></td><td align="center" bgcolor="#f9e84e" colspan="3">YELLOW</td><td align="center" bgcolor="#eeeeee" colspan="3">WHITE</td><td bgcolor="#6495ed" align="center" colspan="3">BLUE</td><td bgcolor="#fa8072" align="center" colspan="3">RED</td></tr>
|
|
<strong><tr><td align="left" width="2%" >Year</td><td align="left" width="8%">MONTH</td><td bgcolor="#f9e84e" align="left" width="8%">PLANT</td><td bgcolor="#f9e84e" valign="top" width="8%" align="left">MINES</td><td valign="top" bgcolor="#f9e84e" align="left" width="7%">TOTAL</td><td width="8%" bgcolor="#eeeeee" valign="top" align="left">PLANT</td><td bgcolor="#eeeeee" valign="top" align="left" width="8%">MINES</td><td width="7%" bgcolor="#eeeeee" valign="top" align="left">TOTAL</td><td width="8%" bgcolor="#6495ed" valign="top" align="left">PLANT</td><td width="8%" bgcolor="#6495ed" valign="top" align="left">MINES</td><td width="7%" bgcolor="#6495ed" valign="top" align="left">TOTAL</td><td width="8%" valign="top" bgcolor="#fa8072" align="left">PLANT</td><td width="8%" valign="top" bgcolor="#fa8072" align="left">MINES</td><td width="7%" valign="top" bgcolor="#fa8072" align="left">TOTAL</td></strong></tr>
|
|
|
|
|
|
<?php
|
|
|
|
|
|
$sum1=0;
|
|
$sum2=0;
|
|
$sum3=0;
|
|
$sum4=0;
|
|
$sum5=0;
|
|
$sum6=0;
|
|
$sum7=0;
|
|
$sum8=0;
|
|
$sum9=0;
|
|
$sum10=0;
|
|
$sum11=0;
|
|
$sum12=0;
|
|
|
|
$data="";
|
|
$year=$_POST['year'];
|
|
error_log($year);
|
|
for($i=1;$i<=12;$i++){
|
|
$month_name = date("F", mktime(0, 0, 0, $i, 10));
|
|
$query="select MONTHNAME(STR_TO_DATE($i, '%m')) as month,YEAR(waste_gen_date) as year,sum(plant_yellow_qty) as plant_yellow,sum(mines_yellow_qty) as mines_yellow,sum(yellow_qty_total) as yellow_qty,sum(plant_white_qty) as plant_white,sum(mines_white_qty) as mines_white,sum(white_qty_total) as white_qty,sum(plant_blue_qty) as plant_blue,sum(mines_blue_qty) as mines_blue,sum(blue_qty_total) as blue_qty,sum(plant_red_qty) as plant_red,sum(mines_red_qty) as mines_red,sum(red_qty_total) as red_qty from bio_medical_waste_new WHERE year(waste_gen_date) = $year AND month(waste_gen_date)=$i group by date_format(waste_gen_date, '%M') ORDER BY `year` ASC ";
|
|
|
|
$result=mysqli_query($conn,$query);
|
|
|
|
$total=mysqli_num_rows($result);
|
|
error_log($total);
|
|
if($total!=0){
|
|
while($row=mysqli_fetch_assoc($result)){
|
|
|
|
$data.="<tr><td>".$row['year']."</td><td>".$row['month']."</td><td bgcolor=#f9e84e>".$row['plant_yellow']."</td><td bgcolor=#f9e84e>".$row['mines_yellow']."</td><td bgcolor=#f9e84e>".$row['yellow_qty']."</td><td bgcolor=#eeeeee>".$row['plant_white']."</td><td bgcolor=#eeeeee>".$row['mines_white']."</td><td bgcolor=#eeeeee>".$row['white_qty']."</td><td bgcolor=#6495ed>".$row['plant_blue']."</td><td bgcolor=#6495ed>".$row['mines_blue']."</td><td bgcolor=#6495ed>".$row['blue_qty']."</td><td bgcolor=#fa8072>".$row['plant_red']."</td><td bgcolor=#fa8072>".$row['mines_red']."</td><td bgcolor=#fa8072>".$row['red_qty']."</td></tr>";
|
|
|
|
$sum1+=$row['plant_yellow'];
|
|
$sum2+=$row['mines_yellow'];
|
|
$sum3+=$row['yellow_qty'];
|
|
$sum4+=$row['plant_white'];
|
|
$sum5+=$row['mines_white'];
|
|
$sum6+=$row['white_qty'];
|
|
$sum7+=$row['plant_blue'];
|
|
$sum8+=$row['mines_blue'];
|
|
$sum9+=$row['blue_qty'];
|
|
$sum10+=$row['plant_red'];
|
|
$sum11+=$row['mines_red'];
|
|
$sum12+=$row['red_qty'];
|
|
|
|
|
|
}}
|
|
else{
|
|
$data.="<tr><td>$year</td><td>$month_name</td><td bgcolor=#f9e84e>00</td><td bgcolor=#f9e84e>00</td><td bgcolor=#f9e84e>00</td><td bgcolor=#eeeeee>00</td><td bgcolor=#eeeeee>00</td><td bgcolor=#eeeeee>00</td><td bgcolor=#6495ed>00</td><td bgcolor=#6495ed>00</td><td bgcolor=#6495ed>00</td><td bgcolor=#fa8072>00</td><td bgcolor=#fa8072>00</td><td bgcolor=#fa8072>00</td></tr>";
|
|
}
|
|
}
|
|
error_log($sum10);
|
|
?>
|
|
|
|
<?php echo $data; ?>
|
|
|
|
|
|
<tr style="font-weight:bold"><td colspan="2" align="center"><b>TOTAL</b></td><td bgcolor=#f9e84e><?php echo $sum1?></td><td bgcolor=#f9e84e><?php echo $sum2?></td><td bgcolor=#f9e84e><?php echo $sum3?></td><td bgcolor=#eeeeee><?php echo $sum4?></td><td bgcolor=#eeeeee><?php echo $sum5?></td><td bgcolor=#eeeeee><?php echo $sum6?></td><td bgcolor=#6495ed><?php echo $sum7?></td><td bgcolor=#6495ed><?php echo $sum8?></td><td bgcolor=#6495ed><?php echo $sum9?></td><td bgcolor=#fa8072><?php echo $sum10?></td><td bgcolor=#fa8072><?php echo $sum11?></td><td bgcolor=#fa8072><?php echo $sum12?></td></tr>
|
|
|
|
</table>
|
|
</body>
|