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

195 lines
7.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_waste_list.xls');
?>
<?php
$from_date = $_REQUEST['startDate2'];
$to_date = $_REQUEST['endDate2'];
//include('pop_up_top.php');
?>
<body>
<table width="100%" class="tbl2">
<tr>
<td colspan="2" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
<td colspan="9" align="center"><strong>BIO WASTE GENERATION REPORT</strong></td>
<td colspan="3" align="right"> User : <?php echo $username ?></td>
</tr>
<tr>
<?php if (isset($from_date) && isset($to_date)) { ?>
<td width="25%" align="left">
<h5> Range : <?php echo $from_date; ?> To <?php echo $to_date; ?></h5>
</td>
<?php } ?>
</tr>
</table>
<table width="100%">
<tr>
<td>Disposal Agency:
<strong><?php echo getTableFieldValue('disposal_agency', 'agency_name', 'agency_id', $row1['dis_agncy']); ?>,</strong>
Regestration No.:
<strong><?php echo getTableFieldValue('disposal_agency', 'regestration_no', 'agency_id', $row1['dis_agncy']); ?>,</strong>
Allocated Reg. No.:
<strong><?php echo getTableFieldValue('disposal_agency', 'allocated_reg_no', 'agency_id', $row1['dis_agncy']); ?></strong>
</td>
</tr>
</table>
<table border="1" width="100%" class="tbl2">
<?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,$sql_issue_items);
//$sql=base64_decode($filterkey);
//$results= mysqli_query($conn,$sql_waste);
$sql = "SELECT * FROM `bio_medical_waste_new` WHERE `ohc_type_id` = '" . $_SESSION['current_ohcttype'] . "' and date(`waste_gen_date`) between STR_TO_DATE('" . $from_date . "', '%d-%m-%Y') AND STR_TO_DATE('" . $to_date . "', '%d-%m-%Y') order by waste_gen_date ASC";
error_log('bwr_query' . $sql);
$result = mysqli_query($conn, $sql);
?>
<tr>
<th rowspan="2">Sr.No.</th>
<th rowspan="2">Date of Disposal</th>
<th rowspan="2">Date of generation</th>
<th rowspan="2">Storage</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">Purpose of Sending</th>
<th rowspan="2">Transportation</th>
<th rowspan="2">Chalan No. & Date</th>
<th rowspan="2">Signature of Collector</th>
<th rowspan="2">Remarks</th>
</tr>
<tr>
<th bgcolor="#f9e84e">Yellow Category (in gm)</th>
<th bgcolor="#fa8072">Red Category (in gm)</th>
<th bgcolor="#6495ed">Blue Category (in gm)</th>
<th bgcolor="#eeeeee">White Category (in gm)</th>
<th bgcolor="#f9e84e">Yellow</th>
<th bgcolor="#6495ed">Blue</th>
<th bgcolor="#fa8072">Red</th>
<th bgcolor="#eeeeee">White</th>
</tr>
<?php
$count = 1;
while ($row = mysqli_fetch_assoc($result)) {
extract($row);
?>
<tr>
<td align="center"><?php echo $count ?></td>
<td align="center"><?php echo date_format(date_create($row['waste_gen_date']), "d-M-Y ") ?></td>
<td align="center"><?php echo date_format(date_create($row['waste_gen_date']), "d-M-Y ") ?></td>
<td align="center"></td>
<td align="center" bgcolor="#f9e84e"><?php echo $row['plant_yellow_qty'] ?></td>
<td align="center" bgcolor="#fa8072"><?php echo $row['plant_red_qty'] ?></td>
<td align="center" bgcolor="#6495ed"><?php echo $row['plant_blue_qty'] ?></td>
<td align="center" bgcolor="#eeeeee"><?php echo $row['plant_white_qty'] ?></td>
<td align="center" bgcolor="#f9e84e"><?php echo $row['yellow_bags'] ?></td>
<td align="center" bgcolor="#6495ed"><?php echo $row['blue_bags'] ?></td>
<td align="center" bgcolor="#fa8072"><?php echo $row['red_bags'] ?></td>
<td align="center" bgcolor="#eeeeee"><?php echo $row['white_bags'] ?></td>
<td align="center"><?php echo $row['collected_by'] ?></td>
<td align="center"></td>
<td align="center"><?php echo $row['vehicle_no'] ?></td>
<td align="center"><?php echo $row['challan_no'] ?></td>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
</tr>
<?php
$count++;
}
?>
<?php $sql1 = "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` WHERE `ohc_type_id` = '" . $_SESSION['current_ohcttype'] . "' and date(`waste_gen_date`) between STR_TO_DATE('" . $from_date . "', '%d-%m-%Y') AND STR_TO_DATE('" . $to_date . "', '%d-%m-%Y')";
error_log($sql1);
$result1 = mysqli_query($conn, $sql1);
$row1 = mysqli_fetch_assoc($result1);
extract($row1);
//echo "hello".$row1[0];
$plant_yellow_qty = $row1['plant_yellow_qty'];
$no_yellow_bags = $row1['total_yellow_bags'];
$plant_blue_qty = $row1['plant_blue_qty'];
$no_blue_bags = $row1['total_blue_bags'];
$plant_red_qty = $row1['plant_red_qty'];
$no_red_bags = $row1['total_red_bags'];
$plant_white_qty = $row1['plant_white_qty'];
$no_white_bags = $row1['total_white_bags'];
//echo $abc;
?>
<tr>
<td colspan="4" align="center"></td>
<td align="center">Total:<?php echo round($plant_yellow_qty, 3, PHP_ROUND_HALF_EVEN); ?>gm</td>
<td align="center">Total:<?php echo round($plant_red_qty, 3, PHP_ROUND_HALF_EVEN); ?>gm</td>
<td align="center">Total:<?php echo round($plant_blue_qty, 3, PHP_ROUND_HALF_EVEN); ?>gm</td>
<td align="center">Total:<?php echo round($plant_white_qty, 3, PHP_ROUND_HALF_EVEN); ?>gm</td>
<td align="center">Total:<?php echo $no_yellow_bags; ?></td>
<td align="center">Total:<?php echo $no_blue_bags; ?></td>
<td align="center">Total:<?php echo $no_red_bags; ?></td>
<td align="center">Total:<?php echo $no_white_bags; ?></td>
<td colspan="6"></td>
</tr>
</table>
</body>