How Zudello Calculates Line Totals
Accurate line-level calculations form the basis for correct document header totals. Zudello automatically calculates several key fields on each transaction line based on the input values and the document's tax settings.
Input Fields:
The calculations primarily rely on these fields, which are often extracted or entered manually:
quantity
: Number of units.unit_price
: Price per unit.total
: Total amount for the line (may or may not include tax initially).tax_rate
: The linked Tax Rate record (e.g., 10% GST).tax_included
(Header Level): A toggle indicating if thetotal
values on the document lines include tax (TRUE
) or exclude tax (FALSE
).
Calculated Fields:
Zudello automatically calculates and stores these values:
-
Line Tax Amount (
tax_amount
): The tax portion for the line.- If
tax_included
isTRUE
: Tax is backed out:tax_amount = total - (total * 100 / (100 + tax_rate.rate))
- If
tax_included
isFALSE
: Tax is added:tax_amount = total * tax_rate.rate / 100
- Defaults to
0
iftax_rate
is missing.
- If
-
Line Total Exclusive (
total_exclusive
): The line total before tax.- If
tax_included
isTRUE
:total_exclusive = total - tax_amount
- If
tax_included
isFALSE
:total_exclusive = total
- If
-
Line Unit Price Exclusive (
unit_price_exclusive
): The unit price before tax.- Zudello attempts to determine if the entered
unit_price
was inclusive or exclusive based on whether(unit_price * quantity)
matches the calculatedtotal_exclusive
(iftax_included
is TRUE) or thetotal
(iftax_included
is FALSE). - If determined exclusive:
unit_price_exclusive = unit_price
- If determined inclusive:
unit_price_exclusive = unit_price - (tax_amount / quantity)
- Zudello attempts to determine if the entered
-
Line Total (
total
) - Recalculation: Ifquantity
andunit_price
are present, Zudello often recalculates the linetotal
asquantity * unit_price
. The interpretation of whether this recalculated total includes tax depends on thetax_included
flag.
Key Factor:
- The
tax_included
toggle setting is critical. Ensuring it correctly reflects the source document format is essential for accuratetax_amount
andtotal_exclusive
calculations at the line level, which then roll up to the header totals.
Understanding these calculations helps troubleshoot discrepancies between Zudello figures and the source document.
See also: Understanding How Line Totals/Taxes are Calculated (How-To) See also: Troubleshooting Tax Calculation Errors