# Foundation ERD

```mermaid
erDiagram
  COMPANY ||--o{ BRANCH : has
  COMPANY ||--o{ USER : employs
  COMPANY ||--o{ PARTY : registers
  PARTY ||--o{ PARTY_ROLE : has
  COMPANY ||--o{ ACCOUNT : owns
  FISCAL_YEAR ||--o{ ACCOUNTING_PERIOD : contains
  JOURNAL_ENTRY ||--|{ JOURNAL_LINE : contains
  ACCOUNT ||--o{ JOURNAL_LINE : posted_to
  PARTY ||--o{ JOURNAL_LINE : subledger
  PARTY ||--o{ CUSTOMER_INVOICE : billed
  PARTY ||--o{ VENDOR_BILL : supplies
  RECEIPT ||--o{ RECEIPT_ALLOCATION : allocates
  CUSTOMER_INVOICE ||--o{ RECEIPT_ALLOCATION : receives
  PAYMENT ||--o{ PAYMENT_ALLOCATION : allocates
  VENDOR_BILL ||--o{ PAYMENT_ALLOCATION : settles
  CUSTOMER_INVOICE ||--o{ CONTRA_SETTLEMENT : offsets_receivable
  VENDOR_BILL ||--o{ CONTRA_SETTLEMENT : offsets_payable
```

The full transport, contract, banking and reporting ERD is added module-by-module to avoid creating untested placeholder tables.
