diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index fd5ee50c9573..6e2f43a59306 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -77,6 +77,7 @@ class ReportController extends BaseController 'profit_and_loss', 'task', 'tax_rate', + 'quote', ]; $params = [ diff --git a/app/Ninja/Reports/InvoiceReport.php b/app/Ninja/Reports/InvoiceReport.php index 908e01e96a55..e2e90a28323f 100644 --- a/app/Ninja/Reports/InvoiceReport.php +++ b/app/Ninja/Reports/InvoiceReport.php @@ -12,6 +12,7 @@ class InvoiceReport extends AbstractReport 'invoice_number', 'invoice_date', 'amount', + 'status', 'payment_date', 'paid', 'method', @@ -56,6 +57,7 @@ class InvoiceReport extends AbstractReport $this->isExport ? $invoice->invoice_number : $invoice->present()->link, $invoice->present()->invoice_date, $account->formatMoney($invoice->amount, $client), + $invoice->present()->status(), $payment ? $payment->present()->payment_date : '', $payment ? $account->formatMoney($payment->getCompletedAmount(), $client) : '', $payment ? $payment->present()->method : '', diff --git a/app/Ninja/Reports/QuoteReport.php b/app/Ninja/Reports/QuoteReport.php new file mode 100644 index 000000000000..f69679ab8ef8 --- /dev/null +++ b/app/Ninja/Reports/QuoteReport.php @@ -0,0 +1,51 @@ +account; + $status = $this->options['invoice_status']; + + $clients = Client::scope() + ->withArchived() + ->with('contacts') + ->with(['invoices' => function ($query) use ($status) { + if ($status == 'draft') { + $query->whereIsPublic(false); + } + $query->quotes() + ->withArchived() + ->where('invoice_date', '>=', $this->startDate) + ->where('invoice_date', '<=', $this->endDate) + ->with(['invoice_items']); + }]); + + foreach ($clients->get() as $client) { + foreach ($client->invoices as $invoice) { + $this->data[] = [ + $this->isExport ? $client->getDisplayName() : $client->present()->link, + $this->isExport ? $invoice->invoice_number : $invoice->present()->link, + $invoice->present()->invoice_date, + $account->formatMoney($invoice->amount, $client), + $invoice->present()->status(), + ]; + } + + $this->addToTotals($client->currency_id, 'amount', $invoice->amount); + } + } +}