ProcurementExpress invoice management via CLI. Covers creating, updating, accepting, approving, rejecting, cancelling, archiving invoices, and adding comments. Handles the full invoice lifecycle from receipt through approval to settlement. CLI commands: pex invoice list|show|create|update|accept|approve|reject|cancel|archive| dearchive|rerun-flow. Also: pex comment add-invoice. Triggers on: invoice, bill, invoice approval, invoice status, awaiting review, outstanding invoice, ready to pay, invoice comment, invoice line items.
Authenticate and set active company first (pex:setup skill).
pex invoice list --status=outstanding --page=1 --per-page=20
pex invoice list --search="INV-001" --supplier-id=10
pex invoice list --date-filter="last 30days" --sort=invoices.created_at --direction=desc
pex invoice list --department-id=5 --archived --sage-exported
pex invoice show 456
awaiting_review, outstanding, ready_to_pay, settled, cancelled
last 7days, last 30days, last 60days, last 90days, last 180days, last 1year, current_month, , ,
current_yearlast_monthlast_yearIMPORTANT: Invoices should ALWAYS include --line-items with at least one line item.
This applies to both standalone invoices and PO-linked invoices.
# Standalone invoice (not linked to any PO)
pex invoice create \
--invoice-number="INV-2024-001" \
--supplier-id=10 \
--issue-date="2024-03-01" \
--due-date="2024-04-01" \
--gross-amount=5000 \
--currency-id=1 \
--standalone \
--line-items='[
{"description":"Office supplies","unit_price":100,"quantity":50}
]'
# PO-linked invoice
pex invoice create \
--invoice-number="INV-2024-002" \
--supplier-id=10 \
--issue-date="2024-03-01" \
--due-date="2024-04-01" \
--gross-amount=6000 \
--currency-id=1 \
--po-ids=123,456 \
--line-items='[
{"description":"Laptops","unit_price":1200,"quantity":5,"purchase_order_id":123,"purchase_order_item_id":200}
]'
--invoice-number: invoice reference number--supplier-id: supplier ID--issue-date, --due-date, --uploaded-date, --received-date, --validation-date: date fields--gross-amount: total gross amount--currency-id: currency ID--standalone: flag for invoices not linked to any PO--po-ids: comma-separated PO IDs to link (for PO-linked invoices)--payment-term-id: from company settings--sage-exported: mark as exported to Sage--confidence-score: AI extraction confidence score--digital-invoice: mark as digital invoice--line-items: required — JSON array of line items (see fields below)--custom-fields: JSON array of [{"value":"x","custom_field_id":1}]--uploads: JSON array of supplier invoice uploads [{"file":"..."}]Each line item object supports:
description (required), unit_price (required), quantity (required)vat, net_amount, sequence_notax_rate_id, chart_of_account_id, qbo_customer_id, quickbooks_class_idpurchase_order_id, purchase_order_item_id — link to specific PO line itembillable_status — for QuickBookstax_exception — exempt from tax calculationcustom_field_values_attributes: [{"value":"x","custom_field_id":1}]pex invoice update 456 --invoice-number="INV-2024-001-R" --due-date="2024-05-01"
pex invoice update 456 --line-items='[{"id":200,"quantity":10},{"id":201,"_destroy":true}]'
pex invoice accept 456 # awaiting_review → outstanding
pex invoice approve 456 # outstanding → ready_to_pay
pex invoice reject 456 # → rejected
pex invoice cancel 456 # → cancelled
pex invoice archive 456 # archive
pex invoice dearchive 456 # restore from archive
pex invoice rerun-flow 456 # rerun approval flow when rules changed
awaiting_review → accept → outstanding → approve → ready_to_pay → payment → settled
→ reject → rejected
→ cancel → cancelled
pex comment add-invoice 456 --comment="Payment scheduled for next week"
id, invoice_number, status, gross_amount, net_amount, balance_amountissue_date, due_date, supplier, currencystandalone_invoice — whether linked to POsconfidence_score, digital_invoice — AI extraction infoinvoice_line_items[] — line items with amountspurchase_orders[] — linked PO summariescomments[], histories[] — comments and status historynpayments[] — payment recordscan_accept, can_approve, can_reject, can_cancel, can_archive, can_dearchive