# Invoice to Approved Draft

Supplier invoices arrive as PDFs and scans. Matching each against purchase orders and receipts, applying tolerances and chasing the genuine exceptions consumes most of an AP clerk's day.

## About this page
- Canonical: https://quarkcs.io/automation-blueprints/accounts-payable
- Type: AutomationBlueprint
- Published: 2026-09-06
- Updated: 2026-09-06

## Problem
Supplier invoices arrive as PDFs and scans. Matching each against purchase orders and receipts, applying tolerances and chasing the genuine exceptions consumes most of an AP clerk's day.

## Agent Loop
- Trigger: A supplier invoice lands in the AP inbox or is uploaded.
- Context: Purchase orders, goods receipts, supplier master, tax rules and tolerance policy.
- Agent: Extract line items and totals, identify the supplier, and propose a three-way match with a confidence score.
- Policy: Quantity and price tolerances, tax treatment and approval limits are enforced by rules, not by the model.
- Human checkpoint: Finance reviews only invoices that fall outside tolerance or fail to match.
- Action: Create the purchase invoice as a draft for posting.

## Tools
- extract_document
- read_purchase_order
- read_goods_receipt
- create_invoice_draft

## Flow
1. Invoice received
2. Extract lines and totals
3. Identify supplier
4. Three-way match
5. Apply tolerance rules
6. Review exception (human approval)
7. Create purchase invoice draft

## Systems
- Email
- ERPNext
- Framework M
- Object storage

## Framework M DocTypes
- Supplier
- Purchase Order
- Purchase Receipt
- Purchase Invoice
- File
