ESH/bio_medical_waste_generation_pdf.php

303 lines
9.9 KiB
PHP
Raw Permalink Normal View History

2024-10-23 18:28:06 +05:30
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<?php
//include('pdf_header_reverse.php');
include('includes/config/config.php');
include ('includes/functions.php');
//include('pop_up_top.php');
?>
<style>
.tbl2{
font-size:12px;
border: 1px solid black;
border-collapse: collapse;
}
.tbl2 td,th{
font-size:12px;
border: 1px solid black;
border-collapse: collapse;
padding: 4px
}
</style>
<div id="medical_examination_form" style="display:none">
<h5 align="center">Bio Waste Generation Report</h5>
<table width="100%" class="tbl2">
<?php
// $sql_bio_medical_waste="select * from bio_medical_waste ";
//echo $sql;
//$result_bio_medical_waste = @mysqli_query($conn,$myconn,base64_decode($filterkey));
//echo $result;
?>
<tr ><td></td><td></td>
<th width="10%" colspan="3" align="center" bgcolor="yellow">Yellow Bin</th>
<th width="10%" colspan="3" align="center" bgcolor="#999966">Red Bin</th>
<th colspan="3" width="10%" align="center">White Bin</th>
<th width="10%" colspan="3" align="center" bgcolor="#ff9999">Blue Bin</th></tr>
<tr>
<th width=5%>Sr</th>
<th width=10%>Date</th>
<th width=5% bgcolor="yellow">Plant</th>
<th width=5% bgcolor="yellow">Mines</th>
<th width=5% bgcolor="yellow">Total</th>
<th width=5% bgcolor="#999966">Plant</th>
<th width=5% bgcolor="#999966">Mines</th>
<th width=5% bgcolor="#999966">Total</th>
<th width=5% >Plant</th>
<th width=5%>Mines</th>
<th width=5%>Total</th>
<th width=5% bgcolor="#ff9999">Plant</th>
<th width=5% bgcolor="#ff9999">Mines</th>
<th width=5% bgcolor="#ff9999">Total</th>
</tr>
<?php
$sql_bio_medical_waste="select DISTINCT(waste_gen_date) from bio_medical_waste ";
$result_bio_medical_waste = @mysqli_query($conn,$myconn,$sql_bio_medical_waste);
$count=0;
$total_for_yellow_plant=0;
$total_for_red_plant=0;
$total_for_white_plant=0;
$total_for_blue_plant=0;
$total_for_yellow_mines=0;
$total_for_red_mines=0;
$total_for_white_mines=0;
$total_for_blue_mines=0;
while($row_bio_medical_waste=@mysqli_fetch_array($result_bio_medical_waste)){
$no_for_yellow_plant=0;
$no_for_red_plant=0;
$no_for_white_plant=0;
$no_for_blue_plant=0;
$no_for_yellow_mines=0;
$no_for_red_mines=0;
$no_for_white_mines=0;
$no_for_blue_mines=0;
$query_for_date=" select * from bio_medical_waste where waste_gen_date='".$row_bio_medical_waste['waste_gen_date']."' ";
$result_for_date=@mysqli_query($conn,$myconn,$query_for_date);
while($row_for_date=@mysqli_fetch_array($result_for_date)){
if($row_for_date['ohc_type_id']=='2'){
if($row_for_date['waste_category']=='1'){
if($row_for_date['qty']!=null && $row_for_date['qty']!="")
$no_for_yellow_plant=$no_for_yellow_plant+$row_for_date['qty'];
}else if($row_for_date['waste_category']=='2'){
$no_for_red_plant=$no_for_red_plant+$row_for_date['qty'];
}else if($row_for_date['waste_category']=='3'){
$no_for_white_plant=$no_for_white_plant+$row_for_date['qty'];
}else {
$no_for_blue_plant=$no_for_blue_plant+$row_for_date['qty'];
}
}else if($row_for_date['ohc_type_id']=='1'){
if($row_for_date['waste_category']=='1'){
$no_for_yellow_mines=$no_for_yellow_mines+$row_for_date['qty'];
}else if($row_for_date['waste_category']=='2'){
$no_for_red_mines=$no_for_red_mines+$row_for_date['qty'];
}else if($row_for_date['waste_category']=='3'){
$no_for_white_mines=$no_for_white_mines+$row_for_date['qty'];
}else {
$no_for_blue_mines=$no_for_blue_mines+$row_for_date['qty'];
}
}
}
$total_for_yellow_plant=$total_for_yellow_plant+$no_for_yellow_plant;
$total_for_red_plant=$total_for_red_plant+$no_for_red_plant;
$total_for_white_plant=$total_for_white_plant+$no_for_white_plant;
$total_for_blue_plant=$total_for_blue_plant+$no_for_blue_plant;
$total_for_yellow_mines=$total_for_yellow_mines+$no_for_yellow_mines;
$total_for_red_mines=$total_for_red_mines+$no_for_red_mines;
$total_for_white_mines=$total_for_white_mines+$no_for_white_mines;
$total_for_blue_mines=$total_for_blue_mines+$no_for_blue_mines;
$total_yellow=$no_for_yellow_plant+$no_for_yellow_mines;
$total_red=$no_for_red_plant+$no_for_red_mines;
$total_white=$no_for_white_mines+$no_for_white_plant;
$total_blue=$no_for_blue_mines+$no_for_blue_plant;
$waste_gen_date=date_format(date_create($row_bio_medical_waste['waste_gen_date']),"d-M-Y ");
?>
<tr>
<td align="center"><?php echo $count+1;?></td>
<td align="center"><?php echo $waste_gen_date;?></td>
<?php if($no_for_yellow_plant!=null && $no_for_yellow_plant!=""){?>
<td align="center" bgcolor='#eeeeee'><?php echo $no_for_yellow_plant?></td>
<?php }else {?>
<td align="center" bgcolor='#eeeeee'><?php echo "0"?></td>
<?php }?>
<?php if($no_for_yellow_mines!=null && $no_for_yellow_mines!=""){?>
<td align="center" bgcolor='#eeeeee'><?php echo $no_for_yellow_mines?></td>
<?php }else {?>
<td align="center" bgcolor='#eeeeee'><?php echo "0"?></td>
<?php }?>
<?php if($total_yellow!=null && $total_yellow!=""){?>
<td align="center" bgcolor='#eeeeee'><?php echo $total_yellow?></td>
<?php }else {?>
<td align="center" bgcolor='#eeeeee'><?php echo "0"?></td>
<?php }?>
<?php if($no_for_red_plant!=null && $no_for_red_plant!=""){?>
<td align="center" bgcolor="#999966"><?php echo $no_for_red_plant?></td>
<?php }else {?>
<td align="center" bgcolor='#999966'><?php echo "0"?></td>
<?php }?>
<?php if($no_for_red_mines!=null && $no_for_red_mines!=""){?>
<td align="center" bgcolor="#999966"><?php echo $no_for_red_mines?></td>
<?php }else {?>
<td align="center" bgcolor='#999966'><?php echo "0"?></td>
<?php }?>
<?php if($total_red!=null && $total_red!=""){?>
<td align="center" bgcolor="#999966"><?php echo $total_red?></td>
<?php }else {?>
<td align="center" bgcolor='#999966'><?php echo "0"?></td>
<?php }?>
<?php if($no_for_white_plant!=null && $no_for_white_plant!=""){?>
<td align="center" bgcolor="white"><?php echo $no_for_white_plant?></td>
<?php }else {?>
<td align="center" bgcolor='white'><?php echo "0"?></td>
<?php }?>
<?php if($no_for_white_mines!=null && $no_for_white_mines!=""){?>
<td align="center" bgcolor="white"><?php echo $no_for_white_mines?></td>
<?php }else {?>
<td align="center" bgcolor='white'><?php echo "0"?></td>
<?php }?>
<?php if($total_white!=null && $total_white!=""){?>
<td align="center" bgcolor="white"><?php echo $total_white?></td>
<?php }else {?>
<td align="center" bgcolor='white'><?php echo "0"?></td>
<?php }?>
<?php if($no_for_blue_plant!=null && $no_for_blue_plant!=""){?>
<td align="center" bgcolor="#ff9999"><?php echo $no_for_blue_plant?></td>
<?php }else {?>
<td align="center" bgcolor='#ff9999'><?php echo "0"?></td>
<?php }?>
<?php if($no_for_blue_mines!=null && $no_for_blue_mines!=""){?>
<td align="center" bgcolor="#ff9999"><?php echo $no_for_blue_mines?></td>
<?php }else {?>
<td align="center" bgcolor='#ff9999'><?php echo "0"?></td>
<?php }?>
<?php if($total_blue!=null && $total_blue!=""){?>
<td align="center" bgcolor="#ff9999"><?php echo $total_blue?></td>
<?php }else {?>
<td align="center" bgcolor='#ff9999'><?php echo "0"?></td>
<?php }?>
</tr><?php
$total=$total_for_yellow_mines+$total_for_yellow_plant+$total_for_red_plant+$total_for_red_mines+$total_for_white_plant+$total_for_white_mines+$total_for_blue_plant+$total_for_blue_mines;
$count++;
}
?>
<tr>
<td colspan="2" align="center">Total- <?php echo $total.' Grams' ?></td>
<td bgcolor='#eeeeee' align="center"><?php echo $total_for_yellow_plant; ?></td>
<td bgcolor='#eeeeee' align="center"><?php echo $total_for_yellow_mines; ?></td>
<td bgcolor='#eeeeee' align="center"><?php echo ($total_for_yellow_mines+$total_for_yellow_plant); ?></td>
<td bgcolor="#999966" align="center"><?php echo $total_for_red_plant; ?></td>
<td bgcolor="#999966" align="center"><?php echo $total_for_red_mines; ?></td>
<td bgcolor="#999966" align="center"><?php echo ($total_for_red_plant+$total_for_red_mines); ?></td>
<td colspan="" align="center"><?php echo $total_for_white_plant; ?></td>
<td colspan="" align="center"><?php echo $total_for_white_mines; ?></td>
<td colspan="" align="center"><?php echo ($total_for_white_plant+$total_for_white_mines); ?></td>
<td bgcolor="#ff9999" align="center"><?php echo $total_for_blue_plant; ?></td>
<td bgcolor="#ff9999" align="center"><?php echo $total_for_blue_mines; ?></td>
<td bgcolor="#ff9999" align="center"><?php echo ($total_for_blue_plant+$total_for_blue_mines); ?></td>
</tr>
</table>
</div>
<form id="medical_examination_form_pdf" action="" method="POST">
<input type="hidden" name="htmlText" id="htmlText" />
</form>
<script>
formSubmit();
function formSubmit(){
$("#htmlText").val($("#medical_examination_form").html());
document.forms['medical_examination_form_pdf'].action="pdf_dynamic.php";
document.forms['medical_examination_form_pdf'].method="post";
document.forms['medical_examination_form_pdf'].submit();
}
</script>
<?php
//include('pdf_footer.php');
?>