Skip to main content

Rounding

NET, GROSS and VAT values

Terms

  • NET unit price: the net price of one piece (or any other unit) of an item in the invoice.
  • Quantity of item: the sold amount of the given item.
  • Total value of item: the net unit price of the item multiplied by the quantity of the item.
  • VAT value of item: calculated from the total value of the item with the given VAT rate.
  • GROSS value of item: the sum of the total value and the VAT value of the item.
info

For invoices issued in a foreign currency, non-integer amounts are allowed.

For HUF invoices, only the net unit price of an item may be a fraction: the total net value, the VAT value and the gross value must all be integers. This means that rounding is frequently necessary, since applying the 27% VAT rate rarely yields an integer result.

Rounding based on NET value (HUF invoice)

In case you are issuing an invoice for a business partner and not a natural person (B2B), you have to use this method in the following way:

  • Take the "Net unit price" (it can be any amount: integer or not).
  • Multiply the "Net unit price" with the "Quantity of item". If the result is not an integer, you must round it. This will be the "Total net value of item".
  • Take the "Total net value of item" and the VAT rate (e.g. 27%) and calculate the VAT amount. If the result is not an integer, you must round it.
  • Add the VAT value (integer) and the "Total net value of item" (integer) to get the gross amount. Since both values were integers, the result will be an integer as well.
tip

Example: you sold 3 books at a net unit price of 500 HUF with 27% VAT.

Net unit price: 500 HUF
Quantity: 3 pieces
Total net value of item: 500 x 3 = 1500 HUF
VAT rate: 27%
VAT value: 1500 * (27 / 100) = 405 HUF

How to express this in XML:

<tetel>
<megnevezes>Könyv</megnevezes>
<mennyiseg>3</mennyiseg>
<mennyisegiEgyseg>db</mennyisegiEgyseg>
<nettoEgysegar>500</nettoEgysegar>
<afakulcs>27</afakulcs>
<nettoErtek>1500</nettoErtek>
<afaErtek>405</afaErtek>
<bruttoErtek>1905</bruttoErtek>
</tetel>

Rounding based on GROSS value (HUF invoice)

In case you are issuing an invoice to a natural person (B2C) you have to use this method.

  • Take the "Gross unit price" (it can be any amount: integer or not).
  • Multiply the "Gross unit price" with the "Quantity of item". If the result is not an integer, you must round it. This will be the "Total gross value of item".
  • From the "Total gross value of item" and the VAT rate calculate the VAT amount. The formula for the calculation is: "Total gross value of item"/(100+VAT rate) x VAT RATE.
  • The "Total net value of item" can be calculated by subtracting the VAT amount (integer) from the "Total gross value of item" (integer). The result will also be an integer.
tip

Example: you sold 3 books at a gross unit price of 500 HUF with 27% VAT.

Gross unit price: 500 HUF
Quantity: 3 pieces
Total gross value of item: 500 x 3 = 1500 HUF
VAT rate: 27%
VAT value: 1500 / (100 + 27) x 27 = 318.89 HUF
The VAT amount rounded is therefore 319 HUF.
Total net value of item: (1500 - 319) / 3 = 393.66 HUF

How to express this in XML:

<tetel>
<megnevezes>Könyv</megnevezes>
<mennyiseg>3</mennyiseg>
<mennyisegiEgyseg>db</mennyisegiEgyseg>
<nettoEgysegar>393.66</nettoEgysegar>
<afakulcs>27</afakulcs>
<nettoErtek>1181</nettoErtek>
<afaErtek>319</afaErtek>
<bruttoErtek>1500</bruttoErtek>
</tetel>

In case you do not keep these rules, Számla Agent will do the rounding in order to comply with the law.

How does Számla Agent handle fractional numbers in HUF invoices?

When Számla Agent receives a HUF invoice where the net, gross, and VAT amounts are fractional numbers, it performs rounding based on the following rules:

NetVAT AmountGrossCalculation Logic
FractionalFractionalFractionalRound the gross, round the VAT, then net = gross - VAT.
IntegerFractionalFractionalRound the VAT, then gross = net + VAT.
FractionalIntegerFractionalRound the gross, then net = gross - VAT.
IntegerIntegerFractionalGross = net + VAT.
FractionalFractionalIntegerRound the VAT, then net = gross - VAT.
IntegerFractionalIntegerVAT = gross - net.
FractionalIntegerIntegerNet = gross - VAT.
IntegerIntegerIntegerNo action needed.

How do I know the number of an invoice and its gross or net value?

Every HTTP response consists of two parts. The first one is the header, and the second one is the body. If the calling party requests the invoice, the body will be a pdf file. The header is always a name=value pair. In all programming languages that support HTTP requests there is an option to get the values in the header. In Számla Agent you can insert data in the header using the following names always starting with szlahu_:

  • szlahu_szamlaszam: the number of the created invoice, URL encoded
  • szlahu_nettovegosszeg: number type data, not URL encoded
  • szlahu_bruttovegosszeg: number type data, not URL encoded
  • szlahu_vevoifiokurl: this is the URL which was sent to the customer in the invoice notification. If online payment is available, the customer can use this link for payment.
  • szlahu_error: text of error message, a single sentence, URL encoded
  • szlahu_error_code: number type data, not URL encoded

If there are error codes in the header, the other data (invoice number, gross and net value) will not be present in the header. In case of an XML response, the XML will include that information besides the header fields.