InjectorTaxes

InjectorTaxes

Creates a taxes injector that all injectors require in order to calculate

Constructor

new InjectorTaxes(skv_config, arr_tax_years)

Source:
Parameters:
Name Type Description
skv_config struct

Struct passed in when initializing the injector

arr_tax_years array

Array of tax years

Methods

(static) addCalculatedTaxBand(skv_band, amount_to_tax, tax_applied) → {struct}

Source:

build a struct with the calculated income tax

Parameters:
Name Type Description
skv_band array

basic tax band

amount_to_tax number
tax_applied number
Returns:

tax band with calculated tax

Type
struct

(static) addProportionsToBands(arr_tax_bands, tax_total) → {array}

Source:

Work out how much of the tax is in each band

Parameters:
Name Type Description
arr_tax_bands array
tax_total number

all the tax across the tax bands added up

Returns:

tax bands with % proportions included

Type
array

(static) calcEmployeeNICSingleYear(arr_income, employee_nic_bands) → {array}

Source:

Creates and populates an array with EMPLOYEE national insurance contributions for a single year

Parameters:
Name Type Description
arr_income array
employee_nic_bands number
Returns:

array of employer national insurance contributions

Type
array

(static) calcEmployerNICSingleYear(arr_income, class_1A_rate) → {array}

Source:

Creates and populates an array with EMPLOYER class1a national insurance contributions for a single year

Parameters:
Name Type Description
arr_income array
class_1A_rate number
Returns:

array of employer national insurance contributions

Type
array

(static) calcExtraTaxFromLostPA(arr_income, arr_tax_bands) → {struct}

Source:

Work out how much extra tax is paid due to lost personal allowance, split by the sources of income (including benefits as income)

Parameters:
Name Type Description
arr_income array
arr_tax_bands array
Returns:
Type
struct

(static) calcIncomeTax(arr_income, arr_tax_bands) → {struct}

Source:

Creates and populates the arr_income_tax array for a single year

Parameters:
Name Type Description
arr_income array
arr_tax_bands array
Returns:
Type
struct

(static) calculate(arr_tax_years) → {array}

Source:

Calculate the taxes for each year including totals

Parameters:
Name Type Description
arr_tax_years array
Returns:

tax years with calculated taxes and totals

Type
array

(static) calculateIncomeTaxRelief(arr_income, arr_calculated_salary_tax_bands) → {array}

Source:

calculate income tax that is classed as relief

Parameters:
Name Type Description
arr_income array
arr_calculated_salary_tax_bands array

We need tax that has already been calculated on income tax to ensure the relief is deducted from the highest band with tax in it

Returns:

array of income tax

Type
array

(static) calculateIncomeTaxTaxable(arr_income, arr_tax_bands) → {array}

Source:

calculate income tax that is taxable

Parameters:
Name Type Description
arr_income array
arr_tax_bands array
Returns:

array of income tax

Type
array

(static) calculateTotals(skv_tax_year) → {struct}

Source:

Do the final totalling

Parameters:
Name Type Description
skv_tax_year struct
Returns:

Totals of income and tax

Type
struct

(static) getEmployeeNICTaxableIncomes(arr_income) → {array}

Source:

Filter income by whether national insurance contributions are due on it

Parameters:
Name Type Description
arr_income array
Returns:
Type
array

(static) getEmployerProvidedIncomes(arr_income) → {array}

Source:

Filter income by whether its provided by employer

Parameters:
Name Type Description
arr_income array
Returns:
Type
array

(static) getReliefIncomes(arr_income) → {array}

Source:

Filter income by whether its consider as relief

Parameters:
Name Type Description
arr_income array
Returns:
Type
array

(static) getTaxableIncomes(arr_income) → {array}

Source:

Filter income by whether its income taxable Note: Relief such as Mileage Allowance Relief (MAR) is

Parameters:
Name Type Description
arr_income array
Returns:
Type
array

(static) getTaxStartingStruct(skv_income) → {struct}

Source:

Creates the structure for an income tax struct

Parameters:
Name Type Description
skv_income struct

The structure representing a single year

Returns:
Type
struct

(static) getTopBandWithTaxIndex(arr_tax_bands) → {number}

Source:

Get the highest tax band with tax due to be paid

Parameters:
Name Type Description
arr_tax_bands array

Description

Returns:

index of highest tax band

Type
number

(static) totalEmployeeNIC(arr_employee_nic) → {number}

Source:

Loops through the employee NIC array

Parameters:
Name Type Description
arr_employee_nic array
Returns:

num_total

Type
number

(static) totalEmployerNIC(arr_employer_nic) → {number}

Source:

Loops through the employer NIC array

Parameters:
Name Type Description
arr_employer_nic array
Returns:

num_total

Type
number

(static) totalIncome(arr_income, str_mode) → {number}

Source:

Loops through the income array totalling up the value

Parameters:
Name Type Description
arr_income array

Array of income structures each containing an element with key 'value'

str_mode string

what elements are we counting

Returns:
Type
number

(static) totalIncomeTaxes(arr_income_tax, str_mode) → {data_type}

Source:

Loops through the array totalling up the valuePounds

Parameters:
Name Type Description
arr_income_tax array

Array of structures each containing an element with key: tax_total

str_mode string

what elements are we counting

Returns:

Description

Type
data_type

(static) totalTaxRelief(arr_income_tax) → {number}

Source:

Loops through the income tax looking for any taxed relief

Parameters:
Name Type Description
arr_income_tax array
Returns:

num_total

Type
number