Add checkout date to asset report

This commit is contained in:
snipe 2016-09-27 08:42:48 -07:00
parent 2a8ab06ca3
commit fa72e64b98
2 changed files with 12 additions and 0 deletions

View file

@ -133,6 +133,7 @@ class ReportsController extends Controller
Asset::with('assigneduser', 'assetloc','defaultLoc','assigneduser.userloc','model','supplier','assetstatus','model.manufacturer')->orderBy('created_at', 'DESC')->chunk(500, function($assets) use($handle) {
fputcsv($handle, [
trans('general.company'),
trans('admin/hardware/table.asset_tag'),
trans('admin/hardware/form.manufacturer'),
trans('admin/hardware/form.model'),
@ -145,6 +146,7 @@ class ReportsController extends Controller
trans('admin/hardware/form.order'),
trans('admin/hardware/form.supplier'),
trans('admin/hardware/table.checkoutto'),
trans('admin/hardware/table.checkout_date'),
trans('admin/hardware/table.location'),
trans('general.notes'),
]);
@ -152,6 +154,7 @@ class ReportsController extends Controller
foreach ($assets as $asset) {
// Add a new row with data
fputcsv($handle, [
($asset->company) ? $asset->company->name : '',
$asset->asset_tag,
($asset->model->manufacturer) ? $asset->model->manufacturer->name : '',
($asset->model) ? $asset->model->name : '',
@ -164,6 +167,7 @@ class ReportsController extends Controller
($asset->order_number) ? e($asset->order_number) : '',
($asset->supplier) ? e($asset->supplier->name) : '',
($asset->assigneduser) ? e($asset->assigneduser->fullName()) : '',
($asset->last_checkout!='') ? e($asset->last_checkout) : '',
($asset->assigneduser && $asset->assigneduser->userloc!='') ?
e($asset->assigneduser->userloc->name) : ( ($asset->defaultLoc!='') ? e($asset->defaultLoc->name) : ''),
($asset->notes) ? e($asset->notes) : '',

View file

@ -47,6 +47,7 @@
<th class="col-sm-1">{{ trans('admin/hardware/form.order') }}</th>
<th class="col-sm-1">{{ trans('admin/hardware/form.supplier') }}</th>
<th class="col-sm-1">{{ trans('admin/hardware/table.checkoutto') }}</th>
<th class="col-sm-1">{{ trans('admin/hardware/table.checkout_date') }}</th>
<th class="col-sm-1">{{ trans('admin/hardware/table.location') }}</th>
</tr>
</thead>
@ -98,6 +99,13 @@
@endif
</td>
<td>
@if (($asset->assigneduser) && ($asset->last_checkout!=''))
{{ $asset->last_checkout }}
@endif
</td>
<td>
@if (($asset->assigneduser) && ($asset->assigneduser->userLoc))
{{ $asset->assigneduser->userLoc->name }}