CHANGE_IMPORT_TPA_ID_DUPLICATE_CHECK : RV
This commit is contained in:
parent
ea14dacb90
commit
684d756fbc
@ -1367,7 +1367,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$emp_count = count($excel_data);
|
$emp_count = count($excel_data);
|
||||||
|
|
||||||
//get the employee data for excel file validation
|
//get the employee data for excel file validation
|
||||||
@ -1444,6 +1443,8 @@ class EmpDataServiceController extends BaseController
|
|||||||
$errors = []; // Initialize an array to store errors
|
$errors = []; // Initialize an array to store errors
|
||||||
$missing_id = [];
|
$missing_id = [];
|
||||||
$batch_list_id = [];
|
$batch_list_id = [];
|
||||||
|
$tpa_id_all = []; //this array to store all TPA ID
|
||||||
|
$tpa_id_duplicate = []; //store duplicate TPA ID
|
||||||
|
|
||||||
foreach ($employee_data as $key => $emp_value) {
|
foreach ($employee_data as $key => $emp_value) {
|
||||||
|
|
||||||
@ -1453,6 +1454,36 @@ class EmpDataServiceController extends BaseController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--- TPA ID Duplicate check start ---
|
||||||
|
|
||||||
|
$current_tpa_id = $excel_data[$key][13];
|
||||||
|
|
||||||
|
if (isset($tpa_id_all[$current_tpa_id])) {
|
||||||
|
|
||||||
|
// Add the current row to errors
|
||||||
|
$errors[$key][] = [
|
||||||
|
'row' => $key,
|
||||||
|
'column' => 13,
|
||||||
|
'db_data' => "Duplicate TPA ID Found",
|
||||||
|
'excel_data' => $current_tpa_id
|
||||||
|
];
|
||||||
|
|
||||||
|
// Add all existing rows with the same TPA ID to errors
|
||||||
|
foreach ($tpa_id_all[$current_tpa_id] as $existing_row) {
|
||||||
|
$errors[$existing_row][] = [
|
||||||
|
'row' => $existing_row,
|
||||||
|
'column' => 13,
|
||||||
|
'db_data' => "Duplicate TPA ID Found",
|
||||||
|
'excel_data' => $current_tpa_id
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$tpa_id_all[$current_tpa_id][] = $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- TPA ID Duplicate check end ---
|
||||||
|
|
||||||
if ($insurer_or_tpa == 'tpa') {
|
if ($insurer_or_tpa == 'tpa') {
|
||||||
|
|
||||||
if ($excel_data[$key][13] === null) {
|
if ($excel_data[$key][13] === null) {
|
||||||
@ -1610,6 +1641,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$batch_list_id[] = $emp_value['primaryKey'];
|
$batch_list_id[] = $emp_value['primaryKey'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dd($errors);
|
||||||
|
|
||||||
$error_count = count($errors);
|
$error_count = count($errors);
|
||||||
$json_errors = json_encode($errors);
|
$json_errors = json_encode($errors);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user