From b7ad80bd319ad787990aee24dbcbb50bb175fa21 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 1 Oct 2024 11:24:24 -0700 Subject: [PATCH] fix monthly depreciation value --- app/Http/Transformers/DepreciationReportTransformer.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Http/Transformers/DepreciationReportTransformer.php b/app/Http/Transformers/DepreciationReportTransformer.php index 510083db4c..a64c15d721 100644 --- a/app/Http/Transformers/DepreciationReportTransformer.php +++ b/app/Http/Transformers/DepreciationReportTransformer.php @@ -64,14 +64,13 @@ class DepreciationReportTransformer if (($asset->model) && ($asset->model->depreciation)) { $depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue()); if($asset->model->eol===0 || $asset->model->eol===null ){ - $monthly_depreciation = Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months); - } - else { - $monthly_depreciation = Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0)); + $monthly_depreciation =Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months); } $diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue())); } - + else { + $monthly_depreciation = Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0)); + } if ($asset->assigned) { $checkout_target = $asset->assigned->name;