179 lines
4.4 KiB
PHP
179 lines
4.4 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
$business_unit = $_REQUEST['business_unit'];
|
|
$sub_business_unit = $_REQUEST['sub_business_unit'];
|
|
$section_name = $_REQUEST['section_name'];
|
|
$sub_section_name = $_REQUEST['sub_section_name'];
|
|
|
|
|
|
|
|
$qry_bu ="";
|
|
if(isset($business_unit) && $business_unit!=''){
|
|
$qry_bu.=" and bu_id ='".$business_unit."' ";
|
|
}
|
|
|
|
if(isset($sub_business_unit) && $sub_business_unit!=''){
|
|
$qry_bu.=" and sbu_id ='".$sub_business_unit."' ";
|
|
}
|
|
|
|
if(isset($section_name) && $section_name!=''){
|
|
$qry_bu.=" and section_id ='".$section_name."' ";
|
|
}
|
|
|
|
if(isset($sub_section_name) && $sub_section_name!=''){
|
|
$qry_bu.=" and sub_section_id ='".$sub_section_name."' ";
|
|
}
|
|
|
|
$i=0;
|
|
$record =array();
|
|
|
|
$query1="select id FROM employee where YEAR(CURDATE())-year(doj)>=0 and YEAR(CURDATE())-year(doj)<2 ".$qry_bu;
|
|
|
|
$query="SELECT health_score from checkup_form where emp_id in ($query1)";
|
|
//echo $query;
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['key'] ='0-2';
|
|
$record[$i]['health_score'] =$row['health_score'];
|
|
$i++;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query1="select id FROM employee where YEAR(CURDATE())-year(doj)>=2 and YEAR(CURDATE())-year(doj)<5 ".$qry_bu;
|
|
|
|
$query="SELECT health_score from checkup_form where emp_id in ($query1)";
|
|
//echo $query;
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='2-5';
|
|
$record[$i]['health_score'] =$row['health_score'];
|
|
$i++;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
$query1="select id FROM employee where YEAR(CURDATE())-year(doj)>=5 and YEAR(CURDATE())-year(doj)<10 ".$qry_bu;
|
|
$query="SELECT health_score from checkup_form where emp_id in ($query1)";
|
|
echo $query;
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='5-10';
|
|
$record[$i]['health_score'] =$row['health_score'];
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
|
|
$query1="select id FROM employee where YEAR(CURDATE())-year(doj)>=10 and YEAR(CURDATE())-year(doj)<15 ".$qry_bu;
|
|
$query="SELECT health_score from checkup_form where emp_id in ($query1)";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='10-15';
|
|
$record[$i]['health_score'] =$row['health_score'];
|
|
$i++;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
$query1="select id FROM employee where YEAR(CURDATE())-year(doj)>15 and YEAR(CURDATE())-year(doj)<=20 ".$qry_bu;
|
|
$query="SELECT health_score from checkup_form where emp_id in ($query1)";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='15-20';
|
|
$record[$i]['health_score'] =$row['health_score'];
|
|
$i++;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$query1="select id FROM employee where YEAR(CURDATE())-year(doj)>20 and YEAR(CURDATE())-year(doj)<=25 ".$qry_bu;
|
|
$query="SELECT health_score from checkup_form where emp_id in ($query1)";
|
|
//echo $query;
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='20-25';
|
|
$record[$i]['health_score'] =$row['health_score'];
|
|
$i++;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
$query1="select id FROM employee where YEAR(CURDATE())-year(doj)>25 ".$qry_bu;
|
|
$query="SELECT health_score from checkup_form where emp_id in ($query1)";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='>25';
|
|
$record[$i]['health_score'] =$row['health_score'];
|
|
$i++;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
echo json_encode($record);
|
|
?>
|
|
|