mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for paid to date when refund is applied
This commit is contained in:
parent
73b3c11d80
commit
3139539f46
@ -56,7 +56,7 @@ class AutoBillInvoice extends AbstractService
|
||||
|
||||
//if the credits cover the payments, we stop here, build the payment with credits and exit early
|
||||
|
||||
if($this->invoice->company->use_credits_payment == 'always' || $this->invoice->company->use_credits_payment == 'option')
|
||||
if($this->invoice->company->use_credits_payment != 'off')
|
||||
$this->applyCreditPayment();
|
||||
|
||||
info("partial = {$this->invoice->partial}");
|
||||
|
@ -241,6 +241,7 @@ class RefundPayment
|
||||
|
||||
$adjustment_amount += $refunded_invoice['amount'];
|
||||
$client->balance += $refunded_invoice['amount'];
|
||||
//$client->paid_to_date -= $refunded_invoice['amount'];//todo refund balancing
|
||||
$client->save();
|
||||
|
||||
//todo adjust ledger balance here? or after and reference the credit and its total
|
||||
@ -251,7 +252,8 @@ class RefundPayment
|
||||
// $this->credit_note->ledger()->updateCreditBalance($adjustment_amount, $ledger_string);
|
||||
|
||||
$client = $this->payment->client->fresh();
|
||||
$client->service()->updatePaidToDate(-1 * $this->total_refund)->save();
|
||||
//$client->service()->updatePaidToDate(-1 * $this->total_refund)->save();
|
||||
$client->service()->updatePaidToDate(-1 * $refunded_invoice['amount'])->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user