# Adjusting for Tax Rounding Differences

Generally, there are two ways to calculate the taxes on an invoice: by row or by column. Applying one or the other method may produce different summarized values.

Concepts and implemetation

JustOn calculates the taxes on row base, that is, individually for each invoice line item, and then sums the resulting item totals. This means, each invoice line item fulfills the legal tax regulations, and in addition, JustOn supports multiple tax rates per invoice.

If, however, there is only one tax rate used, a user may be tempted to recalculate the invoice based on column totals. Then the user may get confused because of possible differences in the summarized values.

The following example illustrates the behavior and the possible confusion:

Pos Unit Price Quantity Tax Rate Pos Total (net) Pos Total (tax) Pos Total (gross)
A 0,69 3 19% 2,07 0,39 2,46
B 0,99 4 19% 3,96 0,75 4,71
Sum 6,03 1,14 7,17
Total (net) Total (tax) Grand Total

JustOn first calculates the total net, total tax and total gross values for each invoice line item, rounding them to two decimal places. Then it sums the item totals on the invoice.

Now assume a user recalculates the invoice based on the summarized net values, that is, applying the column-based calculation. This will yield the following result:

Total (net) Tax Rate Total (tax) Grand Total
6,03 19% 1,15 7,18
Formula `Total (net) * 0,19` `Total (net) + Total (net) * 0,19`

Because of the differently applied rounding, the calculated column-based total tax and total gross values now are 1 cent higher than the summarized row-based values of the original invoice.

Some external systems may not be able to handle these tax rounding differences. To support such conflicting scenarios, JustOn implements a special invoice line item of the type `Tax Delta`.

The tax delta offsets any tax rounding differences. This way, JustOn creates invoices that are calculated correctly on row base and on column base. The tax delta is not displayed, however, on the invoice PDF, the clone invoice page and the invoice line item mass editing page.

This works for invoices that are calculated from net unit prices.

With this feature enabled and following the example above, JustOn creates this invoice:

Pos Unit Price Quantity Pos Total (net)
A 0,69 3 2,07
B 0,99 4 3,96
Subtotal (net) 6,03
Tax (19%) 1,15
Grand Total 7,18

The tax delta feature also supports invoices with multiple tax rates. JustOn groups the items by tax rate and calculates each group separately, as illustrated below:

Pos Unit Price Quantity Tax Rate Pos Total (net)
A1 1,49 1 19% 1,49
A2 2,49 1 19% 2,49
B1 3,49 1 7% 3,49
B2 4,49 1 7% 4,49
Subtotal (net) 11,96
Tax (19%) 0,76
Tax (7%) 0,56
Grand Total 13,28

Whether to apply the tax delta is controlled using the global setting `Adjust for Tax Rounding Differences`.

1. Click to enter Setup, then open Custom Settings.

In Salesforce Lightning, navigate to Custom Code > Custom Settings.

In Salesforce Classic, navigate to Develop > Custom Settings.

2. Click Manage in the row of Global Settings.

3. Click Edit in the Default row.
4. Select the checkbox `Adjust for Tax Rounding Differences`.
5. Click Save.

Once enabled, this setting affects all updated and new invoices.

Note that the tax delta is not considered when cloning invoices.