Cost Change Inbox
List Cost Changes
Lists cost change sets: every retroactive cost change that was staged for review or resolved, one row per triggering document event. A set carries the trigger (the bill, invoice or purchase order edit that fired it), the originating purchase order, the receipt date span of the stock it touches, the total delta split into still-on-hand and already-consumed, and the flags that shaped its routing.
Get Cost Change Summary
Returns the inbox headline figures: how many cost changes await review, the sum of their deltas, how many of them touch a closed or locked accounting period, and how many ledger entries are being held back until a decision is made (one per pending set - the triggering document's own journal entry does not generate until its cost change is resolved).
Get Cost Change
Returns one cost change set with its staged lines (one per FIFO layer: unit cost before and after, units on hand and already consumed at staging time, the original receipt date), its decision history, the restate-versus-prospective impact comparison (`impact`, the same payload as Get Impact Preview) and `what_changed` - every cost document on the originating purchase order, dated both by document date and by the day it was entered, so the delta can be read against its sources. `what_changed` is null when the trigger cannot be traced back to a purchase order.
Get Impact Preview
Returns the side-by-side comparison a reviewer decides from. Each row in `periods` is one accounting month with what each convention books there: restating puts the delta back where the stock was received (`restate_valuation_impact` on Inventory for every unit received, then each unit already sold moves from Inventory to cost of goods in the month it shipped, as `restate_cogs_impact`), while going forward books the whole delta as one dated catch-up (`prospective_impact`, split into `prospective_valuation_impact` and `prospective_cogs_impact`). Both sides add back to the set's total delta. `locked` and `closed` mark the period's accounting status; `clamped_to` is the first open day a locked period's write would be displaced to.
List Cost Change Usages
Returns the usages behind the set's 'already consumed' figure: for each staged line, the sales orders, assemblies and transfers that drew units from that receipt, the units each took, and what this change does to the cost of goods each carries (`cogs_delta`). Results are keyed by line ID.
Get Impact Tree
Returns one FIFO layer's cost genealogy for the change: what valued it (the purchase order's base cost, then every invoice, bill and correction that reached the line, stepping the unit cost from before to after), where its units are (still on hand, or consumed by sales orders, assemblies and transfers), the layers built from it (kits, with their own usages) and the accounting month each part lands in under either dating (`lands.restate` and `lands.prospective`, each with the period, day, account and period status: open, closed or locked).
Get Decision Impact
Previews what a decision does to the books before it is made. `to` names the target: `restate` or `prospective` (apply a pending change that way, or switch an applied one), or `revert` (unwind an applied change back to the inbox, or reopen a dismissed one). `action` is what would actually happen for this set's current state - apply, switch, revert, reopen, or none - and `allowed` with `reason` says whether it may proceed.
Apply Cost Change
Applies a cost change awaiting review, writing the staged deltas onto the affected FIFO layers, re-costing anything built or transferred from them, and posting the revaluations to the ledger. The cost is re-derived from the live documents at apply time, so a stale preview never produces a stale write.
Dismiss Cost Change
Dismisses a cost change awaiting review without applying it. The staged deltas are discarded from the queue, the affected layers keep their current cost, and the triggering document's held ledger entry is released. A dismissed change can be brought back to the inbox with Revert Cost Change.
Switch Cost Change Resolution
Switches an applied cost change between restate and going forward. Every revaluation the change produced is re-dated to the new convention (and its ledger entries with it), rather than reversed and re-posted, so the cost history stays attributable to this one decision. Switching to the resolution the change already carries is a no-op.
Revert Cost Change
Returns an applied or dismissed cost change to the inbox. For an applied change, every revaluation it produced is reversed, anything re-costed downstream is unwound, and the set is re-staged for review with a fresh preview; posted ledger entries are reversed and drafts discarded. For a dismissed change the set is simply reopened.
Bulk Resolve Cost Changes
Resolves several cost changes in one call, oldest-first so that overlapping changes apply in the order they were staged. Every action is state-aware and never fails the batch outright: each selected set is either resolved, skipped with a reason, or failed with an error, and the response lists all three.
Get Bulk Decision Impact
Returns the decision-impact preview for a selection: one block per set (the same shape as Get Decision Impact, in oldest-first order) plus `totals` across them - how many sets are allowed to proceed, how many ledger entries are touched and their total amount, the provider-side voids and updates, the period batches that would be re-sent, and how many writes a locked period displaces. Use it to confirm a bulk switch or revert with the whole picture in view.
Get Cost Change Policy Settings
Returns the routing policy for retroactive cost changes: per trigger type, whether a change applies immediately or is held in the inbox for review, and which resolution an automatic application uses. These rules decide routing only - every change stays an individually dated revaluation and any held set can still be resolved either way by a person.
Update Cost Change Policy Settings
Replaces the routing policy for retroactive cost changes and returns the effective settings (same shape as Get Cost Change Policy Settings). `trigger_policies` must be present; every trigger you include needs all four rule fields, and triggers you omit fall back to their defaults. Unknown trigger keys are rejected.