From fa2019661d5662f09b09a7d8ffa2678973a85c60 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 5 Apr 2022 05:23:39 +1000 Subject: [PATCH] Fixes for regression --- app/Services/Payment/UpdateInvoicePayment.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index a55f65fb703a..b51644100098 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -73,6 +73,10 @@ class UpdateInvoicePayment /*Improve performance here - 26-01-2022 - also change the order of events for invoice first*/ //caution what if we amount paid was less than partial - we wipe it! + $invoice->balance -= $paid_amount; + $invoice->paid_to_date += $paid_amount; + $invoice->save(); + $invoice = $invoice->service() ->clearPartial() // ->updateBalance($paid_amount * -1) @@ -80,10 +84,6 @@ class UpdateInvoicePayment ->updateStatus() ->touchPdf() ->save(); - - $invoice->balance -= $paid_amount; - $invoice->paid_to_date += $paid_amount; - $invoice->save(); $invoice->service() ->workFlow()