Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
bitbucket 2024-04-22 16:03:03 +05:30
commit b5e466f31d
4 changed files with 34 additions and 27 deletions

View File

@ -108,6 +108,8 @@ class EmpDataServiceController extends BaseController
// Fetch employee data for export from the database
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
// dd($objects);
$totals = 0;
foreach ($objects as $key => $value) {
@ -606,35 +608,28 @@ class EmpDataServiceController extends BaseController
// dd($import_data, $empty_emp_tpa_uh_ids);
$tpa_id = [];
$uhid = [];
foreach ($data as $key => $value) {
if (!empty($value)) {
if ($import_data['insurer_or_tpa'] == 'tpa') {
$tpa_id = $value[15] !== null ? $value[15] : '';
$uhid = $value[16] !== null ? $value[16] : '';
$data = ['tpa_id' => $tpa_id, 'uhid' => $uhid];
} else if ($import_data['insurer_or_tpa'] == 'insurer') {
$tpa_id = $value[15] !== null ? $value[15] : '';
$uhid = $value[16] !== null ? $value[16] : '';
$data = ['tpa_id' => $tpa_id, 'uhid' => $uhid];
}
foreach ($empty_emp_tpa_uh_ids as $id) {
$this->employeePolicyModel->where('id', $id)->set($data)->update();
}
} else {
return 0;
}
$tpa_id[] = $value[15];
$uhid[] = $value[16];
}
foreach ($empty_emp_tpa_uh_ids as $key => $id) {
$dataToUpdateTPAID = ['tpa_id' => $tpa_id[$key]];
$dataToUpdateUHID = ['uhid' => $uhid[$key]];
$this->employeePolicyModel->where('id', $id)
->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")')
->set($dataToUpdateTPAID)->update();
$this->employeePolicyModel->where('id', $id)
->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")')
->set($dataToUpdateUHID)->update();
}
if($import_data['insurer_or_tpa'] == 'tpa'){

View File

@ -351,8 +351,14 @@ class EmployeeController extends AdminController
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
if(!$return){
session()->setFlashdata('error', 'No data found about this action');
return redirect()->to(base_url('employee/upload'));
if($insurer_or_tpa == 'tpa'){
session()->setFlashdata('error', "No data was found for this action. The TPA ID has already been updated.");
return redirect()->to(base_url('employee/upload'));
}else if($insurer_or_tpa == 'insurer'){
session()->setFlashdata('error', "No data was found for this action. The UHID has already been updated.");
return redirect()->to(base_url('employee/upload'));
}
} else{
$this->myLogger->logme('error','Successfully exported Excel file in {data}.', ['data' => $event_type]);
}

View File

@ -112,6 +112,10 @@ if (! function_exists('transform_objects_to_array_for_inception')) {
// Iterate through each object
foreach ($objects as $obj) {
$TPAID = isset($obj->tpa_id) && $obj->tpa_id !== '' ? $obj->tpa_id : '';
$UHID = isset($obj->uhid) && $obj->uhid !== '' ? $obj->uhid : '';
// Extract all values for the object
$rowData = [
$serialNumber++, // Serial Number

View File

@ -130,6 +130,8 @@ class EmployeePolicyModel extends Model
'Has Define' as emp_type,
employee_polices.id as primaryKey,
employee_polices.tpa_id,
employee_polices.uhid,
employee_polices.pre_existing_alignments,
employee_polices.basic_cover_si,
employee_polices.date_coverage,