This document explains how totals including taxes are calculated in Stockagile, with the aim of avoiding discrepancies between operations and invoices.
The new calculation system is applied to improve monetary rounding and ensure that subtotal, tax, and total amounts are consistent across sales, purchases, invoices, and other related documents.
⚠️ Consideration for old documents
Old invoices closed before April 16, 2026 will keep the previous calculation method.
This means that, if a similar operation is created after that date, the calculation will be performed using the new system, even if an old invoice with the same products may show different results.
INVOICES
Purchase invoices and wholesale sales invoices
In invoices, VAT is calculated per line, not on the invoice total.
⚠️ All individual values in each operation are rounded to 2 decimal places before moving on to the next operation.
For this explanation, we will use as an example two Dresses with a unit price of €33.057851 — defined by the purchase variation from the supplier — with a 21% VAT rate.
Order and formula of operations
1. Subtotal
It is calculated by multiplying the unit price, with 6 decimal places, which may or may not include an applied discount.
ℹ️ Subtotal calculation
Unit price excluding VAT × Units = Subtotal
€33.057851 × 2 = €66.115702 = €66.12
The subtotal is rounded to 2 decimals.
2. Taxes
The tax is calculated on the already rounded subtotal.
ℹ️ Tax calculation
Subtotal with 2 decimal places × VAT percentage = Taxes
€66.12 × 0.21 = €13.8852 = €13.89
Taxes are rounded to 2 decimal.
3. Total
It is calculated by adding the subtotal and taxes, both already rounded.
ℹ️ Total calculation
Subtotal with 2 decimal places + Taxes with 2 decimal places = Total
€66.12 + €13.89 = €80.01
The total is rounded to 2 decimal.
Invoice total
The invoice total will be the result of:
The sum of all subtotals
The sum of all taxes
The sum of all totals
Final example
Equivalence surcharge
The equivalence surcharge behaves the same way as VAT: it is calculated per line with 6 decimal places and rounded to 2 decimal places.
ℹ️ Surcharge calculation
Unit price excluding VAT × Units × Equivalence surcharge = Surcharge
€33.057851 × 2 × 0.052 = €3.438016504 = €3.44
The surcharge is rounded to 2 decimal.
Taxes with surcharge
ℹ️ Tax calculation
Tax with 2 decimal places + Surcharge with 2 decimal places = Taxes
€13.89 + €3.44 = €17.33
Even so, in Stockagile you will see the tax amounts broken down on invoices for clarity and ease of understanding.
Final example with surcharge
STORE SALES
Physical store sales, ecommerce sales, and sales invoices
In store sales, ecommerce sales, and sales invoices, VAT is also calculated per line, not on the total sale.
⚠️ The main difference compared with the previous invoices is that, in this case, the calculation starts from the unit price including taxes. However, each operation is still rounded independently before calculating the totals.
For this explanation, we will use as an example two Dresses with a unit price of €29.99 and a 21% VAT rate.
Formula and order of operations at line level
1. Total
It is calculated by multiplying the unit price including taxes by the number of units.
The unit price may or may not include a discount.
ℹ️ Total calculation
Unit price including taxes × Units = Total including VAT
€29.99 × 2 = €59.98
The total is rounded to 2 decimal.
2. Taxes
The tax amount included in the price with VAT is calculated.
ℹ️ Tax calculation
Total including VAT × Tax value / (100 + Tax value) = Taxes
€59.98 × 21 / (100 + 21) = €10.4097520661 = €10.41
Taxes are rounded to 2 decimal.
3. Subtotal
It is calculated by subtracting the taxes from the total including VAT.
ℹ️ Subtotal calculation
Total including VAT - Taxes = Subtotal
€59.98 - €10.41 = €49.57
The subtotal is shown with 2 decimal.
Sale total
The sale total will be:
The sum of all totals
The sum of all taxes
The sum of all subtotals
Final sales example





