Merge quote report fix

This commit is contained in:
Hillel Coren 2018-01-24 10:00:27 +02:00
parent 3dec3f07bf
commit 074adf4094

View File

@ -19,19 +19,17 @@ class QuoteReport extends AbstractReport
public function run() public function run()
{ {
$account = Auth::user()->account; $account = Auth::user()->account;
$status = $this->options['invoice_status']; $statusIds = $this->options['status_ids'];
$exportFormat = $this->options['export_format']; $exportFormat = $this->options['export_format'];
$clients = Client::scope() $clients = Client::scope()
->orderBy('name') ->orderBy('name')
->withArchived() ->withArchived()
->with('contacts') ->with('contacts')
->with(['invoices' => function ($query) use ($status) { ->with(['invoices' => function ($query) use ($statusIds) {
if ($status == 'draft') {
$query->whereIsPublic(false);
}
$query->quotes() $query->quotes()
->withArchived() ->withArchived()
->statusIds($statusIds)
->where('invoice_date', '>=', $this->startDate) ->where('invoice_date', '>=', $this->startDate)
->where('invoice_date', '<=', $this->endDate) ->where('invoice_date', '<=', $this->endDate)
->with(['invoice_items']); ->with(['invoice_items']);