Amortization Class

This global class allows users to perform the following:
1. Amortize a single Source Document (Currenty supported source document types include Billings and Payables)
2. Amortize a collection of Source Documents (Currenty supported source document types include Billings and Payables)

Amortization Methods

The following are the global methods for the Amortization class. All methods are instance methods.

amortize(AmortizationOptions)

Amortize single Source Document.

Signature

global AmortizationResult amortize(AmortizationOptions options)

Parameters
Type: AmortizationOptions

Return Value
Type: AmortizationResult

Usage

AcctSeed__Billing__c sourceDoc = [SELECT Id FROM AcctSeed__Billing__c WHERE Id ='Record Id'];

AcctSeed.AmortizationOptions option = new AcctSeed.AmortizationOptions();
option.sourceDocument = sourceDoc.Id;
option.startDate = date.newinstance(2022, 1, 1);
option.endDate = date.newinstance(2022, 6, 1);
option.amortizationMethod = 'Straight Line - Full Month';

AcctSeed.Amortization amortization = new AcctSeed.Amortization();
AcctSeed.AmortizationResult amortizeResult = amortization.amortize(option);
amortize(List<AmortizationOptions>)

Amortize a collection of Source Documents.

Signature

global List<AmortizationResult> amortize(List<AmortizationOptions> options)

Parameters
Type: List<AmortizationOptions>

Return Value
Type: List<AmortizationResult>

Usage

List<AcctSeed.AmortizationOptions> options = new List<AcctSeed.AmortizationOptions>();
for(AcctSeed__Billing__c sourceDoc : [SELECT Id FROM AcctSeed__Billing__c WHERE Id IN 'Record Ids']){
    AcctSeed.AmortizationOptions option = new AcctSeed.AmortizationOptions();
    option.sourceDocument = sourceDoc.Id;
    option.startDate = date.newinstance(2021, 12, 1);
    option.endDate = date.newinstance(2022, 3, 1);
    option.amortizationMethod = 'Straight Line - Full Month';
    options.add(option);
}

AcctSeed.Amortization amortization = new AcctSeed.Amortization();
List<AcctSeed.AmortizationResult> amortizeResults = amortization.amortize(options);