Skip to content

Commit

Permalink
Try to improve straight-line depreciation accuracy by using six decim…
Browse files Browse the repository at this point in the history
…al places internally
  • Loading branch information
ghacupha committed Aug 23, 2023
1 parent 83d3866 commit 71b7dfa
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 4 deletions.
58 changes: 58 additions & 0 deletions man-pages/Depreciation-Algorithms-UAT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

---

## Depreciation Algorithms and UAT Process

### Depreciation Algorithms Implementation

#### Straight-Line Depreciation Algorithm

The Erp System supports the straight-line depreciation algorithm, where the depreciation amount remains constant throughout an asset's useful life. This algorithm is calculated by dividing the initial cost of the asset by its useful life in periods.

1. **Configuration:** Sample asset-registration records are created with associated service outlets and asset categories. The asset categories are configured with depreciation rates in basis points, representing the yearly depreciation rate.

2. **Depreciation Period:** A depreciation period object is created, representing the period for which the depreciation calculation is performed. The Erp System supports various granularities, but for simplicity, we use a monthly period.

3. **Depreciation Job:** A depreciation job instance is created, triggered by the user or an automated process. This job initiates the depreciation sequence for the specified period.

4. **Depreciation Sequence:** The system iterates through asset-registration records, calculating and recording depreciation entries using the straight-line algorithm. The depreciation amount is determined by dividing the initial cost by the useful life, and the results are stored as depreciation entry instances.

#### Reducing Balance Depreciation Algorithm

The Erp System also implements the reducing balance depreciation algorithm, where depreciation is calculated based on the asset's current value and a fixed depreciation rate. This algorithm is often used for assets that experience higher depreciation in the initial periods.

1. **Configuration:** Similar to straight-line, asset-registration records are configured with service outlets and asset categories containing depreciation rates in basis points.

2. **Depreciation Period:** Similar to straight-line, the depreciation period object is created to specify the time frame for depreciation calculation.

3. **Depreciation Job:** As with straight-line, a depreciation job instance is created to initiate the depreciation sequence.

4. **Depreciation Sequence:** The system processes asset-registration records, calculating and recording depreciation entries using the reducing balance algorithm. The depreciation amount is determined by multiplying the asset's current value by the fixed depreciation rate.

### UAT for Depreciation Results

#### Validation of Depreciation Results

1. **Manual Calculation:** Before UAT, manual calculations are performed using the same depreciation algorithms and data used in the Erp System. These calculations are done in spreadsheets to simulate the expected depreciation amounts.

2. **Depreciation Sequence:** During UAT, the Erp System runs the depreciation sequence for the defined period using both the straight-line and reducing balance algorithms.

3. **Comparison:** The calculated depreciation amounts from the Erp System are compared with the manually calculated amounts. Deviations are documented and analyzed.

#### UAT Workflow

1. **Test Planning:** UAT test cases are defined, outlining scenarios for both straight-line and reducing balance depreciation.

2. **Test Execution:** Testers execute the UAT test cases, triggering the depreciation sequence and verifying the calculated amounts against the manual calculations.

3. **Deviation Analysis:** Any deviations between Erp System calculations and manual calculations are documented. Factors causing discrepancies are investigated.

4. **Feedback and Resolution:** Developers address any identified discrepancies and re-run the tests.

5. **Validation:** Once the UAT results align closely with manual calculations, testers approve the system's accuracy in calculating depreciation amounts.

### Conclusion

The Erp System's implementation of depreciation algorithms, combined with a thorough UAT process, ensures accurate and reliable depreciation calculations. By configuring asset categories with basis point depreciation rates and performing UAT against manual calculations, the system's ability to produce accurate results is rigorously verified.

---
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public BigDecimal calculateDepreciation(AssetRegistrationDTO asset, Depreciation

BigDecimal depreciationAmount = calculateTotalDepreciation(monthlyDepreciation, elapsedMonths);

return depreciationAmount.min(netBookValueBeforeDepreciation);
return depreciationAmount.min(netBookValueBeforeDepreciation).setScale(MONEY_SCALE, ROUNDING_MODE);
}

private BigDecimal calculateDepreciationRate(AssetCategoryDTO assetCategory) {
Expand All @@ -74,19 +74,20 @@ private BigDecimal calculateDepreciationRate(AssetCategoryDTO assetCategory) {
}
return assetCategory.getDepreciationRateYearly()
.divide(TEN_THOUSAND, DECIMAL_SCALE, ROUNDING_MODE)
.divide(MONTHS_IN_YEAR, DECIMAL_SCALE, ROUNDING_MODE);
.divide(MONTHS_IN_YEAR, DECIMAL_SCALE, ROUNDING_MODE)
.setScale(DECIMAL_SCALE, ROUNDING_MODE);
}

private BigDecimal calculateNetBookValueBeforeDepreciation(BigDecimal assetCost, BigDecimal depreciationRate, long priorMonths) {
return assetCost.subtract(assetCost.multiply(depreciationRate).multiply(BigDecimal.valueOf(priorMonths)).setScale(MONEY_SCALE, ROUNDING_MODE));
return assetCost.subtract(assetCost.multiply(depreciationRate).multiply(BigDecimal.valueOf(priorMonths)).setScale(DECIMAL_SCALE, ROUNDING_MODE));
}

private BigDecimal calculateMonthlyDepreciation(BigDecimal assetCost, BigDecimal depreciationRate) {
return assetCost.multiply(depreciationRate).setScale(DECIMAL_SCALE, ROUNDING_MODE);
}

private BigDecimal calculateTotalDepreciation(BigDecimal monthlyDepreciation, long elapsedMonths) {
return monthlyDepreciation.multiply(BigDecimal.valueOf(elapsedMonths)).setScale(MONEY_SCALE, ROUNDING_MODE);
return monthlyDepreciation.multiply(BigDecimal.valueOf(elapsedMonths)).setScale(DECIMAL_SCALE, ROUNDING_MODE);
}
}

Expand Down

0 comments on commit 71b7dfa

Please sign in to comment.