# Catch supplier billing errors in ERPNext before you pay

> Every Monday, check last week's supplier bills against what you ordered and what actually arrived, then get a Slack digest of every overcharge.

- Workflow type: agent
- Services: ERPNext, Slack Bot
- Categories: Finance, Operations
- Published: 2026-08-14

## What it does

- Reviews every supplier bill your team posted in the last seven days
- Compares each billed line against the price you agreed to pay and the quantity you actually received
- Flags three problems: billing above the agreed price, billing for more than was delivered, and spend with no purchase order behind it
- Posts one Slack digest grouped by supplier and ranked by money at risk, with a short all clear note when everything checks out

## What you'll need

- An ERPNext account that can read your supplier bills, purchase orders, and goods receipts
- A Slack workspace with a channel for your finance team
- Purchase orders and receipts recorded in ERPNext, so bills have something to be checked against

## Prompt

Every Monday at 8am, audit last week's supplier bills in ERPNext for billing errors before we pay them. This is the classic finance three-way match control: the invoice against the purchase order we raised, against the purchase receipt confirming what actually arrived. Keep the whole workflow read-only against ERPNext. Submitted documents cannot be edited or deleted without cancelling them first, so report discrepancies only and never modify, cancel, or approve a posted invoice.

Start with the ERPNext List Documents action on the Purchase Invoice DocType. Filter to docstatus = 1 so only real, posted bills are audited (0 is Draft, 1 is Submitted, 2 is Cancelled), and to a posting_date inside the last 7 days. Filters are JSON arrays of [field, operator, value] triples that are AND-combined, for example [["docstatus","=",1],["posting_date",">=","2026-08-07"]]. The fields parameter defaults to just ["name"], so request the columns explicitly: name, supplier, posting_date, grand_total, and currency. Page through the results if there are more than one page of them.

For each invoice returned, call Get Document on the Purchase Invoice by name, because the line items live in a child table that only comes back on the single document read. Each item row carries links back to the originating Purchase Order and Purchase Receipt. Call Get Document again on those linked Purchase Order and Purchase Receipt documents so you can read the rate we agreed to pay and the quantity we actually received. Cache documents you have already fetched, since several invoice lines often point at the same purchase order.

Compare every billed line against those two sources and flag three things: a billed rate higher than the purchase order rate, a billed quantity greater than the quantity received, and any invoice with no purchase order linked at all, which is off-contract spend. Matching invoice lines to the right purchase order lines is judgement work: match on item code first, then fall back to description and unit of measure when codes do not line up, and say so in the report when you are unsure which line a charge belongs to. Convert quantities to a common unit of measure before comparing, so a case billed against units ordered does not read as a false discrepancy. Ignore trivial rounding differences under 1 percent so the report stays signal-heavy.

Group the findings by supplier and rank the suppliers by total money at risk, which is the summed value of the overcharges and the over-billed quantities, plus the full value of any invoice with no purchase order behind it. Within each supplier, put the largest exposure first.

Post one digest to our finance channel using the Slack Bot Send a Message action. Open with the total money at risk, the number of invoices reviewed, and the worst supplier. Then list each supplier with their offending invoices, naming the invoice id, the supplier, and the specific mismatch on each offending line: show the billed figure next to the expected figure and the difference in money, and label which of the three problems it is. Keep it scannable for a finance lead who has to act on it in a couple of minutes. If every invoice checks out, post a short all-clear note saying how many invoices were reviewed and that no discrepancies were found, rather than staying silent.

## How to customize

- Change the day and time it runs, or widen the review window beyond the last seven days
- Adjust the tolerance so small differences stay out of the report (it starts at 1 percent)
- Send the digest to a different channel, or straight to your finance lead as a direct message
- Add your own rules, such as always flagging any single bill above a set amount

## FAQ

### What is a three-way match?

It is the standard finance check before paying a supplier: the bill has to agree with the purchase order you raised and with the goods receipt confirming what actually turned up. If all three line up, the bill is safe to pay. If they do not, someone is being charged for the wrong price, the wrong quantity, or something never ordered.

### Will this change or cancel any of my bills in ERPNext?

No. It only reads your records and reports what it finds. Nothing is edited, approved, cancelled, or paid, so it is safe to run against live accounts.

### What happens when a bill has no purchase order attached?

It gets flagged as off contract spend. That is often the most valuable finding, because it means something was bought without going through your normal approval process.

### Will it message me even when nothing is wrong?

Yes. A clean week gets a short all clear note saying how many bills were reviewed, so you always know the check actually ran rather than wondering about silence.

### Will small differences flood the report?

No. Differences under 1 percent are treated as rounding noise and left out, so what reaches your finance channel is worth someone's attention. You can raise or lower that tolerance.

### Does this work with a self hosted ERPNext site?

Yes. It works with ERPNext in the cloud or on your own servers, as long as the account you connect can read purchasing and supplier billing records.

Use this prompt in General Input: https://www.generalinput.com/prompts/catch-supplier-billing-errors-in-erpnext-before-you-pay