Rebate Calculation Logic
Rebate logic has the following functions:
Calculate Rebate Agreement Line Item (RALI). Tasks of those elements are to:
Create definitions of input fields for the line item.
Calculate results of the line item.
Create the Rebate Records for the line item.
Calculate Rebate Record (RR). Tasks of those elements are to:
Calculate results of the Rebate Record.
Optionally also:
Create definitions of input fields specific for the Rebate Record.
Create Payout Records for this Rebate Record and calculate their results.
There is only a single logic for both line item and Rebate Record calculations, so there is a mechanism to set up which code of which element serves which purpose/scenario. For example, a code of one element can be executed in two different scenarios – to calculate a result of a line item, and also to calculate a result of a rebate record. The reason for such design is that a big part of calculations performed on the line item are also performed on the Rebate Records, so this is the way to avoid duplication of code.
Logic API
Logic Nature: rebateAgreement
Logic Type: Calculation/Pricing
Element Group (also called Calculation Contexts) – Every element of the logic can belong to one or more element groups which then determines in which scenario the code of the element will be used. The groups are:
agreement – The element’s code will be executed for a Rebate Line Item (e.g. to define its inputs, calculate results).
agreementReadOnly – The element’s code will be executed for a Line Item, but only if the Agreement is already approved and is "read-only". Such elements are executed when the user opens an approved agreement, so that the user can see e.g. new rebate estimations. But the calculation results are NOT stored.
rebateRecord – The element’s code will be executed for a Rebate Record (i.e. to calculate results, create & calculate Payout Records).
(no group selected) – When you do not assign the element into a specific group, then it is the same as if you would assign it into all 3 groups.
Figure 1. Logic opened in Pricefx UI. You can see a list of elements and some of their properties.Execution Types – The code of logic elements can be executed in 5 different scenarios/purposes as a combination of execution mode and element group:
Information provided to the logic – Varies based on the scenario.
Expected logic execution outcome
Code Sample
See Rebate_BonusOnSales.
Found an issue in documentation? Write to us.