From 783aaa9a54c1824166416460b4c5f19e418cfc6d Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 3 Jun 2025 11:13:50 +0530 Subject: [PATCH] CHANGE_API : RV --- app/Config/Routes.php | 1 + app/Controllers/EmployeeController.php | 6 ++++-- app/Controllers/EmployeeRestController.php | 4 +++- app/Controllers/RestAuthenticationController.php | 4 ++-- app/Models/ClientPolicyModel.php | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 73fe07a4..5a7c70f4 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -448,6 +448,7 @@ $routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDr //crone job $routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus'); $routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail"); +$routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus'); //Employee login api's $routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index c827036f..43e600da 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -336,7 +336,8 @@ class EmployeeController extends AdminController ->join('client_branch cb', 'files.client_branch_id = cb.id', 'left') ->join('policy_type', 'policy_type.id = cp.policy_type_id') ->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left') - ->join("client_rm cr","cr.client_id = c.id and cr.is_active = 1",'left'); + ->join("client_rm cr","cr.client_id = c.id and cr.is_active = 1",'left') + ->where('files.is_active', 1); if (in_array($role_id, [2, 3])) { // If the user is a Account Manager or Manager, filter by user_id @@ -386,7 +387,8 @@ class EmployeeController extends AdminController ->join('client_branch', 'client_branch.id = batch_files.client_branch_id') ->join('policy_type', 'policy_type.id = client_policy.policy_type_id') ->join('clients', 'clients.id = client_policy.client_id') - ->join("client_rm cr","cr.client_id = clients.id and cr.is_active = 1",'left'); + ->join("client_rm cr","cr.client_id = clients.id and cr.is_active = 1",'left') + ->where('batch_files.is_active', 1); if (in_array($role_id, [2, 3])) { // If the user is a Account Manager or Manager, filter by user_id diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 1bc3595d..5c587221 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2502,7 +2502,8 @@ class EmployeeRestController extends AdminController function getEmployeeActiveOrInactivePolicy() { if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; } - $ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url, policy_type.long_name as policy_long_name') + $dayInterval = 10; + $ClientPolicyData = $this->clientPolicyModel->select("client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url, policy_type.long_name as policy_long_name, DATE_ADD(client_policy.policy_end_date, INTERVAL {$dayInterval} DAY) as claims_grace_date") ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') ->join('tpa', 'client_policy.tpa_id = tpa.id', 'left') ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') @@ -2565,6 +2566,7 @@ class EmployeeRestController extends AdminController $data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']); $data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']); $data['heading'] = $ClientPolicyValue['policy_long_name']; + $data['claims_grace_date'] = $ClientPolicyValue['claims_grace_date']; // $data['policy_terms'] = $terms; // if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 77c6854c..7783287b 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -78,7 +78,7 @@ class RestAuthenticationController extends AdminController ->where('employees.emp_status !=', 'truncated') ->where('employees.mobile', $mobile_number) ->where('EP.is_active', 1) - ->whereIn('EP.status', ['active']) + ->whereIn('EP.status', ['active', 'expired']) ->first(); @@ -118,7 +118,7 @@ class RestAuthenticationController extends AdminController ->where('employees.emp_status !=', 'truncated') ->where('employees.email_corporate', $email) ->where('EP.is_active', 1) - ->whereIn('EP.status', ['active']) + ->whereIn('EP.status', ['active', 'expired']) ->first(); if (isset($employeeData['employee_id'])) { diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index b30e0fd7..12759036 100755 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -331,7 +331,7 @@ class ClientPolicyModel extends Model $client_count = $this->db->affectedRows(); // Update employee_polices table - $employee = $this->db->query("UPDATE employee_polices SET status = 'expired', is_active = 0 WHERE policy_end_date < CURDATE()"); + $employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()"); $emp_count = $this->db->affectedRows(); // Log the result