Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2024-04-27 08:44:56 +05:30
commit 9793593854

View File

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