From 5ae2fcfdc42cc31d6c072728845afd029acd1151 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Wed, 24 Apr 2024 16:43:59 +0530 Subject: [PATCH] CHANGE_ family floter text : GWM --- app/Controllers/EmployeeRestController.php | 83 ++++++++++++---------- 1 file changed, 46 insertions(+), 37 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index fcac85ab..ffa655ba 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1075,6 +1075,11 @@ public function getEmployeePolicy() // Generate Notes string based on familyFloates terms $array->notes = $this->FloterNotesConvertion($familyFloates); + + if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1) + { $array->family_floter_notes = 'For Family'; } + else{ $array->family_floter_notes = 'For Members'; } + // Convert familyFloaters terms data to plain array $floters = $this->FloterConvertion($familyFloates); @@ -1514,50 +1519,54 @@ public function getCashDepositData() ->findAll(); $result = []; - foreach ($ClientPolicyData as $key => $value) { + if(count($ClientPolicyData)) + { + foreach ($ClientPolicyData as $key => $value) { - $data['clientId'] = $value['clientId']; - $data['insurerId'] = $value['insurerId']; - $data['insurerName'] = $value['insurer_name']; - $data['depositData'] = $this->clientPolicyModel->getdepositData($value['clientId'],$value['insurerId']); - $data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0; - - $data['policyDetails'] = []; - $ClientPolicyData =$this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon') - ->join('policies', 'client_policy.policy_id = policies.id', 'left') - ->where('client_policy.insurer_id', $value['insurerId'] ) - ->where('client_policy.client_id', $this->request->getGet('client_id') ) - ->findAll(); - foreach ($ClientPolicyData as $key => $value) - { - $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']); - 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']; } - $employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0); - $enrolledCount = 0; - $draftCount = 0; - if(count($employeeDetails)) + $data['clientId'] = $value['clientId']; + $data['insurerId'] = $value['insurerId']; + $data['insurerName'] = $value['insurer_name']; + $data['depositData'] = $this->clientPolicyModel->getdepositData($value['clientId'],$value['insurerId']); + $data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0; + + $data['policyDetails'] = []; + $ClientPolicyData =$this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon') + ->join('policies', 'client_policy.policy_id = policies.id', 'left') + ->where('client_policy.insurer_id', $value['insurerId'] ) + ->where('client_policy.client_id', $this->request->getGet('client_id') ) + ->findAll(); + foreach ($ClientPolicyData as $key => $value) { - foreach ($employeeDetails as $item) { - if ($item['emp_status'] === 'enrolled') { - $enrolledCount++; - } elseif ($item['emp_status'] === 'draft') { - $draftCount++; + $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']); + 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']; } + $employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0); + $enrolledCount = 0; + $draftCount = 0; + if(count($employeeDetails)) + { + foreach ($employeeDetails as $item) { + if ($item['emp_status'] === 'enrolled') { + $enrolledCount++; + } elseif ($item['emp_status'] === 'draft') { + $draftCount++; + } } } + + $value['totalMembersCount'] = count($employeeDetails); + $value['membersCountOfEnrolled'] = $enrolledCount; + $value['membersCountOfDraft'] = $draftCount; + + array_push($data['policyDetails'],$value); } - - $value['totalMembersCount'] = count($employeeDetails); - $value['membersCountOfEnrolled'] = $enrolledCount; - $value['membersCountOfDraft'] = $draftCount; - - array_push($data['policyDetails'],$value); + + + array_push($result,$data); + } - - - array_push($result,$data); - } - + + if($result) {