From 0d17c1692b04f73c8f557fb19d2054e87390a92c Mon Sep 17 00:00:00 2001 From: bitbucket Date: Wed, 29 May 2024 13:27:34 +0530 Subject: [PATCH] CHANGE_ adding branch_id : GWM --- app/Controllers/EmployeeRestController.php | 142 +++++++++++---------- 1 file changed, 74 insertions(+), 68 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 81529bc7..09dff202 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -403,6 +403,73 @@ class EmployeeRestController extends AdminController } + // Get the RelationShip list + public function createOrUpdateEmployeePolicySiAmount() + { + + try { + $requestData = $this->request->getJSON(); + + foreach ($requestData as $key => $value) { + + + $checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id) + ->where('client_policy_id', $value->client_policy_id) + ->where('is_active', 1 ) + ->findAll(); + + + // dd($checkIfExist); + if ($checkIfExist) { + + $empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si); + + }else{ + + $data['employee_id']= $value->employee_id; + $data['client_policy_id']= $value->client_policy_id; + $data['basic_cover_si']= $value->basic_cover_si; + $data['status'] = 'draft'; + + $this->employeePolicyModel->insert($data); + } + } + + $this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code); + + return $this->respond(['status' => 'success','code' => 200,'data' => []], 200); + + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } + } + + public function findPremiumAmount($slabArray,$siAmount) + { + foreach ($slabArray as $key => $value) { + if($value['si'] == $siAmount){ + return $value['premium']; + break; + } + } + } + + public function relationshipList() + { + try { + + $relation_ships= $this->relationshipModel->findAll(); + + if(count($relation_ships) > 0){ + return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200); + }else{ + return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200); + } + + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } + } public function getEmployeeAndDependenceByClientId() { @@ -422,7 +489,6 @@ class EmployeeRestController extends AdminController } - public function exportDataByClientPolicyId() { try { @@ -500,6 +566,7 @@ class EmployeeRestController extends AdminController } + //not in use public function getClientPolicy() { try { @@ -538,73 +605,7 @@ class EmployeeRestController extends AdminController - // Get the RelationShip list - public function createOrUpdateEmployeePolicySiAmount() - { - - try { - $requestData = $this->request->getJSON(); - - foreach ($requestData as $key => $value) { - - - $checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id) - ->where('client_policy_id', $value->client_policy_id) - ->where('is_active', 1 ) - ->findAll(); - - - // dd($checkIfExist); - if ($checkIfExist) { - - $empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si); - - }else{ - - $data['employee_id']= $value->employee_id; - $data['client_policy_id']= $value->client_policy_id; - $data['basic_cover_si']= $value->basic_cover_si; - $data['status'] = 'draft'; - - $this->employeePolicyModel->insert($data); - } - } - - $this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code); - - return $this->respond(['status' => 'success','code' => 200,'data' => []], 200); - - } catch (\Exception $e) { - return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); - } - } - - public function findPremiumAmount($slabArray,$siAmount) - { - foreach ($slabArray as $key => $value) { - if($value['si'] == $siAmount){ - return $value['premium']; - break; - } - } - } - public function relationshipList() - { - try { - - $relation_ships= $this->relationshipModel->findAll(); - - if(count($relation_ships) > 0){ - return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200); - }else{ - return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200); - } - - } catch (\Exception $e) { - return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); - } - } // Upload the Employee Detail in DB by Sheet Data public function employeeUpload() @@ -618,6 +619,7 @@ class EmployeeRestController extends AdminController // die; $file = $this->request->getFile('file'); $client_id = $this->request->getPost('client_id'); + $client_branch_id = $this->request->getPost('client_branch_id'); $policy_id = $this->request->getPost('policy_id'); $client_data = $this->clientModel->where('id', $client_id)->first(); @@ -636,7 +638,7 @@ class EmployeeRestController extends AdminController - $client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first(); + $client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first(); if ($client_policy) { $policy = $this->policesModel->where('id', $client_policy['policy_id'])->first(); $policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first(); @@ -670,6 +672,7 @@ class EmployeeRestController extends AdminController $extractData['file_name']= $filename; $extractData['client_id']= $client_id; + $extractData['client_branch_id']= $client_branch_id; $extractData['status']= 'success'; $extractData['policy_id']= $policy_id; $extractData['action']= 'enrollment'; @@ -932,6 +935,7 @@ public function getAgeRange($terms,$familyFloatesValue) } + public function getEmployeePolicy() { try { @@ -1266,6 +1270,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl } } + public function FloterConvertion($array){ $result = []; @@ -1806,6 +1811,7 @@ public function getCashDepositData() ->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') ) + ->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') ) ->where('client_policy.is_active', 1 ) ->where('client_policy.policy_status', 1) ->findAll();