VAT

# Rounding

Understand how Wafeq calculates tax amounts and the effect of rounding.

## How Wafeq calculates subtotal, total tax amount and total invoice amount

Here's how Wafeq calculates these amounts:

• Total = Total of Line amount including tax for all lines
• Line amount including tax = Quantity * Price before tax * (1 - % discount) * (1 + % tax), rounded to 2 decimals.
• Total tax = Sum of Line tax amount for all lines
• Line tax amount = Quantity * Price before tax * (1 - % discount) * tax, rounded to to decimals
• Subtotal = Total - Total tax

### A simple numerical example

Take the following invoice with only one line item. We assume the `Price` is exclusive of tax. Note how the tax amount gets rounded from `6.795` to `6.80`.

LineQuantityPriceTax RateTaxLine amount
Line item 1145.3015%6.795 -> 6.8045.30 + 6.80 = 52.10
Subtotal45.30
VAT total6.80
Total52.10

Let's calculate the VAT total as a percent of the Subtotal:

VAT Total / Subtotal = 6.80 / 45.30 = 15.01103%

As you can see, VAT is no longer exactly 15% of the subtotal because of the rounding.

### Is this a problem?

No. Rounding effects are present in all financial applications. Different applications may handle rounding differently.