System formula reference

Every formula the app computes with, generated from the modules that own the maths.

System formula reference

Generated by scripts/sync_docs.py. Edit the module, not this page — a
hand-edited formula here would drift from the code it describes.

Tax

Sales tax on the CONTRACTOR's own price.

This is a different question from the tax field kept on
scope_parser.models.LineItem -- that one is the carrier's own
estimate-internal tax figure, parsed only so the totals-consistency check
can use it, and never touched by this module. What this module answers
is: given the price the contractor is quoting, what (if anything) do
they need to charge the client in sales tax, on THIS job, in Texas --
which depends entirely on how the contract itself is written, not on
anything the carrier printed.

Rules come from the Texas Comptroller's own guidance (Publication 94-116)
on real property repair and remodeling, and are explained at length in
the project's "Known parsing problems / legal issues" doc, problem #4,
and in the "Claim Ledger" reference artifact:

  • Separated contract, residential: materials and labor are billed as
    separate line items. Tax is owed on materials only; labor on a
    residential job is never taxed, under either contract type.
  • Lump-sum contract, residential: one price for the whole job. The
    contractor pays tax when buying materials and does NOT separately
    itemize tax back to the client -- there is no client-facing tax line
    at all, even though tax was effectively paid.
  • Commercial / nonresidential: the entire charge -- materials AND
    labor -- is taxable, regardless of how the contract is written.
  • No sales tax: for anything outside Texas, or a tax-exempt situation
    (a contractor should confirm this with their own state's rules --
    this module only encodes the Texas residential/commercial split).

This is deliberately NOT a default-on behavior anywhere it's called from
(see /api/totals) -- a contractor has to pick a rule
before any tax gets added, so nothing changes silently for existing
quotes. (The quote-side document uses a flat material rate instead; see
quote.tax_rate_percent.)

  • tax.COMMERCIAL = commercial
  • tax.DEFAULT_TEXAS_RATE_PCT = 8.25
  • tax.ITEMIZES_TAX = {'commercial', 'separated_residential'}
  • tax.LUMP_SUM_RESIDENTIAL = lump_sum_residential
  • tax.NONE = none
  • tax.SEPARATED_RESIDENTIAL = separated_residential
  • tax.TAX_RULE_LABELS = {'separated_residential': 'Separated contract, residential (tax on materials only)', 'lump_sum_residential': 'Lump-sum contract, residential (tax not billed separately)', 'commercial': 'Commercial / nonresidential (tax on materials and labor)', 'none': 'No sales tax'}
  • tax.TAX_RULE_OPTIONS = ['none', 'separated_residential', 'lump_sum_residential', 'commercial']

Customer financing

Standard amortisation, monthly rate r = annual rate / 12 / 100:

P = r * PV / (1 - (1 + r) ** -n)
  • financing.DEFAULT_ANNUAL_RATE_PCT = 9.99
  • financing.DEFAULT_TERM_MONTHS = 60
  • financing.MIN_PRINCIPAL = 500.0

Found something out of date? The guides live in the repository's docs/ directory — fixing the guide is part of fixing the feature.