mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
WIP formula for linear Depreciation has been corrected. still one variable left to fix.
This commit is contained in:
parent
de6f922e54
commit
cdc402fa04
|
@ -68,9 +68,15 @@ class Depreciable extends SnipeModel
|
|||
*/
|
||||
public function getLinearDepreciatedValue()
|
||||
{
|
||||
// fraction of value left
|
||||
$numerator= (($this->purchase_cost-($this->purchase_cost*12/($this->get_depreciation()->months))));
|
||||
$denominator=$this->get_depreciation()->months/12;
|
||||
$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
|
||||
$current_value = round(($months_remaining / $this->get_depreciation()->months) * $this->purchase_cost, 2);
|
||||
// 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;
|
||||
|
||||
if($this->get_depreciation()->depreciation_min > $current_value) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue