mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added quote report
This commit is contained in:
parent
36c9104cbf
commit
76c1b0efac
@ -77,6 +77,7 @@ class ReportController extends BaseController
|
|||||||
'profit_and_loss',
|
'profit_and_loss',
|
||||||
'task',
|
'task',
|
||||||
'tax_rate',
|
'tax_rate',
|
||||||
|
'quote',
|
||||||
];
|
];
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
|
@ -12,6 +12,7 @@ class InvoiceReport extends AbstractReport
|
|||||||
'invoice_number',
|
'invoice_number',
|
||||||
'invoice_date',
|
'invoice_date',
|
||||||
'amount',
|
'amount',
|
||||||
|
'status',
|
||||||
'payment_date',
|
'payment_date',
|
||||||
'paid',
|
'paid',
|
||||||
'method',
|
'method',
|
||||||
@ -56,6 +57,7 @@ class InvoiceReport extends AbstractReport
|
|||||||
$this->isExport ? $invoice->invoice_number : $invoice->present()->link,
|
$this->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),
|
||||||
|
$invoice->present()->status(),
|
||||||
$payment ? $payment->present()->payment_date : '',
|
$payment ? $payment->present()->payment_date : '',
|
||||||
$payment ? $account->formatMoney($payment->getCompletedAmount(), $client) : '',
|
$payment ? $account->formatMoney($payment->getCompletedAmount(), $client) : '',
|
||||||
$payment ? $payment->present()->method : '',
|
$payment ? $payment->present()->method : '',
|
||||||
|
51
app/Ninja/Reports/QuoteReport.php
Normal file
51
app/Ninja/Reports/QuoteReport.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Ninja\Reports;
|
||||||
|
|
||||||
|
use App\Models\Client;
|
||||||
|
use Auth;
|
||||||
|
|
||||||
|
class QuoteReport extends AbstractReport
|
||||||
|
{
|
||||||
|
public $columns = [
|
||||||
|
'client',
|
||||||
|
'quote_number',
|
||||||
|
'quote_date',
|
||||||
|
'amount',
|
||||||
|
'status',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$account = Auth::user()->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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user