A free open source IT asset/license management system
Integrate half-year convention inside working output
Minaev Dmitriy7b70afa2a14d
diff --git a/app/Models/Depreciable.php b/app/Models/Depreciable.phpindex b26215bc8f..9a4fe68b5e 100644--- a/app/Models/Depreciable.php+++ b/app/Models/Depreciable.php@@ -41,6 +41,30 @@ class Depreciable extends SnipeModel*/public function getDepreciatedValue()+ {+ $depreciation = 0;+ $setting = Setting::first();+ switch($setting->depreciation_method) {+ case 'defalut':+ $depreciation = $this->getLinearDepreciatedValue();+ break;++ case 'half_1':+ $depreciation = $this->getHalfYearDepreciatedValue(true);+ break;++ case 'half_2':+ $depreciation = $this->getHalfYearDepreciatedValue(false);+ break;+ }+ return $depreciation;+ }++ /**+ * @return float|int+ */++ public function getLinearDepreciatedValue(){if (!$this->get_depreciation()) { // will never happenreturn $this->purchase_cost;