...
Rebate Agreement Header is used logic when you need to:
...
Create input fields
...
for:
...
Rebate agreement header
...
Rebate agreement folders
...
Rebate agreement items (not so common)
...
Hide out-of-the-box header input fields
...
Add or remove the rebate agreement items and folders
...
– e.g. modify the structure of the document
...
Calculate results for:
...
Whole rebate agreement
...
, e.g. summaries like grand total price or overall margin
...
Folders (not so common)
...
, e.g. sub-summaries for the folders
...
Items (not so common)
...
, e.g. particular results of the line items
To understand where the header logic fits in the process, see Process of Rebate Agreement Recalculation.
Logic API
Logic Nature: rebateAgreementHeader
Logic Type: Calculation/Pricing
Execution Types:
Standard
...
– It is done
...
twice and the executions
...
are called phases. They have different
...
purposes, so you must distinguish
...
these executions in the code by checking
...
which execution it is
...
at the moment:
pre-phase
...
– First execution. It creates input fields on header, folders or items, and
...
creates/
...
removes the items/folders.
post-phase
...
– Second execution. It calculates summary info for items and stores them on the header, folder or items.
Information provided to the logic:
...
Binding variables:
raProcessor: RebateAgreementBuilder
CAUTION:
...
When using
...
Pricefx non-React user interface,
...
during pre-phase
...
the
raProcessor.rebateAgreementView
will NOT contain outputs values
...
. The only exception are "overridable" outputs. This limitation is
...
to optimize performance when sending data between user interface and backend.
Expected logic execution outcome
...
:
pre-phase execution:
Definition of input fields – via
raProcessor.addOrUpdateInput()
Content of
api.global
created by the pre-phase header logic will be persisted and available to the Rebate Item Logic when calculating the line items
post-phase execution:
Header calculation results – via the
raProcessor.addOrUpdateOutput()
Custom Header – via the
raProcessor.addOrUpdateOutput()
Set attributeX field values – via
raProcessor.updateField("attribute1", "value")
Hide out-of-the-box buttons – via
raProcessor.setRenderInfo()
Raise critical alert – If the logic creates at least one critical alert, it is considered as an exception and the process (e.g. submission) will stop.
Note that the results of the logic elements are not stored
...
or displayed anywhere (with exception
...
of testing the logic in Studio).
In general, the logic is expected to use the provided RebateAgreementBuilder object to manipulate the content of the document. For a list of allowed manipulations, see the description of the object CalculableLineItemCollectionBuilder.
Setup
As
...
it is possible to have more rebate agreement header logics, you must select the one
...
which will be used
...
when the user is working with rebate agreement
...
documents.
This selection is done in Advanced Configuration Option called defaultRAHeaderFormula
...
; the content of this option is the name of the header logic to be used.
...
Theis option can also be
...
set up
...
in Administration › Logics › Header Logics › Rebate Agreements, via
...
Default RA Header logic, and then fetched to the project as a configuration file.
Code
...
Sample
We do not have a specific rebate agreement
...
sample
...
but you can review samples for quotes and contracts. The
...
principle used in those samples
...
is exactly the same as
...
in the rebate header.
Groovy API
There are some commonly used functions for header logics:
...
Read data of the rebate agreement header and items:
raProcessor. getRebateAgreementView()
...
Check for which phase
...
the logic
...
is executed
...
:
raProcessor. isPrePhase()
raProcessor. isPostPhase()
...
Create input fields on
...
the header, folder or item:
raProcessor. addOrUpdateInput()
...
Create outputs/results on
...
the header, folder or item:
raProcessor. addOrUpdateOutput