Check invoice math
check_invoice_mathUse this when the user types or pastes invoice amounts (line quantities, unit prices, line amounts, subtotal, discount, tax, shipping, total) and wants to know whether the invoice adds up. Returns PASS, MISMATCH with the difference in cents, or NOT CHECKABLE when a value is missing, for three checks: lines add up to the subtotal, subtotal - discount + tax + shipping = total, quantity x unit price = amount. Uses integer cent math. Does not read files (use read_invoices for PDFs), does not compute tax rates, and does not pay or send anything.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tax | No | Amount as printed, e.g. 33.56. Leave out when the invoice has none. | |
| lines | No | Invoice lines, e.g. [{"description":"Toner","qty":2,"unit_price":"89.99","amount":"179.98"}]. Up to 500. | |
| total | No | Amount as printed, e.g. 440.29. Leave out when the invoice has none. | |
| discount | No | Amount as printed, e.g. 15.00. Leave out when the invoice has none. | |
| shipping | No | Amount as printed, e.g. 9.95. Leave out when the invoice has none. | |
| subtotal | No | Amount as printed, e.g. 406.73. Leave out when the invoice has none. | |
| decimal_mark | No | Decimal mark of the amounts: "." for 1,234.56 or "," for 1.234,56. Default: decided from the values. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | Yes | ||
| lines | Yes | ||
| checks | Yes | ||
| status | Yes | ||
| lines_sum | Yes | ||
| lines_count | No | ||
| computed_total | Yes |