ActiveManage Docs ← Back to activemanage.co.uk

Line Item Builders

Introduction to Line Item Builders

A line item builder is a specialised dynamic form component for capturing repeating, calculated rows — invoices, quotes, purchase orders, expense claims, anything with multiple priced or measured items. It handles the math (subtotals, taxes, totals) and the UX (add/remove rows, reorder) so you don't reinvent the wheel.

Invoice form with line item builder: rows for Product (autocomplete), Qty, Unit Price, Line Total (auto-calculated), Discount %, Tax Rate; running subtotal, tax total, grand total at the bottom updating live

What Makes It Different

You could implement an invoice form with a generic dynamic add field, but line item builders are purpose-built:

  • Per-row calculations: Line total computed as qty × unit price, automatically updated.
  • Tax handling: Per-line tax rate, with tax-inclusive or tax-exclusive logic.
  • Discounts: Per-line, plus optional cart-level discount.
  • Multi-currency: Each line in its own currency, totals normalised.
  • Product picker: Autocomplete from a Products datastore, autofilling price and description.
  • Reorderable: Drag to reorder for presentation.

Where to Use Them

  • Invoices: Line items, taxes, discounts, totals.
  • Quotes: Optional items, discounts, presentation order.
  • Purchase orders: SKU, supplier price, quantity, delivery date.
  • Expense claims: Date, description, receipt, amount, currency.
  • Service orders: Service code, technician, hours, rate.

Worked Examples

  • Multi-currency invoice: Line 1 in USD, Line 2 in EUR; totals normalised to GBP for display.
  • Quote with optional items: Each line has “Required / Optional” flag; total computed differently per scenario.
  • Service order: Service code dropdown autofills rate; technician picker filtered to qualified technicians.
  • Expense claim: Each line is a receipt — amount + currency + photo upload — totals converted to home currency at the day's rate.

Configuring Line Items

This article walks through configuring a line item builder in detail — defining columns, calculations, validation and UI behaviour.

Line item builder configuration: column list (Product, Qty, Unit Price, Line Total auto-calculated, Discount, Tax Rate, Notes); options for min/max rows, reorder enabled, product picker source datastore, calculation formulas

Configuration Areas

  • Columns: What each line has — typically a product, quantity, price, calculated total.
  • Calculations: Formulas for derived columns and document totals.
  • Constraints: Min/max rows, required columns, allowable values.
  • UI: Reorder, delete confirmation, “Add row” button label, column widths.
  • Source: If picking from a products list, the source datastore and filter rules.
  • Storage: Whether lines are stored as JSON on the parent record or as related child records.

Calculation Examples

  • Line total: qty * unit_price * (1 - discount/100).
  • Line tax: line_total * tax_rate / 100.
  • Subtotal: SUM(line_total) across all rows.
  • Tax total: SUM(line_tax).
  • Grand total: subtotal + tax_total - cart_discount.

Validation Rules

  • Quantity must be a positive integer.
  • Unit price within a permitted range (e.g. between zero and 1,000,000).
  • Discount between 0 and 100%.
  • Tax rate within allowed jurisdictions.
  • At least one line required.
  • If using a product picker, only allow products in the selected catalogue.

Worked Examples

  • Basic invoice: Columns Product, Qty, Unit Price, Line Total auto. Required: 1 row min.
  • Quote with multi-tier pricing: Columns include Tier (dropdown), with calculation that picks unit_price from a tier table based on quantity.
  • Expense claim: Columns Date, Description, Amount, Currency, Receipt File — no auto-calc; lines summed at submission.
  • Subscription quote: Per-line cycle (monthly/annual) and number of months; total computed accordingly.

Pricing and Totals

Pricing and total calculations sit at the heart of every line-item-driven document. Get them right and your invoices are trustworthy and accurate; get them wrong and you have a financial mess. This article covers the most common patterns.

Invoice summary block at the bottom of an invoice form showing: Subtotal £1,250.00, Cart-level discount -£100.00, VAT @ 20% £230.00, Total £1,380.00, with running tooltips on each calculation

Order of Operations

A typical calculation order:

  1. For each line: compute line total = qty × unit_price × (1 - line_discount).
  2. Subtotal = sum of line totals.
  3. Apply cart-level discount (fixed or percentage) to the subtotal.
  4. Compute tax — either per-line (then summed) or on the discounted subtotal.
  5. Grand total = discounted subtotal + tax.

Tax Modes

  • Tax-exclusive: Tax added on top. Most common in B2B.
  • Tax-inclusive: Tax baked into unit price; subtotal and total are the same, with tax shown as “of which X is VAT”.
  • Mixed: Some lines inclusive (consumer items), others exclusive (services) — unusual but supported.

Rounding

  • Round each line total to 2 decimals (or 4 for high-precision currencies).
  • Sum the rounded line totals — gives stable subtotal.
  • Round the final total once at the end (avoids cumulative rounding error).
  • Match the rounding mode (half-up vs half-even) to your accounting standards.

Worked Examples

  • UK B2B invoice: Two lines £500 + £750, 10% cart discount, 20% VAT exclusive. Subtotal £1250; after discount £1125; VAT £225; total £1350.
  • EU consumer (tax-inclusive): Two lines €120 + €60. Subtotal €180; “of which €30 is VAT (@ 20%)”.
  • Multi-currency quote: Three lines in USD, two in EUR. Each line total in its own currency. Final total normalised to client's home currency using today's FX rate, with rate captured in the saved record.
  • Discount-then-tax vs tax-then-discount: Same gross figures, different tax outcomes — choose the order that matches your jurisdiction's rules.
Warning: Always store the underlying line items, not just the totals. If a tax rate later changes you can recalculate; if you only kept the totals you lose precision and audit trail.