From b63950ed00e74c25b9fcefb7fbfef92b9d3d0678 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 9 Feb 2026 15:50:02 +0530 Subject: [PATCH] FIX_ISSUE --- app/Controllers/ClientController.php | 6 ++--- app/Controllers/EmployeeServiceController.php | 26 ++++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 10826d69..43b0fafc 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -6470,9 +6470,9 @@ class ClientController extends AdminController // ---------- EMP SERVICE CONTROLLER -------------------------------------------------------------------------------- $empServiceController = new EmployeeServiceController(); - // $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']); - // $res = $empServiceController->excelFileDataValidation(['file_id' => '1252']); - // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1263]); + // $res = $empServiceController->excelFileFormatValidation(['file_id' => '1264']); + // $res = $empServiceController->excelFileDataValidation(['file_id' => '1264']); + // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1264]); // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1262]); // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]); // $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]); diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 84761c68..bc4bfa7c 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1402,6 +1402,8 @@ class EmployeeServiceController extends AdminController $employee_data_group_by_family = data_group_by_family($excel_data, 'excel', '', $current_column_action); // dd($employee_data_group_by_family); + + $employee_insert_count = 0; foreach ($employee_data_group_by_family as $emp_id => $family) { @@ -1425,11 +1427,25 @@ class EmployeeServiceController extends AdminController $data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units); // dd($data); $employee_data_group_by_family[$emp_id] = $data; - $this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]); + $res = $this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]); + + if($res > 0){ + $employee_insert_count++; + } } - $this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update(); - $this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]); + if($employee_insert_count > 0){ + $this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update(); + $this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]); + }else{ + $reason = json_encode([ + 'error_summary' => [5 => 1], + 'error_data' => "Rack rate configuration issue: Please check the slab rates configuration" + ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); + $this->fileModel->where('id', $file_id)->set(['status' => 'failed','reason' => $reason])->update(); + $this->myLogger->logme("error",'{file_id} uploaded failed with reason: Rack rate configuration issue: Please check the slab rates configuration',['file_id' => $file_id]); + + } $this->setPullNotification($this->getFileMetaDataByFileId($file_id,'success')); @@ -1842,6 +1858,7 @@ class EmployeeServiceController extends AdminController $policy_details = $this->clientPolicyModel->where('id', $file['policy_id'])->first(); // dd($policy_details); + $employee_insert_count = 0; foreach($familiy_data as $fkey => $value) { if(is_array($value)) @@ -1974,6 +1991,7 @@ class EmployeeServiceController extends AdminController // else{ $emp_policy_id = $employee_policy[0]['id']; } $this->myLogger->logme('error',$log_message); + $employee_insert_count++; }// if end }// is array check end @@ -1982,6 +2000,8 @@ class EmployeeServiceController extends AdminController $this->myLogger->logme('error','######Incoming value is not an array'); } }// for end + + return $employee_insert_count; }//function end