mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Merge pull request #12880 from Godmartinz/asset_total_cost
Added component costs to asset view
This commit is contained in:
commit
4a643c1252
|
@ -909,7 +909,13 @@ class Asset extends Depreciable
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public function getComponentCost(){
|
||||||
|
$cost = 0;
|
||||||
|
foreach($this->components as $component) {
|
||||||
|
$cost += $component->pivot->assigned_qty*$component->purchase_cost;
|
||||||
|
}
|
||||||
|
return $cost;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* -----------------------------------------------
|
* -----------------------------------------------
|
||||||
|
|
|
@ -8,6 +8,7 @@ return [
|
||||||
'change' => 'In/Out',
|
'change' => 'In/Out',
|
||||||
'checkout_date' => 'Checkout Date',
|
'checkout_date' => 'Checkout Date',
|
||||||
'checkoutto' => 'Checked Out',
|
'checkoutto' => 'Checked Out',
|
||||||
|
'components_cost' => 'Total Components Cost',
|
||||||
'current_value' => 'Current Value',
|
'current_value' => 'Current Value',
|
||||||
'diff' => 'Diff',
|
'diff' => 'Diff',
|
||||||
'dl_csv' => 'Download CSV',
|
'dl_csv' => 'Download CSV',
|
||||||
|
|
|
@ -530,6 +530,25 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
@if(($asset->components->count() > 0) && ($asset->purchase_cost))
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<strong>
|
||||||
|
{{ trans('admin/hardware/table.components_cost') }}
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
@if (($asset->id) && ($asset->location))
|
||||||
|
{{ $asset->location->currency }}
|
||||||
|
@elseif (($asset->id) && ($asset->location))
|
||||||
|
{{ $asset->location->currency }}
|
||||||
|
@else
|
||||||
|
{{ $snipeSettings->default_currency }}
|
||||||
|
@endif
|
||||||
|
{{Helper::formatCurrencyOutput($asset->getComponentCost())}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
@if (($asset->model) && ($asset->depreciation) && ($asset->purchase_date))
|
@if (($asset->model) && ($asset->depreciation) && ($asset->purchase_date))
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
|
|
Loading…
Reference in a new issue