Functional Weave
Code in Rust

finance.tax.vat-return@1.0.1

README.md

4,150 bytes · view raw

# finance.tax.vat-return

Status: needs review by a qualified accountant before it is published.

The nine boxes of a UK VAT return, totalled from the period's transactions. The
transactions arrive already categorised (the VAT on each is what was invoiced
or self-accounted), and this does the part that goes wrong in spreadsheets:
which box each kind of transaction feeds, credit notes, the reverse charge, and
the whole-pound boxes.

A transaction is in the period when its tax point (`date`) is on or after
`periodStart` and on or before `periodEnd`; the rest are left out, so a whole
ledger can be passed. Every transaction is still checked, in or out of the
period, and errors name it by its 1-based position.

| treatment | sale | purchase |
|---|---|---|
| `taxable` (standard, reduced or zero-rated) | box 1 VAT, box 6 net | box 4 VAT, box 7 net |
| `exempt` | box 6 net | box 7 net |
| `outside-scope` (not a supply: wages, grants, loans, dividends) | nothing | nothing |
| `domestic-reverse-charge` (construction, specified goods) | box 6 net | box 1 and box 4 VAT, box 7 net |
| `services-reverse-charge` (international services) | box 6 net | box 1 and box 4 VAT, boxes 6 and 7 net |
| `postponed-import-vat` | refused | box 1 and box 4 VAT, box 7 net |
| `ni-eu-goods` (Northern Ireland and the EU) | boxes 6 and 8 net | box 2 and box 4 VAT, boxes 7 and 9 net |

The mapping follows HMRC VAT Notice 700/12, "How to fill in and submit your VAT
Return", sections 3.2 to 3.10 (the boxes) and 4.6 (reverse charge: the supplier
fills in box 6; the customer boxes 1, 4 and 7, plus box 6 for gold and
international services), https://www.gov.uk/guidance/how-to-fill-in-and-submit-your-vat-return-vat-notice-70012,
read on 23 September 2026. Exempt, outside-scope, supplier-side reverse charge
and NI-to-EU sales must carry zero VAT, and a VAT figure on them is refused as a
miscategorisation.

**Credit notes** are negative transactions and reduce the boxes they would have
fed, as 3.2 and 3.5 require ("deduct any VAT on credit notes").

**Box 5** is the difference between boxes 3 and 4 without a sign, as the form
requires ("do not enter a minus sign in box 5"); `repayment` says which way it
goes.

**Boxes 6 to 9** are whole pounds. The pence are dropped after totalling (not
per transaction), truncating towards zero, so 999.99 of sales is 999 in box 6.
Notice 700/12 does not state the rounding for these boxes; dropping the pence is
the common practice and should be confirmed.

**Not covered.** Input VAT is taken as fully recoverable: partial exemption,
blocked input tax (business entertainment, most cars) and non-reclaimable
import VAT must be taken out of the purchase's `vat` before it is passed.
Special schemes (Flat Rate, see finance.tax.vat-flat-rate; cash accounting;
retail and margin schemes) change several boxes and are not applied here, nor
are bad debt relief, fuel scale charges or error corrections, other than by the
caller entering them as taxable sales or purchases. Amounts must be in GBP.

## Before you rely on this

**Not professional advice.** This capability calculates tax figures from published rules. It is a software component for developers, not tax advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed above, and have a chartered accountant or VAT specialist review how you use it, before anyone relies on the output. Provided "as is" under its licence, without warranty.

**Unreviewed.** This capability's implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified chartered accountant or VAT specialist has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.

1.0.1 marks it unreviewed. The code and the tests are unchanged.