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')) {
$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();

View File

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