<?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); $sql="SELECT b.ailment_sys_name as name,COUNT(a.ailment_systems_new) as total FROM `employee_appointment` a , ailment_system b WHERE a.ailment_systems_new=b.ailment_sys_id AND appointment_type='O' AND ailment_systems_new!='' 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); ?>