Functional Weave
Code in Python

Suites · uk-tax

UK VAT and tax basics

UK VAT by the rate in force on the date of supply: add, remove, the nine-box return and the flat rate scheme, plus the tax year and HMRC identifiers.

9 capabilities (5 core, 4 optional) and 3 gaps, in build order. Put each line in the file that calls it, then fune build.

Calculates tax from published rules; it is not tax advice. Have an accountant check how the app uses it before anyone files a return.

1. VAT

Work out VAT from the dated rates HMRC publishes.

finance.tax.vat-rate core Unreviewed
The VAT rate in force for a jurisdiction, category and date; the others look it up.
Look up the VAT rate in force for a jurisdiction, category and date.
from fune.finance.tax.vat_rate import vat_rate  # finance.tax.vat-rate@^1
finance.tax.add-vat core Unreviewed
Net to gross: VAT on a net amount at the rate on the date of supply.
Add VAT to a net amount using the rate in force on the date of supply.
from fune.finance.tax.add_vat import add_vat  # finance.tax.add-vat@^1
finance.tax.remove-vat core Unreviewed
Gross to net: the VAT already inside a VAT-inclusive price.
Extract the VAT already included in a gross amount, using the rate in force on the date of supply.
from fune.finance.tax.remove_vat import remove_vat  # finance.tax.remove-vat@^1
finance.tax.vat-return optional Unreviewed
The nine-box VAT return totals for a period from categorised sales and purchases.
UK nine-box VAT return totals for a period from categorised sales and purchases (VAT Notice 700/12).
from fune.finance.tax.vat_return import vat_return  # finance.tax.vat-return@^1
finance.tax.vat-flat-rate optional Unreviewed
VAT due under the Flat Rate Scheme by business sector, for small businesses on it.
UK VAT Flat Rate Scheme: VAT due on gross turnover at the sector's dated rate, limited cost rate and first-year 1% off.
from fune.finance.tax.vat_flat_rate import flat_rate_vat  # finance.tax.vat-flat-rate@^1

2. Tax periods

Put dates into the UK periods tax is worked out over.

dates.uk-tax-year core
Which UK tax year (6 April to 5 April) a date falls in.
The UK personal tax year containing a date: 6 April to 5 April, with HMRC's label.
from fune.dates.uk_tax_year import uk_tax_year  # dates.uk-tax-year@^1

3. Tax identifiers

Check the numbers HMRC and Companies House issue before storing them.

validation.uk-vat-number core
Checks a UK VAT registration number's checksum.
Check a UK VAT registration number against HMRC's mod-97 checksum, including the post-2010 9755 variant.
from fune.validation.uk_vat_number import is_uk_vat_number  # validation.uk-vat-number@^1
validation.uk-utr optional
Checks a Unique Taxpayer Reference's check digit.
Check an HMRC Unique Taxpayer Reference's modulus 11 check digit, accepting the K and spacing people type.
from fune.validation.uk_utr import validate_uk_utr  # validation.uk-utr@^2
validation.uk-company-number optional
Checks and pads a Companies House company number.
Check a Companies House company number's format and prefix (SC, NI, OC, LP...) and zero-pad it to eight characters.
from fune.validation.uk_company_number import validate_uk_company_number  # validation.uk-company-number@^2

Gaps

What this kind of app usually needs that Functional Weave does not have yet: write these yourself, or use a service.

  • mtd-submission Making Tax Digital: submitting the return to HMRC's VAT API (OAuth, fraud-prevention headers, obligations) is yours; caps gives the nine boxes.
  • corporation-tax Corporation tax and self-assessment income tax computations are not in caps.
  • vat-number-lookup Checking that a VAT number is registered (HMRC's lookup API) is network work; caps checks the checksum only.