Depreciation Calculation in V6.0.4 #11342
yusuf-basith
started this conversation in
Show and tell
Replies: 2 comments
-
Do you know if this resets your modifications after an upgrade? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes. I am aware that the modifications will be overwritten after an upgrade. I remember in some of the release notes they mentioned that the depreciation part is updated. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello All,
I loved the simplistic approach of Snipe-IT.
I started using it for my organization and noticed that it did not calculate the depreciation in line with the calculation of our Finance Team.
I looked into the code to understand the way depreciations are calculated and noticed the calculations don't make much sense.
So I went ahead and modified the calculations to suit my requirement.
I have explained the edits I made and the logic below, in case anyone might need the same.
I am using the Linear Depreciation Method, the default in Snipe-IT.
The function getLinearDepeciatedValue calculates the Depreciated Value of an Asset.
It is in the file /app/Models/Depreciable.php
The first line of the function (line 71 in the file) is as follows:
$numerator= (($this->purchase_cost-($this->purchase_cost*12/($this->get_depreciation()->months))));
Here it multiplies the purchase cost by 12 and divides by the number of months in the depreciation, and then it subtracts this value from the purchase cost. This calculation doesn't make any sense to me.
Usually, the Numerator should be Purchase Cost - Floor Value after Depreciation. This is the depreciable value of the Asset.
We should calculate the depreciation per year and depreciation per month from this depreciable value only.
So I modified the line as follows:
$numerator= $this->purchase_cost-$this->get_depreciation()->depreciation_min;
After making this change, the Depreciated Value is correct for all the Assets.
There was a problem in the Depreciation Report as well.
The Monthly Depreciation in the Depreciation Report is not calculated from the above file.
It is calculated in the function transformAsset in the file /app/Http/Transformers/DepreciationReportTransformer.php
The line 66 of the file is as follows:
$monthly_depreciation = Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0));
Here the Monthly depreciation is calculated using the EOL of the Asset.
Our Finance team said that we could depreciate an asset before its EOL. Hence the Monthly Depreciation should be based on the Depreciation Months and not the EOL Months.
So I modified the line as follows:
$monthly_depreciation = Helper::formatCurrencyOutput(($asset->purchase_date != null ? (($asset->purchase_cost - $asset->get_depreciation()->depreciation_min) / $asset->get_depreciation()->months) : 0));
The Monthly Depreciation is calculated using only the Depreciable Value (Purchase Cost - Depreciation Floor Value) and not the Full Purchase Cost.
The Monthly Depreciation is shown only when the Purchase Date is filled for the Asset.
Without a Purchase Date, the Depreciated Value can't be calculated, and the Monthly Depreciation is also not estimated.
Feel free to use the above code for your needs.
As these calculations are done during the run-time, and no update is done in the database, the risk of messing things is minimal.
Beta Was this translation helpful? Give feedback.
All reactions