Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify documentation on national insurance function #20

Open
tboby opened this issue Mar 17, 2024 · 2 comments
Open

Clarify documentation on national insurance function #20

tboby opened this issue Mar 17, 2024 · 2 comments

Comments

@tboby
Copy link

tboby commented Mar 17, 2024

calculateEmployeeNationalInsurance is documented as requiring taxableAnnualIncome, which isn't quite right. I'm not quite sure what to call it, and HMRC seem to careful avoid giving it a name, but it's more like the gross, cash, employment income?

I understand why SavingTool makes the salary sacrifice assumption to simplify things!

Thank you so much for this library; I've been using it for a personal finance tool that's slightly more tailored to me and it's really helpful :)

@sgb-io
Copy link
Member

sgb-io commented Mar 17, 2024

Hey, thanks for your interest in the library!

Hopefully the readme makes it clear that the scope of the library is (currently) limited to PAYE employees that pay Class 1 Category A NICs.

With this in mind (and avoiding lots of potential complexities like self employed, company director or non-Category A individuals), NICs are calculated using someone's annual (taxable) salary. The actual NICs rates are quoted weekly/monthly but this library simply calculates it on a 12 month basis.

Taxable income here essentially means PAYE employment income. Other forms of income are ignored. Open to suggestions if you think there is an obvious clarification or improvement to be made 🙂

Sources:

@tboby
Copy link
Author

tboby commented Mar 17, 2024

Oh, I absolutely understand limiting it to PAYE Class 1 Category A.

But for the simple case of:
£60k salary, 3% pension contributions (without sacrifice), student loan plan 1.
Which would be £58200 taxable income for income tax (and personal allowance?), but £60k employment income for student loan and NIC.

Perhaps the clearest example is just to show my usage, where I only get the "right" numbers if I pass the gross PAYE salary to a parameter called "taxableAnnualIncome". All four functions ask for taxableAnnualIncome, but they need to be given two different values in the simplest case.

let private calculateNetIncome grossCashEmploymentIncome taxableIncome studentLoanPlan =
    let personalAllowance =
        calculatePersonalAllowance {|
            taxableAnnualIncome = taxableIncome
            taxYear = None
        |}

    let incomeTax =
        calculateIncomeTax {|
            taxYear = None
            taxableAnnualIncome = taxableIncome
            personalAllowance = personalAllowance
        |}

    let nationalInsurance =
        calculateEmployeeNationalInsurance {|
            taxYear = None
            taxableAnnualIncome = grossCashEmploymentIncome
        |}

    let studentLoan =
        match studentLoanPlan with
        | 1 | 2 | 4 | 5 ->
            calculateStudentLoanRepayments {|
                taxYear = None
                taxableAnnualIncome = grossCashEmploymentIncome
                studentLoanPlanNo = studentLoanPlan
            |}
        | _ -> 0.0

    let totalDeductions =
        incomeTax.basicRateTax
        + incomeTax.higherRateTax
        + incomeTax.additionalRateTax
        + nationalInsurance
        + studentLoan

    let netIncome = taxableIncome - totalDeductions
    netIncome

So my tiny suggestion is just to rename the calculateEmployeeNationalInsurance and calculateStudentLoanRepayments parameters to make it clear it isn't the taxable income, it's the PAYE income.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants