diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index f6871c13..af0710f0 100644 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -121,14 +121,11 @@ class EmpDataServiceController extends BaseController $totals += $value->total; } - // dd((Double) $totals, $insurer_id['insurer_id'], (Double) $cash_balance['balance']); + if((int) $cash_balance['balance'] < (int) $totals){ - // if((int) $totals < (int) $cash_balance['balance']){ + return 0; + } - // dd($totals, $insurer_id['insurer_id'], $cash_balance['balance']); - // } - - // dd($totals); // Log the count of exported data $count = count($objects); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index ff465d78..b1b33241 100644 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -345,7 +345,15 @@ class EmployeeController extends AdminController if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition') { $return = $empDataServiceController->generateExcelForAdditionandInception($batch_data); + + if($return == 0){ + + session()->setFlashdata('error', "The insurer has an insufficient deposit amount."); + return redirect()->to(base_url('employee/upload')); + } + if (!$return) { + 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')); @@ -353,6 +361,7 @@ class EmployeeController extends AdminController 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]); }