Working on export

This commit is contained in:
Hillel Coren 2017-08-23 11:26:00 +03:00
parent 73a164be5c
commit e899be7c55
2 changed files with 34 additions and 31 deletions

View File

@ -198,7 +198,7 @@ class ExportController extends BaseController
if ($request->input('include') === 'all' || $request->input('invoices')) { if ($request->input('include') === 'all' || $request->input('invoices')) {
$data['invoices'] = Invoice::scope() $data['invoices'] = Invoice::scope()
->invoiceType(INVOICE_TYPE_STANDARD) ->invoiceType(INVOICE_TYPE_STANDARD)
->with('user', 'client.contacts', 'invoice_status') ->with('user', 'client.contacts', 'invoice_status', 'invoice_items')
->withArchived() ->withArchived()
->where('is_recurring', '=', false) ->where('is_recurring', '=', false)
->get(); ->get();
@ -207,7 +207,7 @@ class ExportController extends BaseController
if ($request->input('include') === 'all' || $request->input('quotes')) { if ($request->input('include') === 'all' || $request->input('quotes')) {
$data['quotes'] = Invoice::scope() $data['quotes'] = Invoice::scope()
->invoiceType(INVOICE_TYPE_QUOTE) ->invoiceType(INVOICE_TYPE_QUOTE)
->with('user', 'client.contacts', 'invoice_status') ->with('user', 'client.contacts', 'invoice_status', 'invoice_items')
->withArchived() ->withArchived()
->where('is_recurring', '=', false) ->where('is_recurring', '=', false)
->get(); ->get();
@ -216,7 +216,7 @@ class ExportController extends BaseController
if ($request->input('include') === 'all' || $request->input('recurring')) { if ($request->input('include') === 'all' || $request->input('recurring')) {
$data['recurringInvoices'] = Invoice::scope() $data['recurringInvoices'] = Invoice::scope()
->invoiceType(INVOICE_TYPE_STANDARD) ->invoiceType(INVOICE_TYPE_STANDARD)
->with('user', 'client.contacts', 'invoice_status', 'frequency') ->with('user', 'client.contacts', 'invoice_status', 'frequency', 'invoice_items')
->withArchived() ->withArchived()
->where('is_recurring', '=', true) ->where('is_recurring', '=', true)
->get(); ->get();

View File

@ -25,37 +25,40 @@
@if ($account->custom_invoice_text_label2) @if ($account->custom_invoice_text_label2)
<td>{{ $account->custom_invoice_text_label2 }}</td> <td>{{ $account->custom_invoice_text_label2 }}</td>
@endif @endif
<td>{{ trans('texts.product') }}</td>
</tr> </tr>
@foreach ($invoices as $invoice) @foreach ($invoices as $invoice)
@if (!$invoice->client->is_deleted) @if (!$invoice->client->is_deleted)
<tr> @foreach ($invoice->invoice_items as $item)
<td>{{ $invoice->present()->client }}</td> <tr>
<td>{{ $invoice->present()->email }}</td> <td>{{ $invoice->present()->client }}</td>
@if ($multiUser) <td>{{ $invoice->present()->email }}</td>
<td>{{ $invoice->present()->user }}</td> @if ($multiUser)
@endif <td>{{ $invoice->present()->user }}</td>
<td>{{ $invoice->invoice_number }}</td> @endif
<td>{{ $account->formatMoney($invoice->amount, $invoice->client) }}</td> <td>{{ $invoice->invoice_number }}</td>
<td>{{ $account->formatMoney($invoice->amount - $invoice->balance, $invoice->client) }}</td> <td>{{ $account->formatMoney($invoice->amount, $invoice->client) }}</td>
<td>{{ $invoice->po_number }}</td> <td>{{ $account->formatMoney($invoice->amount - $invoice->balance, $invoice->client) }}</td>
<td>{{ $invoice->present()->status }}</td> <td>{{ $invoice->po_number }}</td>
<td>{{ $invoice->present()->invoice_date }}</td> <td>{{ $invoice->present()->status }}</td>
<td>{{ $invoice->present()->due_date }}</td> <td>{{ $invoice->present()->invoice_date }}</td>
<td>{{ $invoice->public_notes }}</td> <td>{{ $invoice->present()->due_date }}</td>
<td>{{ $invoice->private_notes }}</td> <td>{{ $invoice->public_notes }}</td>
@if ($account->custom_invoice_label1) <td>{{ $invoice->private_notes }}</td>
<td>{{ $invoice->custom_value1 }}</td> @if ($account->custom_invoice_label1)
@endif <td>{{ $invoice->custom_value1 }}</td>
@if ($account->custom_invoice_label2) @endif
<td>{{ $invoice->custom_value2 }}</td> @if ($account->custom_invoice_label2)
@endif <td>{{ $invoice->custom_value2 }}</td>
@if ($account->custom_invoice_label1) @endif
<td>{{ $invoice->custom_text_value1 }}</td> @if ($account->custom_invoice_label1)
@endif <td>{{ $invoice->custom_text_value1 }}</td>
@if ($account->custom_invoice_label2) @endif
<td>{{ $invoice->custom_text_value2 }}</td> @if ($account->custom_invoice_label2)
@endif <td>{{ $invoice->custom_text_value2 }}</td>
</tr> @endif
</tr>
@endforeach
@endif @endif
@endforeach @endforeach