From 6c99f547ab0ae8bd94d016799a8fba8b5548c818 Mon Sep 17 00:00:00 2001 From: sriramv Date: Thu, 18 Apr 2024 16:56:43 +0530 Subject: [PATCH] 'FIX_EMP_MODULE_ID_ISSUE_IN_RACK_RATE_RV' --- app/Controllers/ClientController.php | 18 +++++++++++++----- app/Controllers/EmpDataServiceController.php | 2 +- app/Models/EmployeePolicyModel.php | 7 +++---- app/Views/policy_grid.php | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 600d054e..baca94e2 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1048,11 +1048,19 @@ class ClientController extends AdminController ->where("employees.emp_status",'active') ->countAllResults(); - if($emp_count == 0){ - $emp_count = true; - }else{ - $emp_count = false; - } + + $data = $this->employeePolicyModel->select('employee_polices.id') + ->where('employee_polices.is_active', 1) + ->where('employee_polices.client_policy_id', $client_policy_id) + ->findAll(); + + $emp_count = count($data); + + // if($emp_count == 0){ + // $emp_count = true; + // }else{ + // $emp_count = false; + // } $data = $this->policesModel->getPolicyPremium($record['policy_id']); diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 36e3690c..6f82164a 100644 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -1262,7 +1262,7 @@ class EmpDataServiceController extends BaseController $description = 'The following amount of Rs. ' . $amount->total_sum . '/- has been debited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.'; $data = [ - 'amount' => $amount->total_sum, + 'amount' => $amount->total_sum ?? 0, 'sub_type_id' => 4, 'client_id' => $arrayData['client_id'], 'insurer_id' => $insurer_id['insurer_id'], diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 82706219..9e817cd5 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -106,6 +106,7 @@ class EmployeePolicyModel extends Model { $client_policy_id = $ref_data['client_policy_id']; $insurer_or_tpa = $ref_data['insurer_or_tpa']; + $event = $ref_data['event_type']; if($insurer_or_tpa == 'tpa'){ @@ -150,13 +151,11 @@ class EmployeePolicyModel extends Model batch_files.batch_code as bf FROM batch_files LEFT JOIN batch_list ON batch_files.batch_code = batch_list.batch_code - WHERE batch_files.event_type = 'inception' + WHERE batch_files.event_type = '{$event}' AND batch_files.actions = 'export' AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}' ) as batch_data ON employee_polices.id = batch_data.emp_policy_id - WHERE batch_data.bf IS NULL - AND batch_data.bl IS NULL - AND employee_polices.client_policy_id = '{$client_policy_id}' + WHERE employee_polices.client_policy_id = '{$client_policy_id}' AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '') AND employee_polices.is_active = 1"; diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index 4a5a8f6c..372e5279 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -711,7 +711,7 @@ $('body').on('click', '.btnPolicyModel', function() { $('#nameOfThePolicy').html(' - ' + res.policy_name); $('#grid_emp_count').val(res.count); - if (res.count == false) { + if (res.count > 0) { console.log('count -- 2', res.count); $("#btnGridSubmit_2").hide(); } else {