mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 06:04:30 -04:00
Fix payment report with partial payments
This commit is contained in:
parent
ac5cd8a806
commit
79532ce2f6
@ -20,6 +20,7 @@ class PaymentReport extends AbstractReport
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
|
$invoiceMap = [];
|
||||||
|
|
||||||
$payments = Payment::scope()
|
$payments = Payment::scope()
|
||||||
->orderBy('payment_date', 'desc')
|
->orderBy('payment_date', 'desc')
|
||||||
@ -48,7 +49,11 @@ class PaymentReport extends AbstractReport
|
|||||||
$payment->present()->method,
|
$payment->present()->method,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (! isset($invoiceMap[$invoice->id])) {
|
||||||
$this->addToTotals($client->currency_id, 'amount', $invoice->amount);
|
$this->addToTotals($client->currency_id, 'amount', $invoice->amount);
|
||||||
|
$invoiceMap[$invoice->id] = true;
|
||||||
|
}
|
||||||
|
|
||||||
$this->addToTotals($client->currency_id, 'paid', $payment->getCompletedAmount());
|
$this->addToTotals($client->currency_id, 'paid', $payment->getCompletedAmount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user