Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Calculating Rebate Agreements

During the negotiation of a Rebate Agreement, the end user can click on the Recalculate button on the Rebate Agreement detail page.

RBA calculate button

When this button is clicked, then:

  1. The Rebate Header Logic is executed in PrePhase mode.

  2. For each Line Item, the system will execute that Rebate Calculation Logic, which is associated with the Rebate Type of the Line Item.

  3. The Rebate Header Logic is executed in PostPhase mode.

  4. The results/outputs are returned back to the UI and displayed to the user.

When submitted, the Rebate Agreement is locked for editing, recalculated and saved, the approval workflow steps are generated and workflow steps are executed.

Once the Rebate Agreement is locked for editing, it cannot be recalculated manually. It will only be recalculated each time you open it on the screen, but only within the "agreement read-only" context of the calculation logic. Note that in the read-only mode, the header logic is not run, only line items are recalculated. Such result is not saved, only displayed in the UI.

Event Sequence Negotiation

Because the Logics are executed during the negotiation of the Rebate Agreement, i.e., before any transactions have taken place, the rebate amount cannot be calculated yet. Therefore, this calculation typically results in forecasts and estimations of what the final rebate amount may be.

Rebate Calculation LineItem Phase

In order for the rebate amount to be calculable, the Logic needs to produce at least one object of the type Rebate Record (RR). This is achieved with the Groovy API method rebateRecords.add(). The Rebate Record holds a reference to the Line Item’s Rebate Type, and the copies of all the Line Item input and output values. How the Rebate Record is used to calculate the rebate amounts is described in the next chapter.

...