menu
  • БЪЛГАРСКИ
  • News
  • Articles
  • Projects
  • Downloads
  • Аbout
  • Donation
  • last edited on: 2021-07-17

    Algorithm For Correcting The Current Accumulated Sum With a Given Percentage

     

    In Bulgaria it is allowed to make corrections on the amount currently accumulated on the fiscal receipt (“on” the Subtotal). One of the possible ways to do this is to have the client software send the fiscal device a command for adding a discount or surcharge “on” the Subtotal with a specifically defined amount.

    • 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 of a given row of sales in a fiscal receipt;
      • Algorithm for calculating the correction on a row of the sale through a percentage;
      • Algorithm for calculating the correction on a row of the sale through a specifically defined amount;
      • Algorithm for calculating the accumulation of sums in tax groups and current total sum;

     

    With this algorithm, the adjustment amount for total sum is calculated and the adjustment is then distributed to each of the accumulated sums in different tax groups, the rounding off error is calculated and also distributed among sums. At the time of writing this article, this algorithm is used in all Datecs cash registers made after the changes in Ordinance №18 in 2018.

     

    Corrections To The Total Sum

    The adjustment sum "AdjustmentSum" of the total sum “TotalVATSum“ is calculated through the following formula:

     

    016_BGR_AdjustmentSum_ForVATGroupX.png

     

     

    The resulting amount is rounded off to the second decimal after the decimal separator.

     

    New Total Sum For Discounts

    The formula for inferring the new total sum after a discount is:

     

    017_BGR_NewDiscountSum_ForVATGroupX.png

     

     

    New Total Sum For Surcharges

    The formula for inferring the new total sum after a surcharge is:

     

    018_BGR_NewSurchargeSum_ForVATGroupX.png

     

     

    Note: Each of the sums resulting from the formulas above (“AdjustmentSumForVATGroupX” )  must be produced rounded off to the second decimal after the decimal separator already.

     

    New Total Sum

    It can be calculated through the following formula:

    019_BGR_TotalVATSum.png

     

     

     

     


    If the data or something else in this article is incorrect - please email me to correct the article. my_email