A free open source IT asset/license management system
Added totals to depreciation report footer
snipeb4a90045e659
diff --git a/app/Http/Transformers/DepreciationReportTransformer.php b/app/Http/Transformers/DepreciationReportTransformer.phpindex dfa5adc985..73c970504b 100644--- a/app/Http/Transformers/DepreciationReportTransformer.php+++ b/app/Http/Transformers/DepreciationReportTransformer.php@@ -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,diff --git a/app/Presenters/DepreciationReportPresenter.php b/app/Presenters/DepreciationReportPresenter.phpindex d271220b8d..12b42f796e 100644--- a/app/Presenters/DepreciationReportPresenter.php+++ b/app/Presenters/DepreciationReportPresenter.php@@ -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,diff --git a/resources/views/reports/depreciation.blade.php b/resources/views/reports/depreciation.blade.phpindex c1449ce139..5ccf8354a8 100644--- a/resources/views/reports/depreciation.blade.php+++ b/resources/views/reports/depreciation.blade.php@@ -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"