From e6e68934f73c07e73c34060f3381b29cc6ee5f31 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 14 Feb 2022 09:13:14 -0800 Subject: [PATCH] adds a months depreciated variable --- app/Models/Depreciable.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Models/Depreciable.php b/app/Models/Depreciable.php index 41699ad09c..181be0ef4f 100644 --- a/app/Models/Depreciable.php +++ b/app/Models/Depreciable.php @@ -73,10 +73,9 @@ class Depreciable extends SnipeModel $deprecation_per_year= $numerator/$denominator; $deprecation_per_month= $deprecation_per_year/12; -// fraction of value left $months_remaining = $this->time_until_depreciated()->m + 12 * $this->time_until_depreciated()->y; //UGlY -// formula for current value is correct now. $months_remaining is not giving me the same value as expected. Considering how to fix this. -Godfrey M. - $current_value = $deprecation_per_month*27; + $months_depreciated=$this->get_depreciation()->months-$months_remaining; + $current_value = $deprecation_per_month*$months_depreciated; if($this->get_depreciation()->depreciation_min > $current_value) {