CHANGE_SI_COMMA_SEPERATE_HANDLE

This commit is contained in:
VENKATESHWARAN 2025-10-27 18:10:13 +05:30
parent e5df53f4cd
commit 7c16c90d14
4 changed files with 83 additions and 5 deletions

View File

@ -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 '<br>START- ' . $row[2];
$employee = $this->employeeModel
->where('emp_code', $row[1])

View File

@ -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 '<br>START- ' . $row[2];
$employee = $this->employeeModel
->where('emp_code', $row[1])

View File

@ -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);

View File

@ -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));
}
}