Skip to content

Commit

Permalink
removed unused functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
demmings committed Dec 9, 2024
1 parent 7e5dea6 commit 73d5a72
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 81 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

## Purpose

* Take a column of **NET INCOMES** and calculate as accurately as possible the amount of **GROSS INCOMES** that would be required in **Canada** (and **ONTARIO**) to have the required net income.
* A Google Sheets custom function used for doing retirement income projections and taking Canadian taxes into the equation.
* Take a column of **NET INCOMES** and calculate as accurately as possible the amount of **GROSS INCOMES** that would be required in **Canada** (and **ONTARIO**) to have the required net income.
* There is also the option of doing the opposite on finding net incomes from gross incomes.


## Installing
Expand Down
52 changes: 12 additions & 40 deletions dist/CanadianTaxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,53 +264,25 @@ function GET_NET_INCOMES_V2(yearlyGrossIncome, ageInFuture, currentAge = 65, inf
return CanadianIncomeCalculator.getNetIncomes(taxData);
}

/**
* Find approximate tax payable.
* @param {number} grossIncome
* @param {number} age
* @param {Number} dividends
* @returns {number}
* @customfunction
*/
function GET_INCOMETAX_V2(grossIncome, age = 60, dividends = 0, eligibleCapitalGains = 0) {
const taxData = CanadianIncomeCalculator.validateIncomeSettings(grossIncome, age, age, null, 0, eligibleCapitalGains, dividends, 0, 0);
const taxCalc = new CanadianIncomeTax(taxData.year, taxData.inflation);

return taxCalc.findTotalTax(taxData, grossIncome);
}

/**
*
* @param {Number} grossIncome
* @param {Number} age
* @param {Number} incomeEligibleForPensionCredit
* @param {Number} dividends
* @param {Number} eligibleCapitalGains
* @param {any} yearlyGrossIncome
* @param {any} ageInFuture
* @param {Number} currentAge
* @param {Number} inflation
* @param {Number} taxYear
* @param {any} capitalGains
* @param {any} dividendIncome
* @param {any} pension
* @returns {Number}
* @customfunction
*/
function NET_FEDERAL_TAX_V2(grossIncome, age, incomeEligibleForPensionCredit = 0, dividends = 0, eligibleCapitalGains = 0) {
const taxData = CanadianIncomeCalculator.validateIncomeSettings(grossIncome, age, age, null, 0, eligibleCapitalGains, dividends, 0, 0);
const tax = new CanadianIncomeTax(taxData.year, taxData.inflation);

return tax.getNetFederalTax(taxData, grossIncome);
}
function GET_INCOMETAX_V2(yearlyGrossIncome, ageInFuture, currentAge = 65, inflation = null, taxYear = null, capitalGains = null, dividendIncome = null, OAS = null, pension = null) {
const taxData = CanadianIncomeCalculator.validateIncomeSettings(yearlyGrossIncome, ageInFuture, currentAge, taxYear, inflation, capitalGains, dividendIncome, OAS, pension);

/**
*
* @param {Number} grossIncome
* @param {Number} age
* @param {Number} incomeEligibleForPensionCredit
* @param {Number} dividends
* @param {Number} eligibleCapitalGains
* @returns {Number}
* @customfunction
*/
function NET_PROVINCIAL_TAX_V2(grossIncome, age, incomeEligibleForPensionCredit = 0, dividends = 0, eligibleCapitalGains = 0, OAS = 0) {
const taxData = CanadianIncomeCalculator.validateIncomeSettings(grossIncome, age, age, null, 0, eligibleCapitalGains, dividends, 0, 0);
const tax = new CanadianIncomeTax(taxData.year, taxData.inflation);
const taxCalc = new CanadianIncomeTax(taxData.year, taxData.inflation);

return tax.getNetProvincialTax(taxData, grossIncome);
return taxCalc.findTotalTax(taxData, yearlyGrossIncome);
}

class CanadianIncomeCalculator {
Expand Down
52 changes: 12 additions & 40 deletions src/CanadianTaxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,53 +283,25 @@ function GET_NET_INCOMES_V2(yearlyGrossIncome, ageInFuture, currentAge = 65, inf
return CanadianIncomeCalculator.getNetIncomes(taxData);
}

/**
* Find approximate tax payable.
* @param {number} grossIncome
* @param {number} age
* @param {Number} dividends
* @returns {number}
* @customfunction
*/
function GET_INCOMETAX_V2(grossIncome, age = 60, dividends = 0, eligibleCapitalGains = 0) {
const taxData = CanadianIncomeCalculator.validateIncomeSettings(grossIncome, age, age, null, 0, eligibleCapitalGains, dividends, 0, 0);
const taxCalc = new CanadianIncomeTax(taxData.year, taxData.inflation);

return taxCalc.findTotalTax(taxData, grossIncome);
}

/**
*
* @param {Number} grossIncome
* @param {Number} age
* @param {Number} incomeEligibleForPensionCredit
* @param {Number} dividends
* @param {Number} eligibleCapitalGains
* @param {any} yearlyGrossIncome
* @param {any} ageInFuture
* @param {Number} currentAge
* @param {Number} inflation
* @param {Number} taxYear
* @param {any} capitalGains
* @param {any} dividendIncome
* @param {any} pension
* @returns {Number}
* @customfunction
*/
function NET_FEDERAL_TAX_V2(grossIncome, age, incomeEligibleForPensionCredit = 0, dividends = 0, eligibleCapitalGains = 0) {
const taxData = CanadianIncomeCalculator.validateIncomeSettings(grossIncome, age, age, null, 0, eligibleCapitalGains, dividends, 0, 0);
const tax = new CanadianIncomeTax(taxData.year, taxData.inflation);

return tax.getNetFederalTax(taxData, grossIncome);
}
function GET_INCOMETAX_V2(yearlyGrossIncome, ageInFuture, currentAge = 65, inflation = null, taxYear = null, capitalGains = null, dividendIncome = null, OAS = null, pension = null) {
const taxData = CanadianIncomeCalculator.validateIncomeSettings(yearlyGrossIncome, ageInFuture, currentAge, taxYear, inflation, capitalGains, dividendIncome, OAS, pension);

/**
*
* @param {Number} grossIncome
* @param {Number} age
* @param {Number} incomeEligibleForPensionCredit
* @param {Number} dividends
* @param {Number} eligibleCapitalGains
* @returns {Number}
* @customfunction
*/
function NET_PROVINCIAL_TAX_V2(grossIncome, age, incomeEligibleForPensionCredit = 0, dividends = 0, eligibleCapitalGains = 0, OAS = 0) {
const taxData = CanadianIncomeCalculator.validateIncomeSettings(grossIncome, age, age, null, 0, eligibleCapitalGains, dividends, 0, 0);
const tax = new CanadianIncomeTax(taxData.year, taxData.inflation);
const taxCalc = new CanadianIncomeTax(taxData.year, taxData.inflation);

return tax.getNetProvincialTax(taxData, grossIncome);
return taxCalc.findTotalTax(taxData, yearlyGrossIncome);
}

class CanadianIncomeCalculator {
Expand Down

0 comments on commit 73d5a72

Please sign in to comment.