- last edited on: 2018-06-03
Algorithm For Recalculating The Z-Report
For every Z-report, the fiscal device does all the necessary calculations again.
- This article is related to clarifications on algorithms used by fiscal devices in Bulgaria for rounding off and to clarifying the algorithm for making corrections on the Subtotal;
- It would be best if you have already read the previous articles on the topic:
- Algorithm for calculating the sum for a given row of sales in a fiscal receipt;
- Algorithm for calculating a correction on a row of the sale through percentage;
- Algorithm for calculating a correction on a row of the sale through a specifically defined amount;
- Algorithm for calculating the accumulation of sums in tax groups and the current total sum;
- Algorithms for calculating the current total sum (subtotal):
- Algorithm for the correction of a subtotal with a specifically defined amount;
- Algorithm for the correction of a subtotal with a given percentage;
- Algorithm for calculating the accumulated net sums and tax sums;
Reasons For Recalculating
Due to legislative requirements, as well as the rules of mathematical rounding, when following the rounding algorithms, it is possible that you may get what at first glance look like odd results. Take, for example, the middle case - after a Z-report with a reset, you sell an onion candy with the end price of one stotinka, following which you have accumulated one stotinka in the second tax group through the formula for calculating net sums and tax amounts:

Note: The “onion” candy is a type of Bulgarian hard candy which in most cases costs the end client one stotinka. Depending on the sums involved and the value of the tax in the relevant tax group it is possible to get other combinations.
What you get is a "NETX" value of 0,00833333333333333333333333333333. After rounding that off, you get a NETX = 0.01. If we now calculate the amount of tax owed through the formula:

It would be the case that no tax is owed.
To avoid the possibility of losing out on taxes, fiscal devices store and accumulate the relevant sums in tax groups, and not the amounts of tax owed calculated in each fiscal receipt.
In every Z-report the fiscal device does the necessary calculations again and prints out (and saves in the fiscal memory) the results produced. If within a single day there is only one such sale, the discrepancy described above will occur but this is permitted by regulation.
If the information in this article is incomplete or incorrect, don’t hesitate to contact me so I can make the necessary edits.

