Skip to content

Instantly share code, notes, and snippets.

@meskallito
Last active December 21, 2015 07:59
Show Gist options
  • Select an option

  • Save meskallito/6275536 to your computer and use it in GitHub Desktop.

Select an option

Save meskallito/6275536 to your computer and use it in GitHub Desktop.
module StaticInstructions::Meta
class BasicFederalTax < Base
include PayPeriods
def calculate(result)
tr = TaxRates.new(result.annual_taxable_income)
zero_or_positive tr.rate * result.annual_taxable_income - tr.constant - k1 - k2(result) - k3 - k4(result)
end
def k4(result)
[bd(0.15) * result.annual_taxable_income, bd(0.15) * bd(1_117)].min
end
def k3
0
end
def k2(result)
bd(0.15) * [pay_periods * result.canada_pension_plan, bd(2_356.20)].min
+ bd(0.15) * [pay_periods * result.employment_insurance, bd(891.12)].min
end
def k1
employee.td1_form.total_claim * 0.15
end
def calculation_dependencies
[ :annual_taxable_income, :canada_pension_plan, :employment_insurance ]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment