menu
  • БЪЛГАРСКИ
  • News
  • Articles
  • Projects
  • Downloads
  • Аbout
  • Donation
  • last edited on: 2018-06-03

    Algorithm For Calculating Corrections On a Row Of The Sale Through Specifically Defined Amount

     

    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 a specifically defined amount, in this article you can find the algorithm used for making calculations in Datecs Ltd’s fiscal devices.

    Fiscal devices allow for a sale with a correction to be carried out, where the value of the correction is in the form of an amount calculated in advance. In this case the fiscal device will accept correction amounts as long as they are rounded off to the second decimal after the decimal separator. The fiscal device will not carry out the command if as a result the value of the corrected "RowSumi" for the specified row is negative.

     

    Discount

    If the amount with which we would like to correct the sale on a given row is contained within the variable “AdjustmentSumi”, then the discount formula for a specifically defined amount is:

    BGR_PercentDiscountRowSum_i

     

     

    Surcharge

    The formula for calculating a surcharge is as follows:

    BGR_PercentSurchargeRowSum_i

     

     

    In both cases of correction one has to:

    1. Calculate the current row sum "CurrentRowSumi" for a given row;
    2. Round of the resulting "CurrentRowSumi" to the second decimal after the decimal separator;
    3. Apply the necessary correction to "RowSumi";
    4. In this case there is no need to round off following the correction as “AdjustmentSumi” is also rounded off to the second decimal after the decimal separator;

     

     


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