...
The customer needs to be able to manage their rebates in Pricefx to be able to reward their customers for performance. The process has several phases:
Phase 1: Prepare Rebate Agreement
Sales Manager needs to negotiate the Rebate Agreement – to capture the negotiated parameters/conditions.
The system generates the Rebate Records to be used for regular recalculations during the year.
Phase 2: Regular actions during the year
Payout (Rebate Records) calculations – to capture the current state of the rebates and to get better estimations.
Prepare the Rebate Record for Export and for Allocation
Rebate Allocation (of the Rebate Records created from approved Rebate Agreements) – every time new data is loaded into transactions.
[OOS] Sales Managers review the report on customer rebates.
During the year they want to be able to see the updates of the estimated rebates per customer (targets, payouts) to be able to discuss with the customer when they’re not compliant.
[OOS] Rebate Records (aka "Payouts") approvals
[OOS] Export of approved Rebate Records (or Payout Records).
Phase 3: After a year
[OOS] Payouts approval of the yearly payouts.
Final allocation of the approved rebates.
[OOS] Export of approved payouts (Rebate Records).
[OOS] Review of last year rebates impact.
For analytics purposes, they need to see the actual rebate paid to the customer reflected/allocated in the transactions (to track the effectiveness, to see the real margin).
...
Generate a Rebate Record
Edit your Rebate Logic BonusOnSales
Create a new Element named "RebateRecords"
Example 1. Code of Element "RebateRecords"
Code Block rebateRecords.add( /* use parameters if need to make a record with different validity */ // startDate: "2020-01-01", // endDate: "2020-03-31", // payoutDate: "2020-04-15", ) /* for testing purposes, you can show the link to the screen with RRs of this Line Item */ // return rebateRecords.asLink()
set Calculation Context to "Agreement"
you can generate the Rebate Record only in the phase/context of recalculation of the Rebate Agreement, not in any other time, so it’s important to set the “Calculation Context” of such element to “Agreement”.
set Display Mode to "Never"
Test the logic in Studio (the same way as in Rebate Manager Lab1)
Deploy the logic to the partition
To generate the Rebate Records:
Open your saved Rebate Agreement (at screen RebateManager Rebates → Rebate Agreements)
Recalculate the Agreement – because of the change in logic, it will generate the Rebate Record(s). Note: they’re not saved yet.
Save the Agreement, it will cause:
the Rebate Record(s) will be stored to database
the new Rebate Record Set named "Default" will be created
as you create the RR the 1st time and by default the name of the Rebate Record Set (that’s one of the RR’s field) is set to "Default", the system creates a new Rebate Record Set, named "Default". The user interface might not be aware of this new RRS, so it could be needed to reload the UI in a browser.
Navigate to Rebates → Rebate Records. Rebate Records appear on the screen.
Figure 2. Screen with list of Rebate Records (which belong to the "Default" Set of records.)
Review all the columns of the generated Rebate Records. You should find a lot of out-of-the-box columns automatically pre-populated with values from your agreement line item.
Review the detail of the Rebate Record
when you click on the ID of the Rebate Record, it opens a detail screen for the Rebate Record
Figure 3. Screen with detail of one Rebate Record
review the following sections on the screen:
Agreement Terms - a copy of the input fields from the RA Line Item and RA Header
Inputs - optionally, the Rebate Record can also have its own input parameters. There’s no input field defined on the RR itself (i.e. defined by the RR’s logic)
Results - calculated results of the RR. There’s no result yet, as you’ve never re-calculated this new Rebate Record.
review the buttons:
Calculate – to recalculate the Rebate Record right now (using the logic and target date mentioned at the top of the screen). This is also really useful for testing purposes.
Remember, here the logic is executed in the context of Rebate Record
Save – to save the new results
View Workflow – the Rebate Record can have its own Workflow (usually to approve the rebate money to be paid to the customer)
click on the button Calculate and observe if there’s any change - did anything change in the Results section? Why?
...
Modify your rebate logic “BonusOnSales”
Create an element “ActualRebate”, to calculate the Actual Rebate.
Example 2. Code of Element "ActualRebate"
Code Block if (out.ActualSales != null && out.RebatePct != null) { return out.ActualSales * out.RebatePct }
Ensure the result of the element will be visible.
Keep the Calculation Context empty
This result could be interesting also on the Agreement itself, because we’re negotiating the agreement already during the beginning of the validity year. So let’s keep the "Calculation Context" empty for this element, to be able to use it also in the Agreement
Test the logic, if works ok and verify the correctness of the calculated result numbers
Deploy the logic to the partition
Open detail of your Rebate Record:
Navigate to Rebates → Rebate Records.
A screen with list of Rebate Records appears.
Click on the ID (it looks like link) of your Rebate Record created before, to open the detail of the Rebate Record.
Figure 4. Screen with detail of a Rebate Record, which was not yet calculated.
Recalculate the Rebate Record:
Click on the Calculate button
the Rebate logic will be executed (in the context of Rebate Record)
results will be displayed in the Results section
Figure 5. Detail of one Rebate Record with Results calculated after click on Calculate button.
Experiment with the Target Date modification and always recalculate the record, to see the impact on Actual Sales and Rebate.
remember, we’re using the Target Date to simulate the Today, so by changing the TargetDate you can simulate how the rebate will change during the validity period of the agreement (e.g. during the year). Also, we already have all the Transactional data in the Datamart for the whole year of agreement validity, which is not possible in the real world scenario.
Save the Rebate Record
To close this detail screen, you can either use the navigation menu, or you can also use the "breadcrumb" navigation in the left top corner.
...
Prepare the scheduled job
Navigate to Rebates → Calculations
Figure 6. List of the Rebate Calculation jobs, which regularly recalculate the Rebate Records
(if there’s no "Default" process available in the list on the left side, then click on the "Add" button to add one, with Label "Default" and Set "Default")+
Click on the "Default" calculation, to see the detail of the calculation process
Figure 7. "Default" Rebate Calculation job without any scheduling
Notice the are 3 sections:
Schedule - to setup when the recalculations should run
Rebate Records - list of Rebate Records to be recalculated
Calculation - optional to set details for the calculation process
In the "OPTIONS" section:
Un-tick the "Incremental"
In the "Schedule" section, add the schedule for automatic recalculations:
click on "Add Task"
set the Start Date from tomorrow
set the Period to be a DAY
set Interval to 1
the Name is optional, for users to recognize the reason behind this specific schedule
Figure 8. Set the scheduling of the recalculation process.
In the “Rebate Records” section, select (by a filter) which Rebate Records should be recalculated.
Remember, there can be more Records created during the validity of the agreement (e.g. during the year), that’s why the filter must be generic - i.e. not selecting particular Rebate Records IDs - but rather something like date range or similar.
Figure 9. Setup the filter, to say which Rebate Records you want to recalculate by this job.
Select specific Calculation settings for recalculation your Rebate Records. Nothing is mandatory in the "Calculation" section, but for this exercise we will setup the "Target Date"
Remember: we’re using here the “Target Date” to simulate “Today”.
Figure 10. Setup (optionally) the calculation logic and parameters for the Calculation process.
Save the scheduled Calculation.
Verify, if the scheduled job runs correctly.
Click on “Run Calculation” to execute manually, to test the calculation.
Then, after a while, use the Refresh button (in the "Job/Task Tracking" table below the Schedule) to verify, that the process finished successfully – i.e. with “Ready” state.
Figure 11. The button Run Calculation will start the Job/Task. The section "Job/Task" Tracking show the status of it.
Rename the Label to "RR_Calculations" and Save the Job.
...
Setup the Mapping of calculated result ActualSales and ActualRebate to the attribute columns
Navigate to Rebates > Rebate Records
Make the fields the attribute1 and attribute2 columns
Figure 12. The columns attribute1 and 2 will be used to store the values of ActualSales and ActualRebate
Use "Rename and Customize" to change the name of "attribute1" column to "ActualSales"
When setting the “Name” of the attribute column - it must exactly match the name of the calculated result, in order to be mapped automatically (and the name of the calculated result came up from the name of the logic element used to calculate the result). Remember, the logic element must have “Display Mode” set to “Everywhere”, otherwise its result value will not be mapped.
Set the “Type” of the column to “Real”.
Optionally (as it’s useful only for viewer, but not for the process which reads the data of the column), you can set “Format Type” to “Money”.
Use "Rename and Customize" to change the name of "attribute2" column to "ActualRebate"
apply the same rules as for the previous one
Reload the browser window, so that the UI reloads the new metadata settings properly
Verify the Mapping
Recalculate the Rebate Record
Navigate to RebateManager Rebates → Rebate Records
Click on the ID (the link) of your Rebate Record to open the detail of it
Recalculate the Rebate record results - click the "Calculate" button. This is just to be sure, you have the Results available, in case you haven’t saved the calculated results already before.
Figure 13. Save the Results of the Rebate Record to copy the Results to the attribute columns
Perform the mapping
once you click on the "Save" button, the system will take the results and map them to the attribute columns.
Verify the values of columns “attribute1” and “attribute2” of the Rebate Record
Navigate to RebateManager Rebates → Rebate Records
Refresh the list
Review the content of columns attribute1 and attribute2 columns (now called ActualSales and ActualRebate). Verify, if the numbers are correct (i.e. only from first 3 months of 2020). Your numbers can be different that on the screenshot, so ensure you know, what numbers you should expect.
Remember: you can quickly summarize data in DataMart using the built-in DataTable tool under PriceAnalyzer → Data Analyzer → Data Table.
Figure 14. Rebate Record with calculation results mapped to the attribute columns
...