Bonus entries calculation

To calculate bonus entries, we open the Customer/Vendor Bonus List list, select one or more lines, and choose Related->Bonus->Calculate Ledger Entries 

The calculation can be performed massively or per contract.


Note

Given the average volume of the data, it is recommended to schedule the report

Business Central will calculate the tax base of the bonus calculation for all certified contracts.

This allows you to view the calculation basis of each contract line and any expected amount, if the forecast is handled.

Scheduled calculation of bonus lines 

Sales & Purchase Bonus provides a dedicated report for scheduled calculation of bonus lines via JobQueue. This report is 18059909 "EOS075 Sched. Bonus Calc." and has the following additional options: 

Field Description
Calculate Per  Allows to specify if calculation is performed. This primarily impacts how the other options below operate.
- All: all the bonus lines will be calculated in a single transaction. This is the default behavior.
- Bonus Header: the calculation will calculate one header at a time. The last calculation date of a header will be the smallest date of each of its lines.
- Bonus Line: the calculation will calculate one bonus line at a time. The last calculation date of a line is saved on the record.  
Max. No. of Records  If you enter a value greater than zero, the calculation will stop after this number of records (header or line, depending on what you choose in Calculate Per) have been calculated.
Example: you can use this to schedule calculation every 30min, but only calculate 1 bonus header at a time. This way every 30min a bonus header will be calculated and load on the server is distributed.  
COMMIT per Record  Specifies if a COMMIT should be issued after each record records (header or line, depending on what you choose in Calculate Per) has been calculated. This will always automatically be enabled if you select ‘Ignore Errors’.  
Ignore Errors  If specified, any calculation failure of a record (header or line, depending on what you choose in Calculate Per) will not interrupt the calculation and continue with the next one. Selecting this will automatically enable COMMIT per Record. If this is enabled, errors will be logged to an error log.  
Calc. Records Older Than  Specifies if only records (header or line, depending on what you choose in Calculate Per) that have a last calculation date older than this time span will be calculated. Use this together with Max. No. of Records and COMMIT per Record to enable distributed and partial calculation. 

If “Ignore Errors” is enabled, any errors encountered during the calculation will be logged to the log that can be accessed here:  

Debugging and performance tuning calculation 

 

Depending on your bonus contracts, setups and amount entries that are posted, calculation of a bonus line and/or header can be expensive. Sales & Purchase Bonus allows to enable logging and tracing to detect possible performance bottlenecks and misconfigurations.

In the Bonus Setup you can find 2 options that allow you to enable detailed logging of bonus calculation operations. Enabling these will emit timings and durations for debugging and performance tuning purposes.

Field Description
Telemetry Logging Level  Specifies the level of logging that is emitted to ApplicationInsights telemetry during bonus calculation. 
Database Logging Level  Specifies the level of logging that is written to the database during bonus calculation. These log entries will be written to a dedicated table 18059921 "EOS075 Log Entry".  

The values of both these fields are as follows:

- None: nothing will be logged

- Minimal: only start and finish of calculation per single line will be traced

- Detailed: start and finish of calculation as well as the multiple sub-steps of the calculation per line will be traced If you enable “Database Logging Level”, you can access the log from the following action on a single bonus line:

 

See also:
Introduction
Setup
Bonus Settlement
Customer Bonus Card