mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #10115 from snipe/features/added_footer_to_depreciation_report_totals
Added totals to depreciation report footer
This commit is contained in:
commit
104d66b4b1
|
@ -54,7 +54,7 @@ class DepreciationReportTransformer
|
|||
* for the other calculations that come after, like diff, etc.
|
||||
*/
|
||||
if ($asset->purchase_cost!='') {
|
||||
$purchase_cost = $purchase_cost_currency . ' ' . \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost);
|
||||
$purchase_cost = $asset->purchase_cost;
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,9 +62,9 @@ class DepreciationReportTransformer
|
|||
* Override the previously set null values if there is a valid model and associated depreciation
|
||||
*/
|
||||
if (($asset->model) && ($asset->model->depreciation)) {
|
||||
$depreciated_value = $purchase_cost_currency . ' ' . \App\Helpers\Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
||||
$monthly_depreciation = $purchase_cost_currency . ' ' .\App\Helpers\Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0));
|
||||
$diff = $purchase_cost_currency . ' ' .\App\Helpers\Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
||||
$depreciated_value = \App\Helpers\Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
||||
$monthly_depreciation = \App\Helpers\Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0));
|
||||
$diff = \App\Helpers\Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
||||
}
|
||||
|
||||
if ($asset->assigned) {
|
||||
|
@ -93,12 +93,13 @@ class DepreciationReportTransformer
|
|||
'order_number' => ($asset->order_number) ? e($asset->order_number) : null,
|
||||
'location' => ($asset->location) ? e($asset->location->name) : null,
|
||||
'warranty_expires' => ($asset->warranty_months > 0) ? Helper::getFormattedDateObject($asset->warranty_expires, 'date') : null,
|
||||
'currency' => $purchase_cost_currency,
|
||||
'purchase_date' => Helper::getFormattedDateObject($asset->purchase_date, 'date'),
|
||||
'purchase_cost' => $purchase_cost,
|
||||
'book_value' => $depreciated_value,
|
||||
'purchase_cost' => Helper::formatCurrencyOutput($asset->purchase_cost),
|
||||
'book_value' => Helper::formatCurrencyOutput($depreciated_value),
|
||||
'monthly_depreciation' => $monthly_depreciation,
|
||||
'checked_out_to' => $checkout_target,
|
||||
'diff' => $diff,
|
||||
'diff' => Helper::formatCurrencyOutput($diff),
|
||||
'number_of_months' => ($asset->model && $asset->model->depreciation) ? e($asset->model->depreciation->months) : null,
|
||||
'depreciation' => (($asset->model) && ($asset->model->depreciation)) ? e($asset->model->depreciation->name) : null,
|
||||
|
||||
|
|
|
@ -115,6 +115,12 @@ class DepreciationReportPresenter extends Presenter
|
|||
"visible" => true,
|
||||
"title" => trans('general.purchase_date'),
|
||||
"formatter" => "dateDisplayFormatter"
|
||||
], [
|
||||
"field" => "currency",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"visible" => false,
|
||||
"title" => 'Currency',
|
||||
], [
|
||||
"field" => "purchase_cost",
|
||||
"searchable" => true,
|
||||
|
@ -140,7 +146,8 @@ class DepreciationReportPresenter extends Presenter
|
|||
"searchable" => true,
|
||||
"sortable" => true,
|
||||
"visible" => true,
|
||||
"title" => trans('admin/hardware/table.book_value')
|
||||
"title" => trans('admin/hardware/table.book_value'),
|
||||
"footerFormatter" => 'sumFormatter',
|
||||
], [
|
||||
"field" => "monthly_depreciation",
|
||||
"searchable" => true,
|
||||
|
@ -152,7 +159,8 @@ class DepreciationReportPresenter extends Presenter
|
|||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"visible" => true,
|
||||
"title" => trans('admin/hardware/table.diff')
|
||||
"title" => trans('admin/hardware/table.diff'),
|
||||
"footerFormatter" => 'sumFormatter',
|
||||
],[
|
||||
"field" => "warranty_expires",
|
||||
"searchable" => false,
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
data-show-refresh="true"
|
||||
data-sort-order="desc"
|
||||
data-sort-name="created_at"
|
||||
data-show-footer="true"
|
||||
id="depreciationReport"
|
||||
data-url="{{ route('api.depreciation-report.index') }}"
|
||||
data-mobile-responsive="true"
|
||||
|
|
Loading…
Reference in a new issue