21 — Tax

Tax settings, rates, per-tenant config

CEO Summary

Tax settings determine how sales tax is calculated and reported. Per-tenant config. Business value: Compliance with local tax laws. Key metrics: Tax collected, accuracy. If this breaks: Incorrect tax on invoices; reporting errors.

Architecture

flowchart TB subgraph pos [POS / Invoicing] Cart[Cart] Inv[Invoice] end subgraph tax [Tax] TS[taxSettings.service] TR[taxSettings.routes] HR[hr/taxRates] BTI[hr/businessTaxInfo] end subgraph db [Tenant DB] TaxSettings[(tax_settings)] HRTables[(hr tables)] end Cart --> TS Inv --> TS TR --> TS HR --> HRTables BTI --> HRTables TS --> TaxSettings

Overview

Two tax domains: (1) Sales tax — POS, invoicing. (2) Payroll tax — HR.

File Structure

backend/
├── routes/
│   └── taxSettings.routes.js
├── services/
│   ├── tax.service.js
│   └── taxSettings.service.js
├── routes/hr/
│   ├── taxRates.routes.js      # Payroll tax rates
│   └── businessTaxInfo.routes.js
└── services/hr/
    ├── taxRates.service.js
    └── businessTaxInfo.service.js

Conventions

TermMeaning
priceCents, taxCentsAll amounts in cents
taxRateBpsBasis points (100 = 1%)

POS Integration

Cart has taxRateBps. Invoice stores tax_cents. Tax settings drive default rate per tenant/location. See 06 — POS & Invoicing.

HR Tax

taxRates: Payroll tax rates.

businessTaxInfo: Business tax info (EIN, etc.).

W-4: w4.service.js — employee withholding.

See 10 — HR & Payroll.

Integration Points

SystemConnection
POSCart taxRateBps, Invoice tax_cents
InvoicingcoreInvoicing.service, invoicingConfig
HRPayroll tax, W-4, business tax info

Key Paths

PathPurpose
backend/services/taxSettings.service.jsSales tax settings
backend/config/invoicingConfig.jsTax defaults