Fixed Asset Management Apex API Developer Reference

fam.DepreciationScheduleRoundingService

global with sharing class DepreciationScheduleRoundingService

This class is used to round a generated depreciation schedule. This class is marked as global and is available for use with custom Depreciation Method Calculation classes.

Methods

round

global static void round(List<fam__FA_Depreciation_Schedule__c> depreciationSchedules, Decimal expectedTotalAmount)

This method rounds the depreciation amounts of the list of depreciation schedules to two decimal places and then corrects rounding errors by adding the difference of the total rounded values and the total expected amount to the depreciation amount of the final depreciation schedule. This method does not interact with the database at any stage. This method expects the caller to query the objects and to update the resulting objects after it finishes executing. The required fields are:

- FA_Depreciation_Schedule__c.Effective_Depreciation_Date__c
- FA_Depreciation_Schedule__c.Depreciation_Amount__c

Input Parameters

Name Type Description
depreciationSchedules List<fam__FA_Depreciation_Schedule__c> The depreciation schedules to be rounded and totalled. The depreciation amounts are edited in the objects provided.
expectedTotalAmount Decimal The expected total amount of the depreciation schedules. This is used to correct rounding errors that occur when the individual depreciation amounts are rounded.

Exceptions Thrown

Value Description
FixedAssetException A fixed asset exception can be thrown by this method if any of the following are true:
- The provided List of Depreciation Schedules is null
- The provided List of Depreciation Schedules is empty
- Any of the Depreciation Schedules has a null Effective_Depreciation_Date__c
- Any of the Depreciation Schedules has a null Depreciation_Amount__c
- The provided Expected Total Amount is null

roundWithoutCorrection

global static void roundWithoutCorrection(List<fam__FA_Depreciation_Schedule__c> depreciationSchedules)

This method rounds the depreciation amounts of the list of depreciation schedules. This method does not interact with the database at any stage. This method expects the caller to query the objects and to update the resulting objects after it finishes executing. The required fields are:

- FA_Depreciation_Schedule__c.Depreciation_Amount__c

Input Parameters

Name Type Description
depreciationSchedules List<fam__FA_Depreciation_Schedule__c> The depreciation schedules to be rounded.

Exceptions Thrown

Value Description
FixedAssetException A fixed asset exception can be thrown by this method if any of the following are true:
- The provided List of Depreciation Schedules is null
- The provided List of Depreciation Schedules is empty
© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.