global static ffrr.CalculationService.Calculation calculateEqualSplit(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)
Calculates revenue for an Equal Split recognition method and a calculation type of Months using the supplied values. The results are calculated on whole months.
Input Parameters
Name
Type
Description
totalRevenue
Decimal
Total revenue for the calculation.
prevRecognized
Decimal
Revenue previously recognized.
startDate
Date
Start date of the item.
endDate
Date
End date of the item.
recognitionDate
Date
Date on which to base calculations.
Return Value
This service returns a ffrr.CalculationService.Calculation object.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.
//Setup the dates involved
Date startDate = Date.newInstance(2013, 01, 01);
Date endDate = Date.newInstance(2013, 12, 31);
Date recognitionDate = Date.newInstance(2013, 01, 05);
global static ffrr.CalculationService.Calculation calculateEqualSplit445(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)
Calculates revenue for an Equal Split recognition method and a 445 calculation type using the supplied values. The results are calculated using the 445 recognition periods and years defined in the system.
Input Parameters
Name
Type
Description
totalRevenue
Decimal
Total revenue for the calculation.
prevRecognized
Decimal
Revenue previously recognized.
startDate
Date
Start date of the item.
endDate
Date
End date of the item.
recognitionDate
Date
Date on which to base calculations.
Return Value
This service returns a ffrr.CalculationService.Calculation object.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.
//This sample requires that Revenue Recognition years and periods exist within
//the system as, without them, calculations that rely on periods cannot be performed.
//Setup the dates involved
Date startDate = Date.newInstance(2013, 01, 01);
Date endDate = Date.newInstance(2013, 12, 31);
Date recognitionDate = Date.newInstance(2013, 01, 05);
global static ffrr.CalculationService.Calculation calculateEqualSplitDays(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)
Calculates revenue for an Equal Split recognition method and a calculation type of Days using the supplied values. The results are calculated according to the number of days between the specified start and recognition dates and the mean value per day between the specified start and end dates.
Input Parameters
Name
Type
Description
totalRevenue
Decimal
Total revenue for the calculation.
prevRecognized
Decimal
Revenue previously recognized.
startDate
Date
Start date of the item.
endDate
Date
End date of the item.
recognitionDate
Date
Date on which to base calculations.
Return Value
This service returns a ffrr.CalculationService.Calculation object.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.
//This sample requires that Revenue Recognition years and periods exist within
//the system as, without them, calculations that rely on periods cannot be performed.
//Setup the dates involved
Date startDate = Date.newInstance(2013, 01, 01);
Date endDate = Date.newInstance(2013, 12, 31);
Date recognitionDate = Date.newInstance(2013, 01, 05);
global static ffrr.CalculationService.Calculation calculateEqualSplitMonthsPartPeriods(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)
Calculates revenue for an Equal Split recognition method and a calculation type of Months/Part Periods using the supplied values. The results are calculated using both whole and part months/periods.
Input Parameters
Name
Type
Description
totalRevenue
Decimal
Total revenue for the calculation.
prevRecognized
Decimal
Revenue previously recognized.
startDate
Date
Start date of the item.
endDate
Date
End date of the item.
recognitionDate
Date
Date on which to base calculations.
Return Value
This service returns a ffrr.CalculationService.Calculation object.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.
//This sample requires that Revenue Recognition years and periods exist within
//the system as, without them, calculations that rely on periods cannot be performed.
//Setup the dates involved
Date startDate = Date.newInstance(2013, 01, 01);
Date endDate = Date.newInstance(2013, 12, 31);
Date recognitionDate = Date.newInstance(2013, 01, 05);
//Actually call the calculateEqualSplitMonthsPartPeriods method
global static ffrr.CalculationService.Calculation calculateEqualSplitMonthsPartPeriodsWithProratedPartPeriods(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)
Calculates revenue for an Equal Split Months / Actual Days in Part Periods recognition method and a calculation type of Months / Actual Days in Part Periods using the supplied values. The results are calculated using both whole and part months/periods.
Input Parameters
Name
Type
Description
totalRevenue
Decimal
Total revenue for the calculation.
prevRecognized
Decimal
Revenue previously recognized.
startDate
Date
Start date of the item.
endDate
Date
End date of the item.
recognitionDate
Date
Date on which to base calculations.
Return Value
This service returns a ffrr.CalculationService.Calculation object.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.
//This sample requires that Revenue Recognition years and periods exist within
//the system as, without them, calculations that rely on periods cannot be performed.
//Setup the dates involved
Date startDate = Date.newInstance(2021, 01, 16);
Date endDate = Date.newInstance(2021, 09, 05);
Date recognitionDate = Date.newInstance(2021, 01, 31);
//Actually call the calculateEqualSplitMonthsPartPeriodsWithProratedPartPeriods method
global static ffrr.CalculationService.Calculation calculateRevenue(SObject record, Date recognitionDate, String currencyFilter)
Calculates revenue based on the template associated with the supplied record. The method will automatically extract the required values based on the record's template, determine the calculation type involved, validate any needed data and perform the calculation.
Input Parameters
Name
Type
Description
record
SObject
The item to calculate revenue for.
recognitionDate
Date
Date on which to base calculations.
currencyFilter
String
Currency ISO code to use in the calculation.
Return Value
This service returns a ffrr.CalculationService.Calculation object.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.
//Note: This sample requires that a complete set of Recognition Settings, Recognition Templates, and Recognition
//Years and Periods (covering the year 2013) are available within the system. For the
//purposes of this example it is assumed that we are using an ffrr__PerformanceObligation__c record which is
//correctly connected to a valid Template. You can put any source record here.
//The item that we'll be calculating revenue for. You would use your SObject here.
//Populate the fields inherited from ffrr.ViewService.Reference
calc.id = 'a0va00000059tb8';
calc.name = 'My Calculation';
//Populate the fields from specific to ffrr.CalculationService.Calculation
calc.previouslyRecognized = 112.78;
calc.recognizedToDate = 1222.95;
calc.toRecognizeThisPeriod = 75.25;
calc.totalRevenue = 2000.00;
calc.calculatedTotalRevenue = 1500.00;
//Create a list to hold any errors for the calculation
calc.errors = newList<String>();
//Add the errors to the error list
calc.errors.add('Missing year/period');
calc.errors.add('Total recognized cannot be greater than total revenue');
Properties
Name
Type
Description
calculatedThisPeriod
Decimal
Revenue to calculate this period.
calculatedToDate
Decimal
Total revenue calculated to date.
calculatedTotal
Decimal
The modified total value used to perform the calculation, based on the Cost/Revenue Basis. If no Cost/Revenue Basis is specified this matches Total Cost/Revenue.
global with sharing class LineDetail extends Calculation
Deprecated:
Contains a complete set of line or summary data as used by the revenue recognition user interface. The structure contains everything needed to recognize the row data.