Developers
iDynamics Purchase Rebates, designed for Microsoft Dynamics 365 Business Central, lets you to set up rebate targets associated with vendors and obtain forecasts on the status of these targets.
This chapter is intended for partners and customers that want to customize the app, offering a general overview of the objects deployed by iDynamics Purchase Rebates, and including examples of some of the most common customizations.
If you have any questions regarding how to customize the app that is not answered in this manual, please do not hesitate to get in touch with us through our support portal.
Extended Tables
The extension is not very intrusive within the Microsoft Dynamics 365 Business Central standard, adding a few fields to the tables indicated below.
The Purchase Header table adds code to the OnAfterValidate event of the standard fields Pay-to Vendor No., Document Date and Currency Code in order to fill / modify the rebate group that corresponds to each line.
The Purchase Line table now includes two new fields to know the rebate group that applies to the line, if any, as well as a check to be able to exclude the line from the rebate calculation if desired, even if one applies by configuration. It also adds code to the OnAfterValidate event of the standard field No., and to the OnInsert event in order to fill / modify the rebate group that corresponds to the line.
The tables Purch. Inv. Line and Purch. Cr. Memo Line now include a computed field in order to know if the line is included in any rebate forecast and a check that indicates if the line has been excluded from the rebate calculation.
In all cases, fields added by the app can be easily found, as their names all start with IDPPRA.
New Tables
The extension adds new configuration tables to setup rebate groups with its elements and rebate periods with its targets, and also adds a new table Rappel movements where records are generated every time a purchase document is posted, or the rebate forecast update process is executed.
In alphabetical order, this is the list of tables added to Business Central by the app.
- IDPPRA Purch. Group Reb. Elem.. Purchase rebate group elements (products, accounts, etc.).
- IDPPRA Purch. Rebate Entry. Purchase rebate entries. They are generated each time a purchase document is posted, or the rebate forecast update process is executed. One rebate entry is generated for each line of the purchase document for which it applies (the number -product, account, etc.- of the line belongs to a rebate group and has not been explicitly excluded), provided that there is a rebate period for the vendor, posting date and currency code.
- IDPPRA Purch. Rebate Group. Purchase rebate groups.
- IDPPRA Purch. Rebate Period. Purchase rebate periods.
- IDPPRA Purch. Rebate Target. Purchase rebate period targets.
- IDPPRA Purchase Rebates Setup. General configuration options for the app. At the moment it has no field. Only subscription information is added, in case of Saas installation
Customization
Apply Target Results
The extension is, as standard, merely informative, giving a detailed view of the state of achievement of the rebate targets, but does not take any action with these results.
If the customer wishes to take any action with such results, or apply them in any particular way, our recommendation is to add fields to the IDPPRA Purch. Rebate Target table, where the targets are defined, with the characteristics of the benefit to be applied within the customer's Microsoft Dynamics 365 Business Central logic.
Once this is done, the customization could include a codeunit that is launched in a scheduled way and, for the rebate periods that have already ended, look through the table of targets and, comparing them with the calculated fields for the period (which tell us the amount and total units), take the corresponding actions to apply the benefits. Example: an "active profit" mark could be added to the target register, and displayed as a warning when creating a purchase order for the vendor.
Customizing the Rebate Forecast Report
If you want to customize the report, we recommend creating a copy of the existing one, and then customizing that copy.
Once that has been done, you would have to hide the two actions (in the vendor list and in the rebate forecast list) that trigger the report included in the extension to be created and replace it with the customized report.