mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
gets the proper amount of months and fixes typo of the word depreciation
This commit is contained in:
parent
b7bcfaccc9
commit
28059c878a
|
@ -69,14 +69,14 @@ class Depreciable extends SnipeModel
|
||||||
public function getLinearDepreciatedValue() // TODO - for testing it might be nice to have an optional $relative_to param here, defaulted to 'now'
|
public function getLinearDepreciatedValue() // TODO - for testing it might be nice to have an optional $relative_to param here, defaulted to 'now'
|
||||||
{
|
{
|
||||||
if ($this->purchase_date) {
|
if ($this->purchase_date) {
|
||||||
$months_passed = $this->purchase_date->diff(now())->m;
|
$months_passed = ($this->purchase_date->diff(now())->m)+($this->purchase_date->diff(now())->y*12);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($months_passed >= $this->get_depreciation()->months){
|
if ($months_passed >= $this->get_depreciation()->months){
|
||||||
//if there is a floor use it
|
//if there is a floor use it
|
||||||
if($this->get_depreciation()->deprecation_min->isNotEmpty()) {
|
if(!$this->get_depreciation()->depreciation_min== null) {
|
||||||
|
|
||||||
$current_value = $this->get_depreciation()->depreciation_min;
|
$current_value = $this->get_depreciation()->depreciation_min;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue