From 7c16c90d14b15dcef921715fe1f711269fbcefd1 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 27 Oct 2025 18:10:13 +0530 Subject: [PATCH 1/6] 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)); + } +} From 69f8243ac09117efd73572f019dad5c403a3789f Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 28 Oct 2025 10:31:04 +0530 Subject: [PATCH 2/6] FIX_ --- app/Controllers/LeadsController.php | 7 +++---- app/Helpers/utility_helper.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index ab968701..931146cb 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -773,7 +773,7 @@ class LeadsController extends BaseController $multi_file_data = []; foreach ($files as $index => $value) { - $file_name = file_Upload($value, $uploadFilePath); + $file_name = file_Upload_with_random_name($value, $uploadFilePath); $multi_file_data[] = [ 'file_name' => $file_name, 'docs_name' => $docs_names[$index], @@ -2605,7 +2605,6 @@ class LeadsController extends BaseController $this->myLogger->logme('error', (' no file found ' . $file_name_with_path)); return ['status' => 'failed', 'message' => 'no file found']; } - }catch(Exception $e){ $this->myLogger->logme("error", "Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString()); return ['status' => 'fail', 'error' => "File not found / Wrong file"]; @@ -5268,10 +5267,10 @@ class LeadsController extends BaseController 'filePath' => $fullPath ]; } else { - log_message('warning', 'File name is empty for ID: ' . $id); + log_message('error', 'File name is empty for ID: ' . $id); } } else { - log_message('warning', 'File does not exist at path: ' . $fullPath); + log_message('error', 'File does not exist at path: ' . $fullPath); } } else { log_message('warning', 'No active lead file found for ID: ' . $id . ' and lead_id: ' . $lead_id); diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index ba3099de..d85ae7c3 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -65,6 +65,20 @@ if (!function_exists('file_Upload')) { } } +if (!function_exists('file_Upload_with_random_name')) { + function file_Upload_with_random_name($fileToUpload, $filepath) + { + if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) { + $fileToUpload->move($filepath); + $fileName = $fileToUpload->getRandomName(); + $fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName); + return $fileName; + } else { + return ""; + } + } +} + // if (!function_exists('multi_file_Upload')) { // function multi_file_Upload($fileToUpload, $filepath) // { From e45ed190491dfd38120b3786cfce941e85bfb382 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 28 Oct 2025 10:45:20 +0530 Subject: [PATCH 3/6] CHANGE_FILE_UPLOAD --- app/Controllers/LeadsController.php | 3 ++- app/Helpers/utility_helper.php | 16 +--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 931146cb..e84a15e2 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -773,7 +773,7 @@ class LeadsController extends BaseController $multi_file_data = []; foreach ($files as $index => $value) { - $file_name = file_Upload_with_random_name($value, $uploadFilePath); + $file_name = file_Upload($value, $uploadFilePath); $multi_file_data[] = [ 'file_name' => $file_name, 'docs_name' => $docs_names[$index], @@ -2605,6 +2605,7 @@ class LeadsController extends BaseController $this->myLogger->logme('error', (' no file found ' . $file_name_with_path)); return ['status' => 'failed', 'message' => 'no file found']; } + }catch(Exception $e){ $this->myLogger->logme("error", "Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString()); return ['status' => 'fail', 'error' => "File not found / Wrong file"]; diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index d85ae7c3..632218cd 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -57,21 +57,7 @@ if (!function_exists('file_Upload')) { if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) { $fileToUpload->move($filepath); $fileName = $fileToUpload->getName(); - $fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName); - return $fileName; - } else { - return ""; - } - } -} - -if (!function_exists('file_Upload_with_random_name')) { - function file_Upload_with_random_name($fileToUpload, $filepath) - { - if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) { - $fileToUpload->move($filepath); - $fileName = $fileToUpload->getRandomName(); - $fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName); + // $fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName); return $fileName; } else { return ""; From 543bdd41e7df56d2995caa065332685e189b004b Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 28 Oct 2025 11:04:27 +0530 Subject: [PATCH 4/6] CHANGE_FILE_UPLOAD_ISSUE --- app/Controllers/LeadsController.php | 2 +- app/Helpers/utility_helper.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index e84a15e2..98ec08c0 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -773,7 +773,7 @@ class LeadsController extends BaseController $multi_file_data = []; foreach ($files as $index => $value) { - $file_name = file_Upload($value, $uploadFilePath); + $file_name = file_Upload_for_lead($value, $uploadFilePath); $multi_file_data[] = [ 'file_name' => $file_name, 'docs_name' => $docs_names[$index], diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index 632218cd..9130a991 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -57,7 +57,20 @@ if (!function_exists('file_Upload')) { if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) { $fileToUpload->move($filepath); $fileName = $fileToUpload->getName(); - // $fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName); + $fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName); + return $fileName; + } else { + return ""; + } + } +} + +if (!function_exists('file_Upload_for_lead')) { + function file_Upload_for_lead($fileToUpload, $filepath) + { + if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) { + $fileToUpload->move($filepath); + $fileName = $fileToUpload->getName(); return $fileName; } else { return ""; From c96a06fcfc41f0fe8860a5feb2d7cee0ec0ec38c Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 28 Oct 2025 11:37:09 +0530 Subject: [PATCH 5/6] CHANGE_STOP_VALIDATION --- app/Controllers/LeadsController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 98ec08c0..3d82fced 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -665,7 +665,10 @@ class LeadsController extends BaseController if ($value['lead_form_type'] == 1) { //for this push the job to the calculateMembersDemography() function $job_details = new Jobs(); - $r = Jobs::addJob(['job_name' => 'memberDataListExcelFileFormatValidation', 'payload' => [ + // $r = Jobs::addJob(['job_name' => 'memberDataListExcelFileFormatValidation', 'payload' => [ + // 'lead_id' => $insert, + // ]]); + $r = Jobs::addJob(['job_name' => 'calculateMembersDemography', 'payload' => [ 'lead_id' => $insert, ]]); } @@ -809,7 +812,10 @@ class LeadsController extends BaseController if (!empty($lead_form_type) && $lead_form_type == 1 && $key == 0) { //for this push the job to the calculateMembersDemography() function $job_details = new Jobs(); - $r = Jobs::addJob(['job_name' => 'memberDataListExcelFileFormatValidation', 'payload' => [ + // $r = Jobs::addJob(['job_name' => 'memberDataListExcelFileFormatValidation', 'payload' => [ + // 'lead_id' => $lead_id, + // ]]); + $r = Jobs::addJob(['job_name' => 'calculateMembersDemography', 'payload' => [ 'lead_id' => $lead_id, ]]); log_message('info', "calculateMembersDemography JOB PUSHED"); From 7e6ecd570dc55846905a61ca6d1f5b0e505a773f Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 28 Oct 2025 11:56:14 +0530 Subject: [PATCH 6/6] CHANGE_PLACEMENT_MAIL_TEMPLATE --- app/Controllers/LeadsController.php | 56 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 3d82fced..731202da 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -1089,6 +1089,7 @@ class LeadsController extends BaseController // 7. Define mail templates as constants or config $mail_content = $this->getMailTemplate(); + $placement_mail_content = $this->getMailTemplate('placement'); $subject = $this->getSubjectTemplate($lead_data); // 8. Pre-calculate sum assured only for GPA @@ -1097,7 +1098,7 @@ class LeadsController extends BaseController // 9. Transform mail content once $data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']); $data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']); - $data['placement_mail_content'] = $this->transformMailContent($lead_data, $mail_content, 'Placement'); + $data['placement_mail_content'] = $this->transformMailContent($lead_data, $placement_mail_content, 'Placement'); $data['placement_subject'] = $this->transformMailContent($lead_data, $subject, 'Placement'); // 10. Combine related queries @@ -1150,24 +1151,43 @@ class LeadsController extends BaseController } // 13. Extract mail template to separate method for reusability - private function getMailTemplate() - { - return ' -

Dear Sir,

-

Greetings From Nhance India!

-

Please find attached the {{RFQ_OR_QCR}} for {{POLICY_TYPE}} policy pertaining to {{CLIENT_NAME}}.

-

Kindly request you to share the competitive quotes at the earliest.

-

In case of any query, please feel free to contact us.

-

Thank You!


-

Best regards,

+ private function getMailTemplate( $template_type = "" ) + { + if($template_type == 'placement'){ + return ' +

Dear Sir,

+

Greetings From Nhance India!

+

Please find attached the {{RFQ_OR_QCR}} for {{POLICY_TYPE}} policy pertaining to {{CLIENT_NAME}}.

+

Kindly request you to issue the policy at the earliest.

+

In case of any query, please feel free to contact us.

+

Thank You!


+

Best regards,

+ +
+
{{LOGGED_USER_NAME}}
+
Mobile: {{LOGGED_USER_MOBILE}}
+
-
-
{{LOGGED_USER_NAME}}
-
Mobile: {{LOGGED_USER_MOBILE}}
-
- - Nhance Logo - '; + Nhance Logo + '; + }else{ + return ' +

Dear Sir,

+

Greetings From Nhance India!

+

Please find attached the {{RFQ_OR_QCR}} for {{POLICY_TYPE}} policy pertaining to {{CLIENT_NAME}}.

+

Kindly request you to share the competitive quotes at the earliest.

+

In case of any query, please feel free to contact us.

+

Thank You!


+

Best regards,

+ +
+
{{LOGGED_USER_NAME}}
+
Mobile: {{LOGGED_USER_MOBILE}}
+
+ + Nhance Logo + '; + } } // 14. Extract subject template to separate method