Skip to content

Purchase costs and project allocation

A purchase cost retains one supplier-invoice identity while management allocations attribute its net cost to projects or an explicit common-cost account. The allocation is separate from AP approval, supplier payment and the original invoice’s accounting dimensions. Showing a supplier invoice on three projects must not make the company incur its cost three times.

The office queue and review flow use the same cost identity and original viewer. Document intake can route a candidate into that flow; opening or previewing it does not create another financial document. The owning purchase-cost contract retains the existing eligible positive, uncancelled net basis rather than defining new credit, foreign-exchange or overhead formulas.

Record or input Responsibility Boundary
Supplier invoice and approval versions Financial source and immutable reviewed AP facts Management allocation does not rewrite approval evidence
Native or preserved provider rows Signed source amounts and accounting dimensions Coded rows take precedence over suggestions
Explicit remainder Net amount not explained by structured sources Must be reviewed; no invented row-level evidence
Allocation rows Source-key shares to projects/common cost Whole replacement validates signed source limits and net total
Review revision and source fingerprint Identify the exact reviewed allocation/source basis Stale source or allocation returns conflict
Original and analysis version Evidence for a proposal and confirmation A model proposal is not an accepted split
Duplicate decision Identify one canonical cost while retaining provenance Ambiguous/human-reviewed records do not merge automatically

Saving requires principal staff, invoice read/update capabilities, the active company, that company’s invoice and an active actor. The SQL operation checks revision, source fingerprint, valid project/account targets, signed limits and duplicate acknowledgement. It replaces allocations and records review history together. Direct browser writes to the underlying allocation tables/functions are refused.

Completeness is measured per source. An unassigned positive row and discount cannot cancel into a false complete state merely because their net remainder is zero. Partial known shares remain traceable; project margin coverage is withheld where the required allocation is incomplete. Financial/source edits invalidate older allocation facts; a payment observation alone does not change the financial basis.

The existing conflict correction raises the business exception with ordinary P0001 semantics so PostgREST does not repeatedly retry it as a serialization failure. The API returns a recoverable 409. The editor retains local work and asks for current review rather than silently advancing the expected revision.

The original viewer rechecks invoice/file or candidate ownership before retrieving recognized bytes. A historical file without a stored hash is not automatically redownloaded to make the documentation look complete. Missing structured row evidence can leave one manual remainder source.

Exact supplier/reference/amount/currency or byte-identical evidence can converge unreviewed duplicates under the owning rules. A previously confirmed human allocation is not discarded by an automatic merge. An explicit duplicate decision retains source keys and originals while preventing duplicate financial contribution.

AI suggestions remain optional. Exact text/project-number evidence can support a proposal; repeated descriptions, conflicting original evidence or indirect matches require a decision. Pilot strength labels are ordinal evidence descriptions, not calibrated probabilities. Group review preserves per-invoice atomicity and receipts; later failure does not roll back earlier confirmed invoices.

A supplier invoice has eligible net cost 1,000 SEK. Staff allocate 600 to Project A, 300 to B and 100 to a common-cost account. Each project’s cost view shows its share; the purchase dataset counts the original 1,000 once. No customer invoice, supplier payment or wage transaction is created.

If the source changes after review, submitting the old fingerprint must be refused. Staff retain the proposed shares and compare the new original/source amounts. Reports must expose the resulting coverage rather than invent complete profitability.

Route and deterministic review tests specify scoped refusal, conflict mapping and source proposals. Local SQL tests establish replacement/history invariants; named shared receipts establish only their recorded allocation and original-viewing scenarios. Revised cost/margin definitions and broader financial acceptance remain separate work.