dodil/erp-brick-tax

DODIL ERP brick: tax

src/brick_tax/domain/uk_pack.py

"""The UK pack (TAX-02): the codes a UK business starts with, each with its treatment, its wording on the document, its
VAT-return box and its rate from the real date it started; the customer treatments and the product categories the codes
are chosen from. Rules are NOT in the pack: which category a business sells to whom is the customer's answer (TAX-04).

Dates: standard 20% from 2011-01-04 (HMRC), reduced 5% from 1997-09-01, the domestic reverse charge for building and
construction services from 2021-03-01 (VAT due 20%, charged 0%); the zero, exempt, outside-scope and no-VAT codes carry 0%
from the start of VAT, 1973-04-01. Boxes are the UK VAT return's output-VAT box 1 and the sales box 6.
"""
from dataclasses import dataclass
from datetime import date
from decimal import Decimal


@dataclass(frozen=True)
class PackCode:
    tax_code: str
    treatment: str
    description: str
    wording: str
    box: str
    rate_pct: Decimal
    charged_pct: Decimal
    valid_from: date


UK_CODES = (
    PackCode("S", "standard", "Standard rate 20%", "", "1,6", Decimal(20), Decimal(20), date(2011, 1, 4)),
    PackCode("R", "reduced", "Reduced rate 5%", "", "1,6", Decimal(5), Decimal(5), date(1997, 9, 1)),
    PackCode("Z", "zero", "Zero rated", "", "6", Decimal(0), Decimal(0), date(1973, 4, 1)),
    PackCode("E", "exempt", "Exempt", "", "6", Decimal(0), Decimal(0), date(1973, 4, 1)),
    PackCode("OS", "outside_scope", "Outside the scope of UK VAT", "Outside the scope of UK VAT", "6", Decimal(0), Decimal(0), date(1973, 4, 1)),
    PackCode("RC", "reverse_charge", "Domestic reverse charge (VAT due 20%, charged 0%)",
             "Reverse charge: Customer to pay the VAT to HMRC", "1,6", Decimal(20), Decimal(0), date(2021, 3, 1)),
    PackCode("NV", "not_registered", "No VAT (not VAT registered)", "", "", Decimal(0), Decimal(0), date(1973, 4, 1)),
)

UK_TREATMENTS = (
    ("uk_business", "a UK business customer", False),
    ("uk_consumer", "a UK consumer", False),
    ("overseas_business", "a business customer outside the UK", True),
    ("overseas_consumer", "a consumer outside the UK", False),
    ("uk_cis_contractor", "a UK contractor under the construction industry scheme (domestic reverse charge)", True),
)

UK_CATEGORIES = (
    ("standard", "taxed at the standard rate"),
    ("reduced", "taxed at the reduced rate"),
    ("zero", "zero-rated (exports, children's clothes ...)"),
    ("exempt", "exempt (insurance, some education ...)"),
    ("construction_service", "building and construction services (domestic reverse charge applies to some customers)"),
)


# The figures the law sets (tax_statutory rows from the start; a change is a new dated row): key, value, unit, the notice.
UK_STATUTORY = (
    ("error_correction_small", "10000", "GBP", "VAT Notice 700/45 para 3.2: net errors up to this are corrected on the next return"),
    ("error_correction_large", "50000", "GBP", "VAT Notice 700/45 para 3.2: errors up to this and within the percentage of box 6"),
    ("error_correction_pct", "1", "percent of box 6", "VAT Notice 700/45 para 3.2"),
    ("cash_join_limit", "1350000", "GBP", "VAT Notice 731 para 3.1: expected taxable turnover to join cash accounting"),
    ("cash_leave_limit", "1600000", "GBP", "VAT Notice 731 para 3.2: turnover above this leaves cash accounting"),
    ("cash_exclude_months", "6", "months", "VAT Notice 731 para 4.2: an invoice payable more than this far ahead stays on the invoice basis"),
    ("flat_join_limit", "150000", "GBP", "VAT Notice 733 para 2.1: expected taxable turnover (excl. VAT) to join the flat rate scheme"),
    ("flat_leave_limit", "230000", "GBP", "VAT Notice 733 para 2.2: turnover (incl. VAT) above this leaves the flat rate scheme"),
    ("flat_lct_rate", "16.5", "percent", "VAT Notice 733 para 4.1: the limited cost trader rate"),
    ("flat_lct_pct", "2", "percent of turnover", "VAT Notice 733 para 4.1: goods below this share of turnover"),
    ("flat_lct_min_annual", "1000", "GBP a year", "VAT Notice 733 para 4.1: or goods below this a year (pro rata)"),
    ("flat_first_year_discount", "1", "percent", "VAT Notice 733 para 5: first year of VAT registration"),
    ("flat_capital_min", "2000", "GBP incl. VAT", "VAT Notice 733 para 6: capital goods reclaimed in box 4 under the flat rate"),
    ("pe_de_minimis_monthly", "625", "GBP a month", "VAT Notice 706 para 10: de minimis, exempt input tax on average"),
    ("pe_de_minimis_pct", "50", "percent of input tax", "VAT Notice 706 para 10"),
    ("pe_residual_cap_monthly", "400000", "GBP a month", "VAT Notice 706 para 11: the percentage is rounded up while residual input tax averages at most this"),
    ("ec_sales_quarterly_limit", "35000", "GBP a quarter", "VAT Notice 725: quarterly EC sales list while goods stay below this"),
    ("intrastat_arrivals", "500000", "GBP a year", "Intrastat NI: arrivals threshold"),
    ("intrastat_dispatches", "250000", "GBP a year", "Intrastat NI: dispatches threshold"),
    ("cis_rate_gross", "0", "percent", "CIS340: gross payment status"),
    ("cis_rate_net", "20", "percent", "CIS340: registered for net payment"),
    ("cis_rate_unmatched", "30", "percent", "CIS340: not matched"),
    ("capital_interval_land_building", "10", "intervals", "VAT Notice 706/2: land and buildings (250,000 or more)"),
    ("capital_interval_computer", "5", "intervals", "VAT Notice 706/2: computers (50,000 or more)"),
    ("capital_min_land_building", "250000", "GBP", "VAT Notice 706/2: capital goods scheme, land and buildings"),
    ("capital_min_computer", "50000", "GBP", "VAT Notice 706/2: capital goods scheme, computers"),
    ("flat_sector:computer and IT consultancy", "14.5", "percent", "VAT Notice 733 para 3: flat rate by sector"),
    ("flat_sector:management consultancy", "14", "percent", "VAT Notice 733 para 3"),
    ("flat_sector:retailing food, confectionery, tobacco, newspapers", "4", "percent", "VAT Notice 733 para 3"),
    ("flat_sector:hotel or accommodation", "10.5", "percent", "VAT Notice 733 para 3"),
    ("flat_sector:building or construction services (labour only)", "14.5", "percent", "VAT Notice 733 para 3"),
)