From ca74a7b36ec1fb9551e6e6e7b94bfaf9b236ca8b Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 23 Apr 2025 10:32:54 +0530 Subject: [PATCH] CHNAGE_IS_PAY_BY_EMP_IN_WEB : RV --- app/Config/Routes.php | 1 + app/Controllers/ClientController.php | 5 +++ app/Controllers/EmployeeRestController.php | 38 ++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 3ec65d7..ee00689 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -444,6 +444,7 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) { $routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin"); $routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin"); +$routes->post("calculatePremium", "EmployeeRestController::calculatePremium"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index eb2bef5..f013e9f 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -44,6 +44,7 @@ use App\Models\SIMappingModel; use App\Controllers\EmpDataServiceController; use App\Controllers\GoogleDriveController; +use App\Controllers\EmployeeRestController; use App\Helpers\sendMailNotification; @@ -4567,6 +4568,10 @@ class ClientController extends AdminController // $empmodel = new EmployeeModel(); // $data = $empmodel->getEmployeePolicy(348); // dd($data); + + + // $empRest = new EmployeeRestController(); + // $empRest->calculatePremium(393, 'ARCPO7010', 500000, 27); } // ------------------------------------------------------------------------------------------------------- diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 1316a13..693e6d0 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2228,12 +2228,14 @@ class EmployeeRestController extends AdminController helper('excel_util_helper'); if($this->request){ // + echo 'request'; $client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId; $emp_code = $this->request->getVar('emp_code') ?? $empCode; $default_si = $this->request->getVar('si') ?? $default_si;// si amt which choosed in add on policy $client_branch_id = $this->request->getVar('client_branch_id') ?? $client_branch_id; }else{ //Cli and enrollment + echo 'internal'; $client_policy_id = $clientPolicyId; $emp_code = $empCode; $default_si = $default_si;// si amt which choosed in add on policy @@ -2295,6 +2297,42 @@ class EmployeeRestController extends AdminController $employee_data_group_by_family[$emp_id] = $data; } + + if($this->request){ + if(isset($policy_terms['policy_terms'])){ + $policyTermsJson = json_decode($policy_terms['policy_terms'], true); + // print_r($employee_data_group_by_family);die(); + + foreach ($employee_data_group_by_family[$emp_code] as $key => &$value) { + + if(strtolower($value['relationship']) == 'self' && $policyTermsJson['is_payable_employee']['self'] == 0){ + $value['policy_details']['rata_premimum'] = 0; + $value['policy_details']['premium'] = 0; + $value['policy_details']['gst'] = 0; + } + + if(strtolower($value['relationship']) == 'spouse' && $policyTermsJson['is_payable_employee']['spouse'] == 0){ + $value['policy_details']['rata_premimum'] = 0; + $value['policy_details']['premium'] = 0; + $value['policy_details']['gst'] = 0; + } + + if((strtolower($value['relationship']) == 'son' || strtolower($value['relationship']) == 'daughter') && $policyTermsJson['is_payable_employee']['childern'] == 0){ + $value['policy_details']['rata_premimum'] = 0; + $value['policy_details']['premium'] = 0; + $value['policy_details']['gst'] = 0; + } + + if((strtolower($value['relationship']) == 'father in law' || strtolower($value['relationship']) == 'mother in law' || strtolower($value['relationship']) == 'father' || strtolower($value['relationship']) == 'mother' ) && $policyTermsJson['is_payable_employee']['elders'] == 0){ + $value['policy_details']['rata_premimum'] = 0; + $value['policy_details']['premium'] = 0; + $value['policy_details']['gst'] = 0; + } + + } + unset($value); + } + } if($clientPolicyId != null && $empCode != null) { // dd ($employee_data_group_by_family);