From 547c1b36ee340c2269572d2b0704467423abd3b3 Mon Sep 17 00:00:00 2001 From: Smart Date: Mon, 14 Oct 2024 16:37:12 +0530 Subject: [PATCH] CHANGE missing si amount function : GWM --- app/Controllers/EmployeeRestController.php | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index a036c550..8d6ace5c 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -439,6 +439,29 @@ class EmployeeRestController extends AdminController 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(); + + + 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); + } + } if(count($requestData)) { $this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code , $requestData[0]->client_branch_id);