mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add payment details to invoice report
This commit is contained in:
parent
40ce28c433
commit
56ad438dd3
@ -354,7 +354,7 @@ class ReportController extends BaseController
|
|||||||
|
|
||||||
private function generateInvoiceReport($startDate, $endDate, $isExport)
|
private function generateInvoiceReport($startDate, $endDate, $isExport)
|
||||||
{
|
{
|
||||||
$columns = ['client', 'invoice_number', 'invoice_date', 'amount', 'paid', 'balance'];
|
$columns = ['client', 'invoice_number', 'invoice_date', 'amount', 'payment_date', 'paid', 'method'];
|
||||||
|
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$displayData = [];
|
$displayData = [];
|
||||||
@ -379,19 +379,25 @@ class ReportController extends BaseController
|
|||||||
}]);
|
}]);
|
||||||
|
|
||||||
foreach ($clients->get() as $client) {
|
foreach ($clients->get() as $client) {
|
||||||
$currencyId = $client->currency_id ?: Auth::user()->account->getCurrencyId();
|
|
||||||
|
|
||||||
foreach ($client->invoices as $invoice) {
|
foreach ($client->invoices as $invoice) {
|
||||||
|
|
||||||
|
$payments = count($invoice->payments) ? $invoice->payments : [false];
|
||||||
|
foreach ($payments as $payment) {
|
||||||
$displayData[] = [
|
$displayData[] = [
|
||||||
$isExport ? $client->getDisplayName() : $client->present()->link,
|
$isExport ? $client->getDisplayName() : $client->present()->link,
|
||||||
$isExport ? $invoice->invoice_number : $invoice->present()->link,
|
$isExport ? $invoice->invoice_number : $invoice->present()->link,
|
||||||
$invoice->present()->invoice_date,
|
$invoice->present()->invoice_date,
|
||||||
$account->formatMoney($invoice->amount, $client),
|
$account->formatMoney($invoice->amount, $client),
|
||||||
$account->formatMoney($invoice->getAmountPaid(), $client),
|
$payment ? $payment->present()->payment_date : '',
|
||||||
$account->formatMoney($invoice->balance, $client),
|
$payment ? $account->formatMoney($payment->amount, $client) : '',
|
||||||
|
$payment ? $payment->present()->method : '',
|
||||||
];
|
];
|
||||||
|
if ($payment) {
|
||||||
|
$reportTotals = $this->addToTotals($reportTotals, $client->currency_id, 'paid', $payment->amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$reportTotals = $this->addToTotals($reportTotals, $client->currency_id, 'amount', $invoice->amount);
|
$reportTotals = $this->addToTotals($reportTotals, $client->currency_id, 'amount', $invoice->amount);
|
||||||
$reportTotals = $this->addToTotals($reportTotals, $client->currency_id, 'paid', $invoice->getAmountPaid());
|
|
||||||
$reportTotals = $this->addToTotals($reportTotals, $client->currency_id, 'balance', $invoice->balance);
|
$reportTotals = $this->addToTotals($reportTotals, $client->currency_id, 'balance', $invoice->balance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user