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

321 lines
9.3 KiB
PHP

<?php session_start();
include('log_entry.php');
include_once("includes/functions.php");
$year = $_POST['years'];
$start_month=$_POST['start_month'];
$end_month=$_POST['end_month'];
$year2 = $year + 1;
error_log($year . $year2);
?>
<?php $sql = "SELECT a.*,b.agency_name,b.agency_address,e.emp_sign,e.image_type FROM bio_medical_waste_new a left join disposal_agency b on a.dis_agncy = b.agency_id left join employee_signature e on a.approved_by = e.emp_id WHERE year(waste_gen_date) between '$year' AND '$year2' and a.approval_status = 'A' order by waste_gen_date ASC";
error_log("BIO-WASTE YEAR:" . $sql);
$result1 = mysqli_query($conn, $sql);
$row1 = mysqli_fetch_assoc($result1);
$doc_name = getFieldFromTable('patient_name', 'patient_master', 'id', $row1['approved_by']);
$query = "select * from company_profile where company_id =5 ";
//echo $query;
$result = mysqli_query($conn, $query);
$row_for_company = mysqli_fetch_array($result);
@extract($row_for_company);
?>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style>
@page {
margin: 20px;
}
.btn {
background-color: #4CAF50;
border-radius: 5%;
/* Green */
border: none;
color: white;
padding: 5px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
margin: 4px 2px;
cursor: pointer;
}
@media print {
#printPageButton {
display: none;
}
}
</style>
<div align="right">
<button align="center" id="printPageButton" class="btn btn-success" onClick="window.print();">Print</button>
</div>
<table>
<tr>
<td colspan="12"><u>
<h3 style="font-weight: 800;margin-left: 220px">Yearly report of bio medical waste generation</h3>
</u></td>
</tr>
</table>
<table width="100%">
<tr>
<td>1.Particulars of the applicant</td>
</tr>
<tr>
<td width="50%">&nbsp;&nbsp;&nbsp;&nbsp;i. Name of the authorized person (occupier/operator) :</td>
<td><?php echo " Mr. K M Vadher " ?></td>
</tr>
<tr>
<td width="50%">&nbsp;&nbsp;&nbsp;&nbsp;ii. Name and address of institution:</td>
<td><?php echo $row_for_company['company_name'] ?>,<?php echo $row_for_company['address'] ?></td>
</tr>
</table>
<table>
<tr>
<td>2. Category of waste (as per schedule-I of the rule) generated and quantity for the Year of:
<?php echo $year ?>-<?php echo $year2 ?></td>
</tr>
</table>
<br>
<?php
$month=array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
?>
<table border="1" cellspacing="0" width="100%">
<tr>
<th>Month-Year</th>
<th style="background-color: yellow;" >Yellow</th>
<th style="background-color: #FF8E60 ; " >Red</th>
<th style="background-color: #60A6FF;" >Blue</th>
<th>White Translucent</th>
</tr>
<?php
$Grand_total=0;
$total_yellow=0;
$total_red=0;
$total_blue=0;
$total_white=0;
$total_yellow_bag=0;
$total_red_bag=0;
$total_blue_bag=0;
$total_white_bag=0;
if($end_month<$start_month) $end_month+=12;
for ($x=$start_month-1;$x<$end_month;$x++){
if($x<12) $y=-$year;
else $y=-$year2;
$x2=($x%12)+1;
$sql2 = "SELECT a.*,b.agency_name,b.agency_address,e.emp_sign,e.image_type FROM bio_medical_waste_new a left join disposal_agency b on a.dis_agncy = b.agency_id left join employee_signature e on a.approved_by = e.emp_id WHERE year(waste_gen_date) between '$year' AND '$year2' and month(waste_gen_date)='$x2' and a.approval_status = 'A' ";
error_log("errrooooorrr".$sql2);
$result2 = mysqli_query($conn, $sql2);
$yellow=0;
$red=0;
$blue=0;
$white=0;
while($row2 = mysqli_fetch_assoc($result2)){
$yellow=$yellow+$row2['plant_yellow_qty'];
$red=$red+$row2['plant_red_qty'];
$blue=$blue+$row2['plant_blue_qty'];
$white=$white+$row2['plant_white_qty'];
$total_blue_bag+=$row2['red_bags'];
$total_red_bag+=$row2['red_bags'];
$total_yellow_bag+=$row2['yellow_bags'];
$total_white_bag+=$row2['white_bags'];
}
$total_yellow+=$yellow;
$total_red+=$red;
$total_blue+=$blue;
$total_white+=$white;
$Grand_total=$total_blue+$total_red+$total_white+$total_yellow;
?>
<tr>
<td align="center"><?php echo $month[$x2-1],$y ?></td>
<td style="background-color: yellow;" align="center"><?php echo $yellow ?>gms</td>
<td style="background-color: #FF8E60 ;" align="center"><?php echo $red ?>gms</td>
<td style="background-color: #60A6FF;" align="center"><?php echo $blue ?>gms</td>
<td align="center"><?php echo $white ?>gms</td>
</tr>
<?php
}
?>
<tr>
<th>Total</th>
<td style="background-color: yellow;" align="center"><?php echo $total_yellow ?>gms</td>
<td style="background-color: #FF8E60 ;" align="center"><?php echo $total_red ?>gms</td>
<td style="background-color: #60A6FF;" align="center"><?php echo $total_blue ?>gms</td>
<td align="center"><?php echo $total_white ?>gms</td>
</tr>
<tr>
<th>Grand Total</th>
<td align="center" colspan="4"><?php echo $Grand_total ?>gms</td>
</tr>
<tr>
<th>Monthly Average</th>
<td style="background-color: yellow;" align="center"><?php echo round($total_yellow/(($end_month-$start_month+1)*1.0),2) ?>gms</td>
<td style="background-color: #FF8E60 ;" align="center"><?php echo round($total_red/(($end_month-$start_month+1)*1.0),2) ?>gms</td>
<td style="background-color: #60A6FF;" align="center"><?php echo round($total_blue/(($end_month-$start_month+1)*1.0),2) ?>gms</td>
<td align="center"><?php echo round($total_white/(($end_month-$start_month+1)*1.0),2) ?>gms</td>
</tr>
</table>
<br>
<table width="100%">
<tr>
<td>3. Brief details of the treatment facility:</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;In case off-site facility:</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i. Name of the operator:</td>
<td><?php echo $row1['collected_by'] ?></td>
</tr>
<tr>
<td width="40%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ii. Name and address of the facility:</td>
<td><?php echo $row1['agency_name'] ?>,<?php echo $row1['agency_address'] ?></td>
</tr>
</table>
<table>
<tr>
<td>4. Category-wise quantity of waste treated:</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i. Incineration/Burial (Yellow bag): </td>
<td><strong><?php echo $total_yellow_bag ?> Nos</strong></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ii. Autoclave/Microwave </td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a) Red Bag:</td>
<td><strong><?php echo $total_red_bag ?> Nos</strong></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b) Blue bag:</td>
<td><strong><?php echo $total_blue_bag ?> Nos</strong></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c) White Translucent bag:</td>
<td><strong><?php echo $total_white_bag ?> Nos</strong></td>
</tr>
</table>
<table width="100%">
<tr>
<td width="30%">5. Mode of treatment with details: </td>
<td><strong>Waste is handed over to the authorized disposal agency
(i.e. <?php echo $row1['agency_name'] ?>)
</strong></td>
</tr>
</table>
<table>
<tr>
<td>6. Any other information:</td>
</tr>
</table>
<table>
<td>7. Certified that the above report is for the period from <strong><?php echo $year ?> to
<?php echo $year2 ?></strong></td>
</table>
<table width="100%">
<tr>
<td width="80%"></td>
<td><img src="data:<?php echo $row1['image_type'] ?>;base64,<?php echo base64_encode($row1['emp_sign']) ?>"
style="width: 200px; height: 61px;" /></td>
</tr>
<tr>
<tr>
<td><strong>Date :<?php echo date('d-m-Y'); ?></strong></td>
</tr>
<?php $complaint_ids = $row_for_company['address'];
$complaint_ids_array = array();
$complaint_ids_array = explode(",", $complaint_ids);
error_log('agency addr'.print_r($complaint_ids_array,true));
$complaints = "";
for ($i = 0; $i < count($complaint_ids_array); $i++) {
if ($i > count($complaint_ids_array)-3) {
$complaints = $complaints . "," . $complaint_ids_array[$i];
}
}
?>
<td><strong>Place : <?php echo $complaints ?></strong></td>
<td align="right"><strong>Signature:</strong></td>
</tr>
<tr>
<td><strong>Designation : Head Medical Services</strong></td>
<td align="right"><b style="font-size: 15px"><?php echo $doc_name ?></b></td>
</tr>
<tr>
<td></td>
<td align="right"><strong>Factory Medical Officer</strong></td>
</tr>
</table>
<script>
$(document).ready(function() {
window.print();
});
</script>