From e899be7c55d7a9e1b8eccd6cc9edba45995f79c9 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 23 Aug 2017 11:26:00 +0300 Subject: [PATCH] Working on export --- app/Http/Controllers/ExportController.php | 6 +-- resources/views/export/invoices.blade.php | 59 ++++++++++++----------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 046682cc7ee2..65cccabfcfc6 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -198,7 +198,7 @@ class ExportController extends BaseController if ($request->input('include') === 'all' || $request->input('invoices')) { $data['invoices'] = Invoice::scope() ->invoiceType(INVOICE_TYPE_STANDARD) - ->with('user', 'client.contacts', 'invoice_status') + ->with('user', 'client.contacts', 'invoice_status', 'invoice_items') ->withArchived() ->where('is_recurring', '=', false) ->get(); @@ -207,7 +207,7 @@ class ExportController extends BaseController if ($request->input('include') === 'all' || $request->input('quotes')) { $data['quotes'] = Invoice::scope() ->invoiceType(INVOICE_TYPE_QUOTE) - ->with('user', 'client.contacts', 'invoice_status') + ->with('user', 'client.contacts', 'invoice_status', 'invoice_items') ->withArchived() ->where('is_recurring', '=', false) ->get(); @@ -216,7 +216,7 @@ class ExportController extends BaseController if ($request->input('include') === 'all' || $request->input('recurring')) { $data['recurringInvoices'] = Invoice::scope() ->invoiceType(INVOICE_TYPE_STANDARD) - ->with('user', 'client.contacts', 'invoice_status', 'frequency') + ->with('user', 'client.contacts', 'invoice_status', 'frequency', 'invoice_items') ->withArchived() ->where('is_recurring', '=', true) ->get(); diff --git a/resources/views/export/invoices.blade.php b/resources/views/export/invoices.blade.php index fb995727539d..0f3436629669 100644 --- a/resources/views/export/invoices.blade.php +++ b/resources/views/export/invoices.blade.php @@ -25,37 +25,40 @@ @if ($account->custom_invoice_text_label2) {{ $account->custom_invoice_text_label2 }} @endif + {{ trans('texts.product') }} @foreach ($invoices as $invoice) @if (!$invoice->client->is_deleted) - - {{ $invoice->present()->client }} - {{ $invoice->present()->email }} - @if ($multiUser) - {{ $invoice->present()->user }} - @endif - {{ $invoice->invoice_number }} - {{ $account->formatMoney($invoice->amount, $invoice->client) }} - {{ $account->formatMoney($invoice->amount - $invoice->balance, $invoice->client) }} - {{ $invoice->po_number }} - {{ $invoice->present()->status }} - {{ $invoice->present()->invoice_date }} - {{ $invoice->present()->due_date }} - {{ $invoice->public_notes }} - {{ $invoice->private_notes }} - @if ($account->custom_invoice_label1) - {{ $invoice->custom_value1 }} - @endif - @if ($account->custom_invoice_label2) - {{ $invoice->custom_value2 }} - @endif - @if ($account->custom_invoice_label1) - {{ $invoice->custom_text_value1 }} - @endif - @if ($account->custom_invoice_label2) - {{ $invoice->custom_text_value2 }} - @endif - + @foreach ($invoice->invoice_items as $item) + + {{ $invoice->present()->client }} + {{ $invoice->present()->email }} + @if ($multiUser) + {{ $invoice->present()->user }} + @endif + {{ $invoice->invoice_number }} + {{ $account->formatMoney($invoice->amount, $invoice->client) }} + {{ $account->formatMoney($invoice->amount - $invoice->balance, $invoice->client) }} + {{ $invoice->po_number }} + {{ $invoice->present()->status }} + {{ $invoice->present()->invoice_date }} + {{ $invoice->present()->due_date }} + {{ $invoice->public_notes }} + {{ $invoice->private_notes }} + @if ($account->custom_invoice_label1) + {{ $invoice->custom_value1 }} + @endif + @if ($account->custom_invoice_label2) + {{ $invoice->custom_value2 }} + @endif + @if ($account->custom_invoice_label1) + {{ $invoice->custom_text_value1 }} + @endif + @if ($account->custom_invoice_label2) + {{ $invoice->custom_text_value2 }} + @endif + + @endforeach @endif @endforeach