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

140 lines
4.0 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=biomedical_waste_list_excel.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</strong></td>
<td colspan="2" align="right"> User : <?php echo $username ?></td>
</tr>
</table>
<table border="1" width="100%">
<?php
//$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,$myconn,$sql_issue_items);
//$sql=base64_decode($filterkey);
//$results= mysqli_query($conn,$myconn,$sql_waste);
$sql=base64_decode($filterkey);
$result = mysqli_query($conn,$sql);
?><tr>
<th rowspan="2">Sr.No.</th>
<th rowspan="2">Date of Disposal</th>
<th colspan="4" >Quantity of Bio- Medical Waste</th>
<th colspan="4" >No. Of Bags</th>
<th rowspan="2">Collected By</th>
<th rowspan="2">Challan No.</th>
</tr>
<tr>
<th>Yellow Category (in kgs)</th>
<th>White Category (in kgs)</th>
<th>Red Category (in kgs)</th>
<th>Blue Category (in kgs)</th>
<th>Yellow</th>
<th>White</th>
<th>Red</th>
<th>Blue</th>
</tr>
<?php
$count=1;
while ($row1= mysqli_fetch_assoc($result)){
extract($row1);
?>
<tr>
<td align="center"><?php echo $count?></td>
<td align="center"><?php echo date_format(date_create($row1['waste_gen_date']),"d-M-Y ")?></td>
<td align="center" bgcolor="#f9e84e"><?php echo $row1['plant_yellow_qty']?></td>
<td align="center" bgcolor="#eeeeee"><?php echo $row1['plant_white_qty']?></td>
<td align="center" bgcolor="#fa8072" ><?php echo $row1['plant_red_qty']?></td>
<td align="center" bgcolor="#6495ed"><?php echo $row1['plant_blue_qty']?></td>
<td align="center" bgcolor="#f9e84e"><?php echo $row1['yellow_bags']?></td>
<td align="center" bgcolor="#eeeeee"><?php echo $row1['white_bags']?></td>
<td align="center" bgcolor="#fa8072" ><?php echo $row1['red_bags']?></td>
<td align="center" bgcolor="#6495ed"><?php echo $row1['blue_bags']?></td>
<td align="center"><?php echo $row1['collected_by']?></td>
<td align="center"><?php echo $row1['challan_no']?></td>
</tr>
<?php
$count++;
}
?>
<?php $sql2="SELECT SUM(plant_yellow_qty ) as plant_yellow_qty,sum(yellow_bags) as total_yellow_bags,sum(plant_white_qty) as plant_white_qty,sum(white_bags) as total_white_bags,sum(plant_blue_qty) as plant_blue_qty,sum(blue_bags) as total_blue_bags,sum(plant_red_qty) as plant_red_qty,sum(red_bags) as total_red_bags FROM `bio_medical_waste_new` ";
error_log($sql2);
$result = mysqli_query($conn,$sql2);
$row2= mysqli_fetch_assoc($result);
extract($row1);
//echo "hello".$row1[0];
$plant_yellow_qty= ceil($row2['plant_yellow_qty']);
$no_yellow_bags = $row2['total_yellow_bags'];
$plant_white_qty= ceil($row2['plant_white_qty']);
$no_white_bags = $row2['total_white_bags'];
$plant_blue_qty= ceil($row2['plant_blue_qty']);
$no_blue_bags = $row2['total_blue_bags'];
$plant_red_qty= ceil($row2['plant_red_qty']);
$no_red_bags = $row2['total_red_bags'];
//echo $abc;
?>
<tr><td colspan="2" align="center"></td>
<td align="center">Total:<?php echo $plant_yellow_qty; ?>kgs</td>
<td align="center">Total:<?php echo $plant_white_qty; ?>kgs</td>
<td align="center">Total:<?php echo $plant_red_qty; ?>kgs</td>
<td align="center">Total:<?php echo $plant_blue_qty; ?>kgs</td>
<td align="center">Total:<?php echo $no_yellow_bags; ?></td>
<td align="center">Total:<?php echo $no_white_bags; ?></td>
<td align="center">Total:<?php echo $no_red_bags; ?></td>
<td align="center">Total:<?php echo $no_blue_bags; ?></td>
<td colspan="2"></td>
</tr>
</table>
</body>