diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index f25e56cf..f53e2808 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -286,7 +286,7 @@ class EmployeeRestController extends AdminController ->where('client_policy_id',$value['policy_details']['client_policy_id'] ) ->where('employee_id' , $value['temp']['emp_id'] ) ->where('is_active', 1 ) - ->set(array('premium'=> $value['policy_details']['rata_premimum'] , 'gst'=> $value['policy_details']['gst'] )) + ->set(array('premium'=> $value['policy_details']['premium'] , 'gst'=> $value['policy_details']['gst'] )) ->update(); } @@ -1017,13 +1017,15 @@ public function getEmployeePolicy() $id = $this->request->getGet('id'); $emp_code = $this->request->getGet('emp_code'); + $client_id = $this->request->getGet('client_id'); // This is an array containing keys to be removed from the terms and conditions array $keysToRemove = ["removable_keys"]; // Retrieve employee policy data by passing the employee primary key $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(); + $employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id) + ->where('is_active', 1 )->where('is_addon_value',0)->findAll(); // dd($empPolicy); if ($empPolicy) { @@ -1032,6 +1034,7 @@ public function getEmployeePolicy() foreach ($empPolicy as $array) { // Reset employee array $empData = $employeeData; + // Removes specific keys from the decoded array and assigns the result to $refusingData $decodedArray = json_decode($array->Policy_Terms); @@ -1045,9 +1048,10 @@ public function getEmployeePolicy() // Construct value for policy type GPA if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){ - + // Filter employee data where the family_floater_key is 'self' $selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self'); + $self['is_value_exist'] = true; $self['data']['family_floater_key'] = 'self'; $self['data']['employee_id'] = $id; @@ -1244,8 +1248,8 @@ public function getAddOnPolicy() { try { - $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll(); - $GMCEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll(); + $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',1)->findAll(); + $GMCEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',0)->findAll(); $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();