<?php include('includes/config/config.php'); error_reporting(E_ERROR | E_PARSE); $ohc_location = $_REQUEST['ohc_location']; $patient_category = $_REQUEST['patient_category']; $dept = $_REQUEST['dept']; $emp_designation = $_REQUEST['emp_designation']; $emp_cadre = $_REQUEST['emp_cadre']; $employer_contractor = $_REQUEST['employer_contractor']; $gender = $_REQUEST['gender']; $start_date = $_REQUEST['startDate']; $end_date= $_REQUEST['endDate']; $year= $_POST['year']; $month= $_POST['month']; error_log("abcde".$year); // $qry_bu =""; // $qry_date=""; // if(isset($ohc_location) && $ohc_location!=''){ // $qry_bu.=" and ohc_location_id ='".$ohc_location."' "; // } // if(isset($patient_category) && $patient_category!=''){ // $qry_bu.=" and emp_cat_id ='".$patient_category."' "; // } // if(isset($dept) && $dept!=''){ // $qry_bu.=" and dept_id ='".$dept."' "; // } // if(isset($emp_designation) && $emp_designation!=''){ // $qry_bu.=" and designation_id ='".$emp_designation."' "; // } // if(isset($emp_cadre) && $emp_cadre!=''){ // $qry_bu.=" and emp_cadre ='".$emp_cadre."' "; // } // if(isset($employer_contractor) && $employer_contractor!=''){ // $qry_bu.=" and employer_contractor_id ='".$employer_contractor."' "; // } // if(isset($gender) && $gender!=''){ // $qry_bu.=" and gender ='".$gender."' "; // } // if(isset($start_date) && $start_date!=''){ // //$qry_date.=" and checkup_date >='".$start_date."' "; // $qry_date.=" and medical_entry_date >=str_to_date('".$start_date."','%d-%m-%Y') "; // } // if(isset($end_date) && $end_date!=''){ // //$qry_date.=" and checkup_date <='".$end_date."' "; // $qry_date.=" and medical_entry_date <=str_to_date('".$end_date."','%d-%m-%Y') "; // } // $i=0; // $weight =array(1,2,3,4,5,-1,-2,-3,-4,-5,0); $data=""; $year=$_POST['year']; error_log($year); for($i=1;$i<=12;$i++){ $month_name =substr(date("F", mktime(0, 0, 0, $i, 10)), 0, 3); $query="select SUBSTRING( MONTHNAME(STR_TO_DATE(10, '%m')), 1, 3 ) 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 "; error_log($query); $result=mysqli_query($conn,$query); $total=mysqli_num_rows($result); error_log($total); if($total!=0){ while($row=mysqli_fetch_assoc($result)){ $array1 = array($row['year'],$row['month'],$row['plant_yellow'],$row['mines_yellow'],$row['yellow_qty'],$row['plant_white'],$row['mines_white'],$row['white_qty'],$row['plant_blue'],$row['mines_blue'],$row['blue_qty'],$row['plant_red'],$row['mines_red'],$row['red_qty']); $data[]=$array1; // $data.="<tr><td>".$row['year']."</td><td>".$row['month']."</td><td>".$row['plant_yellow']."</td><td>".$row['mines_yellow']."</td><td>".$row['yellow_qty']."</td><td>".$row['plant_white']."</td><td>".$row['mines_white']."</td><td>".$row['white_qty']."</td><td>".$row['plant_blue']."</td><td>".$row['mines_blue']."</td><td>".$row['blue_qty']."</td><td>".$row['plant_red']."</td><td>".$row['mines_red']."</td><td>".$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{ $array1 = array($year,$month_name,0,0,0,0,0,0,0,0,0,0,0,0); $data[]=$array1; // $data.="<tr><td>$year</td><td>$month_name</td><td>00</td><td>00</td><td>00</td><td>00</td><td>00</td><td>00</td><td>00</td><td>00</td><td>00</td><td>00</td><td>00</td><td>00</td></tr>"; } } // $sql="SELECT b.ailment_sys_name as name,COUNT(a.ailment_system_ids) as total FROM `employee_appointment` a , ailment_system b WHERE a.ailment_system_ids=b.ailment_sys_id AND appointment_type='O' AND ailment_system_ids!='' AND MONTHNAME(STR_TO_DATE(DATE_FORMAT(a.appointment_date, '%m'), '%m'))='".$month."' and year(a.appointment_date)='".$year."' GROUP BY b.ailment_sys_name"; // error_log($sql); // $result = mysqli_query($conn,$sql); // // $row1= mysqli_fetch_assoc($result); // $num_rows=mysqli_num_rows($result); // error_log("asasasas".$row1); // $count=1; // while($row0= mysqli_fetch_assoc($result)){ // $array1 = array($count,$row0['name'],$row0['total']); // $data[]=$array1; // $count++; // } echo json_encode($data); ?>