Calculation of depreciation is 5 years in the past date whereas it is supposed to be 5 years in the future date.

Steps to Reproduce

Here's an example:
If the Depreciation Effective Date is 01/09/2020, the ending date for depreciation would be 01/09/2025.
At that time, there will have been 2 leap years. Thus, the number of days between 1/9/2020-1/9/2025 is 1827 days.

Current script is looking backward and determining the number of days between today and 5 years ago.
So, it is looking at 1/10/2015-1/10/2020 which is 1826 days.

This would throw off the calculation of the daily amount of depreciation.
If the Cost = $1200 and Salvage=0, the daily calcs using today as date to calculate depreciation:
Your script: (1200/1826) * 366 = 240.53 (daily amount is .65717415)
Using future days: (1200/1827) * 366 = 240.39 (daily amount is .65681444)


The function '_getSLDepreciation' in 'DepreciationCalculations' script include need to be changed to the below:

_getSLDepreciation: function(offset, value, salvage, dep_date) {
var netbook = (value-salvage);
var dep_end = new GlideDateTime(dep_date).getDate();
var now = new GlideDateTime().getDate();
var depreciation = (netbook / this._daysBetween(dep_date, dep_end)) * this._daysBetween(dep_date, now);
if (depreciation > netbook)
return netbook;
return depreciation;

Related Problem: PRB1385953

Seen In

There is no data to report.

Fixed In


Associated Community Threads

There is no data to report.

Article Information

Last Updated:2020-10-06 00:21:52