diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index e293eacbbd11..6216f41cfcae 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -181,6 +181,16 @@ class InvoiceController extends Controller ->with('message', ctrans('texts.no_payable_invoices_selected')); } + //ensure all stale fees are removed. + $invoices->each(function ($invoice) { + $invoice->service() + ->markSent() + ->removeUnpaidGatewayFees() + ->save(); + }); + + $invoices = $invoices->fresh(); + //iterate and sum the payable amounts either partial or balance $total = 0; foreach ($invoices as $invoice) { diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 78fdf1cc272f..e1947d9dbdbc 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -442,7 +442,6 @@ class InvoiceService $this->invoice->line_items = array_values($items); $this->invoice = $this->invoice->calc()->getInvoice(); - $this->deleteEInvoice(); //@deprecated /* 24-03-2022 */ $new_balance = $this->invoice->balance;