='".$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.="".$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'].""; // $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.="$year$month_name000000000000000000000000"; } } // $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); ?>