This article walks through configuring a line item builder in detail — defining columns, calculations, validation and UI behaviour.
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.