1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Support exporting products

This commit is contained in:
Hillel Coren 2016-12-15 15:28:24 +02:00
parent 7085c0137f
commit fc87cbafe6
5 changed files with 38 additions and 0 deletions

View File

@ -12,6 +12,7 @@ use App\Models\Contact;
use App\Models\Credit;
use App\Models\Task;
use App\Models\Invoice;
use App\Models\Product;
use App\Models\Payment;
use App\Models\Expense;
use App\Models\Vendor;
@ -220,6 +221,12 @@ class ExportController extends BaseController
->get();
}
if ($request->input('include') === 'all' || $request->input('products')) {
$data['products'] = Product::scope()
->withArchived()
->get();
}
if ($request->input('include') === 'all' || $request->input('vendors')) {
$data['vendors'] = Vendor::scope()
->with('user', 'vendor_contacts', 'country')

View File

@ -4,6 +4,10 @@ use App\Libraries\Skype\HeroCard;
class ProductPresenter extends EntityPresenter
{
public function user()
{
return $this->entity->user->getDisplayName();
}
public function skypeBot($account)
{

View File

@ -81,6 +81,7 @@
@include('partials/checkbox', ['field' => 'payments'])
</div>
<div class="col-lg-3 col-sm-3">
@include('partials/checkbox', ['field' => 'products'])
@include('partials/checkbox', ['field' => 'expenses'])
@include('partials/checkbox', ['field' => 'vendors'])
@include('partials/checkbox', ['field' => 'vendor_contacts'])

View File

@ -45,6 +45,11 @@
@include('export.payments')
@endif
@if (isset($products) && $products && count($products))
<tr><td>{{ strtoupper(trans('texts.products')) }}</td></tr>
@include('export.products')
@endif
@if (isset($expenses) && $expenses && count($expenses))
<tr><td>{{ strtoupper(trans('texts.expenses')) }}</td></tr>
@include('export.expenses')

View File

@ -0,0 +1,21 @@
<tr>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans('texts.product') }}</td>
<td>{{ trans('texts.notes') }}</td>
<td>{{ trans('texts.cost') }}</td>
</tr>
@foreach ($products as $product)
<tr>
@if ($multiUser)
<td>{{ $product->present()->user }}</td>
@endif
<td>{{ $product->product_key }}</td>
<td>{{ $product->notes }}</td>
<td>{{ $product->cost }}</td>
</tr>
@endforeach
<tr><td></td></tr>