app.invoice_matches
TableRow level security on
Three-way matches of a payable invoice to a purchase order and a goods receipt (invariant 17). A receipt matches one invoice once; the variance is derived in app.invoice_match_results, and a payable invoice with an unresolved mismatch is never approved.
Primary key: id
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | uuid | No | Primary key, UUID v7. |
| org_id | uuid | No | Owning org, derived from app.invoices on insert; never accepted from the caller and never changed.References app.organizations.id |
| invoice_id | uuid | No | Payable invoice matched.References app.invoices.id |
| purchase_order_id | uuid | No | Purchase order the invoice bills.References app.purchase_orders.id |
| goods_receipt_id | uuid | No | Receipt of that order the invoice bills. A receipt is matched once.References app.goods_receipts.id |
| resolution_note | text | Yes | Why a mismatch is accepted, recorded by someone other than the matcher. |
| resolved_by | uuid | Yes | Person who accepted the mismatch.References app.people.id |
| resolved_at | timestamp with time zone | Yes | When the mismatch was accepted. |
| deleted_at | timestamp with time zone | Yes | Soft delete time. A row with deleted_at set is ignored by every access helper. |
| created_at | timestamp with time zone | No | When the row was inserted. Set by the database. |
| created_by | uuid | Yes | Person who inserted the row, or null for a platform process. Set by the database.References app.people.id |
| updated_at | timestamp with time zone | No | When the row last changed. Set by the database. |
| updated_by | uuid | Yes | Person who last changed the row, or null for a platform process. Set by the database.References app.people.id |