Business Functions: 

The SumOfTheYears’Digits provides another technique for calculating the depreciation of an item. Imagine that a restaurant bought a commercial refrigerator (“cold chamber”) for $18,000 and wants to estimate its depreciation after 5 years using the SumOfYears’Digits technique. Each year is assigned a number, also called a tag, using a consecutive count. This means that the first year is appended 1, the second is 2, etc. This way, the depreciation is not uniformly applied to all years. Year => 1, 2, 3, 4, and 5. The total count is made for these tags. For our refrigerator example, this would be Sum = 1 + 2 + 3 + 4 + 5 = 15 Each year is divided by this Sum, also called the sum of years, used as the common denominator: This is equivalent to 1. As you can see, the first year would have the lowest dividend (1/15 ≈ 0.0067) and the last year would have the highest (5/15 ≈ 0.33). To calculate the depreciation for each year, the fractions (1/15 + 2/15 + 3/15 + 4/15 + 5/15) are reversed so that the depreciation of the first year is calculated based on the last fraction (the last year divided by the common denominator). Then the new fraction for each year is multiplied by the original price of the asset. This would produce:
The VCL function used to calculate the depreciation of an asset using the sum of the years is called SYDDepreciation() and its syntax is: Extended __fastcall SYDDepreciation(constExtended Cost, const Extended Salvage, int Life, int Period);
The Cost parameter is the original value of the item. In our example, this would be $18,000. The Salvage parameter is the value the asset would have (or has) at the end of its useful life. The Life is the number of years of the asset would have a useful life. The Period is the particular period or rank of a Life portion; for example, if the Life of the depreciation is set to 5 (years), the Period could be any number between 1 and 5. If set to 1, the depreciation would be calculated for the first year. If the Period is set to 4, the depreciation would be calculated for the 4th year. You can also set the Period to a value higher than Life. For example, if Life is set to 5 but you pass 8 for the Period, the depreciation would be calculated for the 8th year. If the asset is worthless in the 8th year, the depreciation would be 0.

// void __fastcall TForm1::btnCalculateClick(TObject *Sender) { Extended DeprecYear1, DeprecYearN, Cost, Salvage; int Life; Cost = StrToFloat(edtCost>Text); Salvage = StrToFloat(edtSalvage>Text); Life = StrToInt(edtLife>Text); DeprecYear1 = SYDDepreciation(Cost, Salvage, Life, 1); DeprecYearN = SYDDepreciation(Cost, Salvage, Life, Life); edtYear1>Text = FloatToStrF(DeprecYear1, ffCurrency, 8, 2); edtYearN>Text = FloatToStrF(DeprecYearN, ffCurrency, 8, 2); } //
Home  Copyright © 2004 FunctionX, Inc.  