CHANGE_in-empPolicyApi:GWM

This commit is contained in:
bitbucket 2024-04-16 13:24:04 +05:30
parent 4fa06aa828
commit 9960b714b9

View File

@ -339,8 +339,10 @@ class EmployeeRestController extends AdminController
$result = [];
foreach ($ClientPolicyData as $key => $value) {
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']);
if($value['is_addon'] == 1){
$value['type'] = 'AddOn';
if($value['is_addon'] == "2"){
$value['type'] = 'SI-TopUp';
}else if($value['is_addon'] == "3"){
$value['type'] = 'Dependent-AddOn';
}else{
$value['type'] = $getSlabAndGridData['grid_master']['policy_type'];
}
@ -854,6 +856,7 @@ class EmployeeRestController extends AdminController
// $return_log = json_decode($return_log);
// $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]);
}
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 404);
}else{
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
}
@ -882,7 +885,7 @@ public function getEmployeePolicy()
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
// Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_active', 1 )->where('is_addon_value',0)->findAll();
// dd($empPolicy);
if ($empPolicy) {
@ -1099,24 +1102,24 @@ public function getAddOnPolicy()
{
$PolicyData = [];
foreach ($clientPolicy as $key => $array) {
$responce = [];
$decodedArray = json_decode($array['policy_terms']);
$policy_terms = $decodedArray;
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array['id'],$array['client_id']);
if($array['is_addon'] == 1)
{
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
$responce['client_id'] = $array['client_id'];
$responce['client_policy_id'] = $array['id'];
$responce['is_addon'] = $array['is_addon'];
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
$responce['client_id'] = $array['client_id'];
$responce['client_policy_id'] = $array['id'];
$responce['is_addon'] = $array['is_addon'];
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
if($array['is_addon'] == 3)
{
// Map family floaters that already exist in the employee table
$familyFloates = $policy_terms->family_floaters;
@ -1213,40 +1216,52 @@ public function getAddOnPolicy()
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value;
$only_si_array = [];
$only_si_value = null;
$only_si_premium_value = null;
foreach ($GMCEmployeeData as $key => $value) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
if(isset($employee_policy->premium)){ $only_si_premium_value = $employee_policy->premium;}
$temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
$temp3['data']['name'] = $value['name'];
$temp3['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
$temp3['data']['client_policy_id'] = $array['id'];
$temp3['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
$temp3['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
array_push($only_si_array,$temp3);
}
$responce['family_floaters_of_only_si_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
if($this->request->getGet('policy') == 'GMC-DEPENDENT-ADDON'){
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_dependent_addon'=>$responce]], 200);
}
//array_push($PolicyData, $responce);
}else if($array['is_addon'] == 2){
$only_si_array = [];
$only_si_value = null;
$only_si_premium_value = null;
foreach ($GMCEmployeeData as $key => $value) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
if(isset($employee_policy->premium)){ $only_si_premium_value = $employee_policy->premium;}
$temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
$temp3['data']['name'] = $value['name'];
$temp3['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
$temp3['data']['client_policy_id'] = $array['id'];
$temp3['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
$temp3['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
array_push($only_si_array,$temp3);
}
$responce['family_floaters_of_only_si_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_si_topup'=>$responce]], 200);
}
array_push($PolicyData, $responce);
}
}
return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
// return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);