Check for valid asset

This commit is contained in:
snipe 2017-09-28 17:32:37 -07:00
parent 1775995f26
commit adac5ac544

View file

@ -41,30 +41,32 @@
$totalCost = 0; $totalCost = 0;
?> ?>
@foreach ($assetMaintenances as $assetMaintenance) @foreach ($assetMaintenances as $assetMaintenance)
<tr> @if ($assetMaintenance->asset)
<td>{{ is_null($assetMaintenance->asset->company) ? '' : $assetMaintenance->asset->company->name }}</td> <tr>
<td>{{ $assetMaintenance->asset->asset_tag }}</td> <td>{{ ($assetMaintenance->asset->company) ? $assetMaintenance->asset->company->name : '' }}</td>
<td>{{ $assetMaintenance->asset->name }}</td> <td>{{ $assetMaintenance->asset->asset_tag }}</td>
<td>{{ $assetMaintenance->supplier->name }}</td> <td>{{ $assetMaintenance->asset->name }}</td>
<td>{{ $assetMaintenance->asset_maintenance_type }}</td> <td>{{ $assetMaintenance->supplier->name }}</td>
<td>{{ $assetMaintenance->title }}</td> <td>{{ $assetMaintenance->asset_maintenance_type }}</td>
<td>{{ $assetMaintenance->start_date }}</td> <td>{{ $assetMaintenance->title }}</td>
<td>{{ is_null($assetMaintenance->completion_date) ? trans('admin/asset_maintenances/message.asset_maintenance_incomplete') : $assetMaintenance->completion_date }}</td> <td>{{ $assetMaintenance->start_date }}</td>
@if (is_null($assetMaintenance->asset_maintenance_time)) <td>{{ is_null($assetMaintenance->completion_date) ? trans('admin/asset_maintenances/message.asset_maintenance_incomplete') : $assetMaintenance->completion_date }}</td>
<?php @if (is_null($assetMaintenance->asset_maintenance_time))
$assetMaintenanceTime = intval(Carbon::now()->diffInDays(Carbon::parse($assetMaintenance->start_date))); <?php
?> $assetMaintenanceTime = intval(Carbon::now()->diffInDays(Carbon::parse($assetMaintenance->start_date)));
@else ?>
<?php @else
$assetMaintenanceTime = intval($assetMaintenance->asset_maintenance_time); <?php
?> $assetMaintenanceTime = intval($assetMaintenance->asset_maintenance_time);
@endif ?>
<td>{{ $assetMaintenanceTime }}</td> @endif
<td> <td>{{ $assetMaintenanceTime }}</td>
{{ $snipeSettings->default_currency }} <td>
{{ number_format($assetMaintenance->cost,2) }} {{ $snipeSettings->default_currency }}
</td> {{ number_format($assetMaintenance->cost,2) }}
</tr> </td>
</tr>
@endif
<?php <?php
$totalDays += $assetMaintenanceTime; $totalDays += $assetMaintenanceTime;
$totalCost += floatval($assetMaintenance->cost); $totalCost += floatval($assetMaintenance->cost);