From 8725d40f8d21c9f65d3161498eb7ad88c3b7b494 Mon Sep 17 00:00:00 2001 From: akemidx Date: Thu, 22 Jun 2023 17:00:42 -0400 Subject: [PATCH] current value added to asset index page. translations for this in reports --- app/Http/Controllers/ReportsController.php | 22 ++++++++++----------- app/Http/Transformers/AssetsTransformer.php | 1 + app/Presenters/AssetPresenter.php | 7 +++++++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 80fe24255c..e3fc761bcc 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -501,7 +501,6 @@ class ReportsController extends Controller $header[] = trans('general.zip'); } - if ($request->filled('assigned_to')) { $header[] = trans('admin/hardware/table.checkoutto'); $header[] = trans('general.type'); @@ -531,16 +530,6 @@ class ReportsController extends Controller $header[] = trans('general.status'); } - if ($request->filled('warranty')) { - $header[] = 'Warranty'; - $header[] = 'Warranty Expires'; - } - if ($request->filled('depreciation')) { - $header[] = 'Value'; - $header[] = 'Diff'; - $header[] = 'Fully Depreciated'; - } - if ($request->filled('checkout_date')) { $header[] = trans('admin/hardware/table.checkout_date'); } @@ -549,6 +538,17 @@ class ReportsController extends Controller $header[] = trans('admin/hardware/form.expected_checkin'); } + if ($request->filled('depreciation')) { + $header[] = trans('admin/hardware/table.book_value'); + $header[] = trans('admin/hardware/table.diff'); + $header[] = trans('admin/hardware/form.fully_depreciated'); + } + + if ($request->filled('warranty')) { + $header[] = trans('admin/hardware/form.warranty'); + $header[] = trans('admin/hardware/form.warranty_expires'); + } + if ($request->filled('created_at')) { $header[] = trans('general.created_at'); } diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index d431ec890d..e03e63973b 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -92,6 +92,7 @@ class AssetsTransformer 'checkout_counter' => (int) $asset->checkout_counter, 'requests_counter' => (int) $asset->requests_counter, 'user_can_checkout' => (bool) $asset->availableForCheckout(), + 'book_value' => Helper::formatCurrencyOutput($asset->getLinearDepreciatedValue()), ]; diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index ce476d082c..46019e7e27 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -154,6 +154,13 @@ class AssetPresenter extends Presenter 'footerFormatter' => 'sumFormatter', 'class' => 'text-right', ], [ + "field" => "book_value", + "searchable" => true, + "sortable" => true, + "title" => trans('admin/hardware/table.book_value'), + "footerFormatter" => 'sumFormatter', + "class" => "text-right", + ],[ 'field' => 'order_number', 'searchable' => true, 'sortable' => true,