From f8d3e49cfd1820b86655c6905e98f862eb963a4b Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 22 Apr 2025 09:24:44 +0530 Subject: [PATCH] FIX_SI_ENHANCE_FILE_UPLOAD : RV --- app/Controllers/ClientController.php | 5 +++++ app/Controllers/EmployeeServiceController.php | 12 +++++++----- app/Helpers/excel_util_helper.php | 10 +++++----- app/Models/EmployeeModel.php | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 0a096c82..c808bac5 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4583,6 +4583,11 @@ class ClientController extends AdminController // $employeeRestController->employeesOnboardProcess(['file_id' => 835]); // $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]); // $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]); + $empServiceController = new EmployeeServiceController(); + // $res = $empServiceController->excelFileFormatValidation(['file_id' => '873']); + // $res = $empServiceController->excelFileDataValidation(['file_id' => '874']); + // $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '874']); + // dd('-----', $res); // ----------EMP DATA SERVICE CONTROLLER-------------------------------------------------------------------------------- diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 61e0af4a..993194a0 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -468,7 +468,7 @@ class EmployeeServiceController extends AdminController 'format' => null, 'allowed_values' => null, 'custom' => 'check_si', - 'params' => ['row', 'policy_terms', 'slab_details'] + 'params' => ['row', 'policy_details', 'slab_details'] ], 'date_of_enhancement' => [ 'col_idx' => 4, @@ -1552,9 +1552,11 @@ class EmployeeServiceController extends AdminController if($pre_rack_rate_name != $slab_value['rack_rate_name']) { $pre_rack_rate_name = $slab_value['rack_rate_name']; - $rack_rate_json = json_decode($slab_value['additional_relationship']); - if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != 'NA') - { + $rack_rate_json = json_decode($slab_value['additional_relationship'], true); + $relationship_array_key = strtolower($employee['relationship']); + + if(array_key_exists($relationship_array_key, $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != 'NA') + { $applicable_rack_rate_name = $slab_value['rack_rate_name']; $applicable_rack_rate_master = $slab_value['grid_master']; break; @@ -1563,7 +1565,7 @@ class EmployeeServiceController extends AdminController } //get max age,max count of the familiy - $max_age_and_max_count_of_current_member = $this->employeeModel->getFamiliyCountAndMaxage($employee['emp_code']); + $max_age_and_max_count_of_current_member = $this->employeeModel->getFamiliyCountAndMaxage($employee['emp_code']); //transform SI excel row data as inception excel OR premium calculateable fomart $data = transform_si_excel_row_to_calculatable_format(employee: $employee,employee_policy: $employee_policy,maxage_and_maxcount: $max_age_and_max_count_of_current_member,slab_details: $slab_details,applicable_slab_name: $applicable_rack_rate_name,augmented_si: $row[3],grid_master: $applicable_rack_rate_master); diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index c90eebb3..69fe4d98 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -407,7 +407,7 @@ if (!function_exists('data_group_by_family')) $row = transform_enrollment_row_to_inception_row($row); } - if(strtolower($row[5]) == 'self' && isset($result[$row[1]])) + if(isset($row[5]) && strtolower($row[5]) == 'self' && isset($result[$row[1]])) { array_unshift($result[$row[1]],$row); }else @@ -2119,15 +2119,15 @@ if(!function_exists('check_unit')) if(!function_exists('transform_si_excel_row_to_calculatable_format')) { - function transform_si_excel_row_to_calculatable_format(array $employee,array$employee_policy,array $maxage_and_maxcount,array $slab_details,string $applicable_slab_name,string $augmented_si,array $grid_master) - { + function transform_si_excel_row_to_calculatable_format(array $employee, array $employee_policy,array $maxage_and_maxcount,array $slab_details,string $applicable_slab_name,string $augmented_si,array $grid_master) + { $employee['temp'] = []; $employee['temp']['max_age'] = $maxage_and_maxcount[0]['max_age']; $employee['temp']['max_count'] = $maxage_and_maxcount[0]['family_member_count']; $employee['temp']['grid_name'] = $applicable_slab_name; $employee['temp']['grid_master'] = $grid_master; $employee['temp']['acting_self'] = true; - $employee['temp']['premium_type'] = $grid_master['premium_type']; + $employee['temp']['premium_type'] = $slab_details['slab_rates'][0]['premium_type']; $employee['temp']['grid_type'] = $applicable_slab_name; $employee['temp']['grid_id'] = $grid_master['ui_type']; $employee['temp']['action'] = 'SI'; @@ -2137,7 +2137,7 @@ if(!function_exists('transform_si_excel_row_to_calculatable_format')) $employee['temp']['policy_status'] = null; $employee['temp']['emp_status'] = null; $employee['temp']['rata_premimum'] = null; - + $employee['policy_details'] = $employee_policy; return $employee; diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 524eb18b..6f4af68b 100755 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -222,7 +222,7 @@ class EmployeeModel extends Model ) AS family_stats ORDER BY family_member_count DESC, max_age DESC LIMIT 1;"; - $results = $this->db->query($query)->getResult(); + $results = $this->db->query($query)->getResultArray(); return $results; }