- Expand BAS reference from ~180 to ~1,276 accounts (full BAS Kontoplan 2026) with K2 exclusion flags, per-class data files, and computed SRU codes - Evolve invoice inbox into unified document inbox handling invoices, receipts, and government letters with AI-powered classification (Claude Haiku Vision) - Add multi-pass document-to-transaction matching engine with greedy assignment for both supplier invoices (reference/amount/date/name) and receipts (weighted amount/merchant/date scoring) - Add supplier invoice matching in transaction ingest pipeline - Inject booking template suggestions into AI extraction prompts - Surface matched documents in swipe categorization UI with one-tap booking - Auto-activate missing BAS accounts during SIE import against full reference - Add K2 filter toggle in Chart of Accounts manager - Add receipt confirmation route with BFNAR representation fields - Add database migrations for K2 support and document matching columns - Remove obsolete extension migration scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
24 lines
1.1 KiB
SQL
24 lines
1.1 KiB
SQL
-- Document matching: add columns to invoice_inbox_items for transaction matching
|
|
-- and AI template suggestions.
|
|
|
|
-- Suggested booking template from AI extraction
|
|
ALTER TABLE public.invoice_inbox_items
|
|
ADD COLUMN suggested_template_id TEXT,
|
|
ADD COLUMN suggested_template_confidence NUMERIC;
|
|
|
|
-- Matched bank transaction
|
|
ALTER TABLE public.invoice_inbox_items
|
|
ADD COLUMN matched_transaction_id UUID REFERENCES public.transactions(id) ON DELETE SET NULL,
|
|
ADD COLUMN match_confidence NUMERIC,
|
|
ADD COLUMN match_method TEXT CHECK (match_method IN ('payment_reference', 'amount_date', 'amount_merchant', 'receipt_match'));
|
|
|
|
-- Index for looking up which inbox item is matched to a transaction
|
|
CREATE INDEX idx_inbox_items_matched_transaction
|
|
ON public.invoice_inbox_items (user_id, matched_transaction_id)
|
|
WHERE matched_transaction_id IS NOT NULL;
|
|
|
|
-- Index for finding unmatched ready items for sweep
|
|
CREATE INDEX idx_inbox_items_unmatched_ready
|
|
ON public.invoice_inbox_items (user_id, status)
|
|
WHERE matched_transaction_id IS NULL AND status IN ('ready', 'processing');
|