Skip to main content
Version: Current

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 the total values on the document lines include tax (TRUE) or exclude tax (FALSE).

Calculated Fields:

Zudello automatically calculates and stores these values:

  1. Line Tax Amount (tax_amount): The tax portion for the line.

    • If tax_included is TRUE: Tax is backed out: tax_amount = total - (total * 100 / (100 + tax_rate.rate))
    • If tax_included is FALSE: Tax is added: tax_amount = total * tax_rate.rate / 100
    • Defaults to 0 if tax_rate is missing.
  2. Line Total Exclusive (total_exclusive): The line total before tax.

    • If tax_included is TRUE: total_exclusive = total - tax_amount
    • If tax_included is FALSE: total_exclusive = total
  3. 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 calculated total_exclusive (if tax_included is TRUE) or the total (if tax_included is FALSE).
    • If determined exclusive: unit_price_exclusive = unit_price
    • If determined inclusive: unit_price_exclusive = unit_price - (tax_amount / quantity)
  4. Line Total (total) - Recalculation: If quantity and unit_price are present, Zudello often recalculates the line total as quantity * unit_price. The interpretation of whether this recalculated total includes tax depends on the tax_included flag.

Key Factor:

  • The tax_included toggle setting is critical. Ensuring it correctly reflects the source document format is essential for accurate tax_amount and total_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