From 7c16c90d14b15dcef921715fe1f711269fbcefd1 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 27 Oct 2025 18:10:13 +0530 Subject: [PATCH] CHANGE_SI_COMMA_SEPERATE_HANDLE --- .../EmployeeMultiEventServiceController.php | 34 +++++++++++++++++-- app/Controllers/EmployeeServiceController.php | 34 +++++++++++++++++-- app/Helpers/excel_util_helper.php | 13 ++++++- app/Helpers/utility_helper.php | 7 ++++ 4 files changed, 83 insertions(+), 5 deletions(-) diff --git a/app/Controllers/EmployeeMultiEventServiceController.php b/app/Controllers/EmployeeMultiEventServiceController.php index 50fbe300..19c3d65d 100644 --- a/app/Controllers/EmployeeMultiEventServiceController.php +++ b/app/Controllers/EmployeeMultiEventServiceController.php @@ -1461,6 +1461,13 @@ class EmployeeMultiEventServiceController extends BaseController $enrollment_keys = array_keys($enrollment_columns_to_check); } + // for this condition to avoid 5,00,000 to 500000 + if($current_column_action == 'SI'){ + $row[3] = removeNumberFormatting($row[3]); + }else if(in_array($current_column_action, ['I','DA', 'MI', 'A'])){ + $row[6] = removeNumberFormatting($row[6]); + } + //iterate each row for columns validations foreach ($row as $col_key => $col) { $is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory']; @@ -1599,6 +1606,16 @@ class EmployeeMultiEventServiceController extends BaseController $columns_to_check = $this->inception_excel_columns; } + $current_column_action = null; + if($file['action'] == 'inception'){ $current_column_action = 'I'; } + else if($file['action'] == 'addition'){ $current_column_action = 'A'; } + else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; } + else if($file['action'] == 'deletion'){ $current_column_action = 'D'; } + else if($file['action'] == 'correction'){ $current_column_action = 'C'; } + else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; } + else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; } + else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; } + $columns_to_check = $this->syncColIndex($this->multievent_excel_columns, $columns_to_check); // print_rr($columns_to_check); @@ -1626,7 +1643,7 @@ class EmployeeMultiEventServiceController extends BaseController if (in_array($file['action'], ['inception', 'missed_inception', 'addition', 'dependent_addition', 'deletion', 'correction', 'si_enhancement', 'enrollment'])) // the below funcitons are only for I,DA,A { - $employee_data_group_by_family = data_group_by_family($excel_data, 'excel', ($file['action'] == 'enrollment' ? 'enrollment' : '')); + $employee_data_group_by_family = data_group_by_family($excel_data, 'excel', ($file['action'] == 'enrollment' ? 'enrollment' : ''), $current_column_action); // dd($employee_data_group_by_family); $is_self_available_in_policy_terms = false; if ($policy_details['policy_type_id'] == 3) // GMC parents @@ -1798,6 +1815,16 @@ class EmployeeMultiEventServiceController extends BaseController $columns_to_check = $this->inception_excel_columns; } + $current_column_action = null; + if($file['action'] == 'inception'){ $current_column_action = 'I'; } + else if($file['action'] == 'addition'){ $current_column_action = 'A'; } + else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; } + else if($file['action'] == 'deletion'){ $current_column_action = 'D'; } + else if($file['action'] == 'correction'){ $current_column_action = 'C'; } + else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; } + else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; } + else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; } + // get policy and rack details $policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'], $file['policy_id']); $policy_terms = (array) $policy_terms[0]; // convert obj to array @@ -1821,7 +1848,7 @@ class EmployeeMultiEventServiceController extends BaseController //get existing units in the current branch $existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'], client_branch_id: $file['client_branch_id']); - $employee_data_group_by_family = data_group_by_family($excel_data); + $employee_data_group_by_family = data_group_by_family($excel_data, 'excel', '', $current_column_action); // dd($employee_data_group_by_family); foreach ($employee_data_group_by_family as $emp_id => $family) { @@ -2133,6 +2160,9 @@ class EmployeeMultiEventServiceController extends BaseController if (check_row_is_empty_or_null($row)) { break; } + + $row[3] = removeNumberFormatting($row[3]); + // echo '
START- ' . $row[2]; $employee = $this->employeeModel ->where('emp_code', $row[1]) diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index bee97fe1..4a8a3fd2 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -910,6 +910,13 @@ class EmployeeServiceController extends AdminController $enrollment_columns_to_check = $this->enrollment_excel_columns; $enrollment_keys = array_keys($enrollment_columns_to_check); } + + // for this condition to avoid 5,00,000 to 500000 + if($current_column_action == 'SI'){ + $row[3] = removeNumberFormatting($row[3]); + }else if(in_array($current_column_action, ['I','DA', 'MI', 'A'])){ + $row[6] = removeNumberFormatting($row[6]); + } //iterate each row for columns validations foreach ($row as $col_key => $col) @@ -1086,6 +1093,16 @@ class EmployeeServiceController extends AdminController if($file['action'] == 'enrollment'){ $columns_to_check = $this->enrollment_excel_columns; } if($file['action'] == 'missed_inception'){ $columns_to_check = $this->inception_excel_columns; } + $current_column_action = null; + if($file['action'] == 'inception'){ $current_column_action = 'I'; } + else if($file['action'] == 'addition'){ $current_column_action = 'A'; } + else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; } + else if($file['action'] == 'deletion'){ $current_column_action = 'D'; } + else if($file['action'] == 'correction'){ $current_column_action = 'C'; } + else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; } + else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; } + else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; } + // get policy and rack details $policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']); $policy_details = (array)$policy_terms[0]; @@ -1116,7 +1133,7 @@ class EmployeeServiceController extends AdminController if(in_array($file['action'],['inception','missed_inception','addition','dependent_addition','deletion','correction','si_enhancement','enrollment']))// the below funcitons are only for I,DA,A { - $employee_data_group_by_family = data_group_by_family($excel_data,'excel',($file['action'] == 'enrollment' ? 'enrollment' : '')); + $employee_data_group_by_family = data_group_by_family($excel_data,'excel',($file['action'] == 'enrollment' ? 'enrollment' : ''), $current_column_action); // dd($employee_data_group_by_family); $is_self_available_in_policy_terms = false; if($policy_details['policy_type_id'] == 3) // GMC parents @@ -1321,6 +1338,16 @@ class EmployeeServiceController extends AdminController if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; } if($file['action'] == 'missed_inception'){ $columns_to_check = $this->inception_excel_columns; } + $current_column_action = null; + if($file['action'] == 'inception'){ $current_column_action = 'I'; } + else if($file['action'] == 'addition'){ $current_column_action = 'A'; } + else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; } + else if($file['action'] == 'deletion'){ $current_column_action = 'D'; } + else if($file['action'] == 'correction'){ $current_column_action = 'C'; } + else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; } + else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; } + else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; } + // get policy and rack details $policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']); $policy_terms = (array) $policy_terms[0];// convert obj to array @@ -1344,7 +1371,7 @@ class EmployeeServiceController extends AdminController //get existing units in the current branch $existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']); - $employee_data_group_by_family = data_group_by_family($excel_data); + $employee_data_group_by_family = data_group_by_family($excel_data, 'excel', '', $current_column_action); // dd($employee_data_group_by_family); foreach ($employee_data_group_by_family as $emp_id => $family) { @@ -1681,6 +1708,9 @@ class EmployeeServiceController extends AdminController { break; } + + $row[3] = removeNumberFormatting($row[3]); + // echo '
START- ' . $row[2]; $employee = $this->employeeModel ->where('emp_code', $row[1]) diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index b17e2665..2c7ff2bb 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -370,13 +370,24 @@ if (!function_exists('check_dob_diff')) { } if (!function_exists('data_group_by_family')) { - function data_group_by_family($emp_data, $data_source = 'excel', $action = '') + function data_group_by_family($emp_data, $data_source = 'excel', $action = '', $current_column_action = null) { $result = []; // Kint::dump($emp_data); foreach ($emp_data as $rkey => $row) { + + + if ($data_source == 'excel') { if (!check_row_is_empty_or_null($row)) { + + // for this condition to avoid 5,00,000 to 500000 + if($current_column_action == 'SI'){ + $row[3] = removeNumberFormatting($row[3]); + }else if(in_array($current_column_action, ['I','DA', 'MI', 'A'])){ + $row[6] = removeNumberFormatting($row[6]); + } + if ($action == 'enrollment') //if action is enrollment transform current row into inception row, becoz we treat enrollment as inception { $row = transform_enrollment_row_to_inception_row($row); diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index 86229e9d..ba3099de 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -866,3 +866,10 @@ if (!function_exists('getFileIfExists')) { return file_exists(FCPATH . $path) ? base_url($path) : ''; } } + +if (!function_exists('removeNumberFormatting')) { + function removeNumberFormatting($number) + { + return (float) str_replace(',', '', trim($number)); + } +}