From 8aed90a060008a65f62175bcfe807793f0bbe7dc Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Oct 2024 17:14:56 +1000 Subject: [PATCH] Minor corrections for ledge balance when pre payments used. --- app/Services/Payment/UpdateInvoicePayment.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index 84cc49b8ab..25d1e27983 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -97,6 +97,11 @@ class UpdateInvoicePayment $p->pivot->forceDelete(); }); + + $invoice + ->ledger() + ->updateInvoiceBalance($paid_amount*-1, "Prepayment Balance Adjustment"); + $invoice->is_deleted = true; $invoice->deleted_at = now(); $invoice->saveQuietly();