- last edited on: 2018-06-03
Algorithm For Calculating Corrections On a Row Of The Sale Through a Percentage
The total sum which is to be inferred from a given row of a sale in a fiscal receipt (let us call it "RowSumi") is calculated through an algorithm which can be found here. If corrections need to be made on "RowSumi" through the accrual of a certain percentage (surcharge or discount), in this article you can find the algorithm used for making calculations in Datecs Ltd’s fiscal devices.
Let us the call the value of the percentage with which we would like to correct a certain row of the sale the “percentValue”. If we would like to make a sale corrected with a certain percentage and visualize (write/use) the same values which will be printed out by the fiscal device, the sequence of steps and formulas will be the following:
We calculate the sum (“AdjustmentSumi”) with which the fiscal device will correct the specified row of the sale through the formula:

The result is rounded off to the second decimal after the decimal separator.
Discount
To calculate a discount, the following formula is used:

Warning: In Bulgaria it is not permitted to make such a discount which would render the price negative. The fiscal device will not accept a command for such a sale.
Surcharge
To calculate a surcharge, the following formula is used:

If the information in this article is incomplete or incorrect, don’t hesitate to contact me so I can make the necessary edits.

