mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-19 12:04:21 -08:00
Integrate half-year convention inside working output
This commit is contained in:
parent
8d3b201a49
commit
7b70afa2a1
|
@ -41,6 +41,30 @@ class Depreciable extends SnipeModel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getDepreciatedValue()
|
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 happen
|
if (!$this->get_depreciation()) { // will never happen
|
||||||
return $this->purchase_cost;
|
return $this->purchase_cost;
|
||||||
|
|
Loading…
Reference in a new issue