Section 3

Workflow and records

Six steps from purchase order to payment. Each step names who acts, what starts it, what it does, how it ends, and the records it owns. A record has exactly one owning step; other steps and other modules only read it or hand it postings.

  1. ST-1Buyer, then an approver by amount

    Raise and approve the purchase order

    The buyer creates the order. It routes for approval by order total, then is sent to the vendor.

    Starts
    A replenishment need or an approved request.
    Ends
    Order approved and sent.
    Owns
    Purchase orderOrder lineApproval record
    Reads: Vendor (vendor master); Item (item master)
  2. ST-2Receiver

    Receive the goods

    The receiver counts what arrived and posts it against the open order lines. Stock and the receipt accrual post in the same transaction.

    Starts
    A delivery arrives at the dock with a packing slip.
    Ends
    Lines received in full, or in part with the rest left open.
    Owns
    Goods receiptReceipt line
    Hands off: Inventory transaction (Inventory); Receipt accrual journal (Finance)
  3. ST-3AP clerk

    Capture the invoice and check for duplicates

    The clerk keys the header and lines against the order. The duplicate check runs before the invoice can be saved as payable.

    Starts
    An invoice arrives by mail, email or the vendor portal.
    Ends
    Invoice accepted for matching, held as a possible duplicate, or blocked.
    Owns
    Vendor invoiceInvoice lineDuplicate check
  4. ST-4System

    Three-way match

    Each invoice line is compared with its order line (price) and the receipts so far (quantity). Lines outside tolerance open a hold with the exact variance.

    Starts
    An invoice is accepted, or a receipt, order change or credit memo touches a held invoice's order.
    Ends
    Matched, or on hold with an owner.
    Owns
    Match resultHold
  5. ST-5System, or the AP lead after an override

    Approve for payment

    A clean match approves itself for payment. The due date comes from the vendor's terms and the invoice date.

    Starts
    The invoice has no open holds.
    Ends
    Approved, with a due date.
    Owns
    Payment approval
    Hands off: Payable journal (Finance)
  6. ST-6AP lead proposes, Treasury releases

    Pay

    The AP lead proposes a payment run. Treasury reviews and releases it; the bank file and remittance go out.

    Starts
    Approved invoices fall due within the run window.
    Ends
    Paid, with remittance sent to the vendor.
    Owns
    Payment runPayment
    Hands off: Cash journal (Finance); Bank payment file (bank integration)

State diagrams

Every state an order or invoice can be in, and every way between them. Numbers match the table; the rule column links to the rule that governs the move. Both diagrams are generated from spec/workflow.yaml, with editable Mermaid sources.

Purchase order

Mermaid source
12345678910DraftPending approvalApprovedPartially receivedReceivedClosedCancelledClosed short
#FromToWhenRule
1DraftPending approvalsubmit
2Pending approvalApprovedapproveBR-02
3Pending approvalCancelledreject
4ApprovedPending approvalmaterial changeBR-03
5ApprovedPartially receivedpartial receipt
6Partially receivedReceivedrest received
7ApprovedReceivedfull receipt
8Partially receivedClosed shortclose shortBR-06
9ReceivedClosedfully billed
10Closed shortClosedbilled to received

Vendor invoice

Mermaid source
1234567891011CapturedDuplicate checkMatchingMatchedApproved for paymentPaidBlocked duplicatePossible duplicateOn holdQTY · PRICE · NO RECEIPTRejected
#FromToWhenRule
1CapturedDuplicate checksave
2Duplicate checkMatchingunique
3Duplicate checkBlocked duplicateexact matchBR-08
4Duplicate checkPossible duplicatenear matchBR-09
5Possible duplicateMatchingAP lead clears
6MatchingMatchedwithin tolerance
7MatchingOn holdoutside (BR-10BR-10
8On holdMatchingre-matchBR-12
9On holdRejectedvendor reissues
10MatchedApproved for paymentautoBR-13
11Approved for paymentPaidrun releasedBR-14

Records

The records this workflow owns, with their key fields. The audit entry is owned by the platform and written by every step.

RecordOwned byKey fields
Purchase orderST-1po_no, vendor_id, buyer_id, terms, currency, total, revision, status
Order lineST-1po_no, line_no, item_id, qty_ordered, unit_price, qty_received, qty_billed, qty_closed_short, status
Approval recordST-1document, revision, tier, approver_id, decision, decided_at
Goods receiptST-2gr_no, po_no, packing_slip, received_by, received_at
Receipt lineST-2gr_no, po_line, qty, location, lot
Vendor invoiceST-3inv_id, vendor_id, vendor_invoice_no, normalized_no, invoice_date, gross_amount, status, captured_by
Invoice lineST-3inv_id, line_no, po_line, qty_billed, unit_price, amount
Duplicate checkST-3inv_id, rule, matched_inv_id, outcome, checked_at
Match resultST-4inv_line, qty_variance, price_variance, variance_pct, outcome
HoldST-4hold_id, inv_id, type, opened_at, owner_role, released_at, released_by, reason
Payment approvalST-5inv_id, approved_by, approved_at, due_date, override
Payment runST-6run_id, proposed_by, released_by, second_approver, total, status
PaymentST-6pay_id, run_id, vendor_id, amount, method, invoice_ids
Audit entryevery stepentity, entity_id, from_state, to_state, actor, at, reason