Class: Formulas::PAYG

Inherits:
WithholdingTax show all
Defined in:
lib/formulas/payg.rb

Overview

Calculate basic salary in frequency salary = Income::Salary.new(52_000, Salary::ANNUAL)

Taxable income

Tax on this income

0 – $18,200

Nil

$18,201 – $45,000

19 cents for each $1 over $18,200

$45,001 – $120,000

$5,092 plus 32.5 cents for each $1 over $45,000

$120,001 – $180,000

$29,467 plus 37 cents for each $1 over $120,000

$180,001 and over

$51,667 plus 45 cents for each $1 over $180,000

Plus 2 percent medicare

salary.calculate(:monthly)

Constant Summary collapse

TAX_RATES =

Provide a way to calculate pay as you earn calculator

[
  [[0, 18_200], 0],
  [[18_201, 45_000], 19],
  [[45_001, 120_000], 32.5],
  [[120_001, 180_000], 37],
  [[180_001], 45]
]

Instance Attribute Summary

Attributes inherited from WithholdingTax

#origin_frequency

Instance Method Summary collapse

Methods inherited from WithholdingTax

#net_pay

Methods included from FrequencyConversions

#convert_annually_to_annually, #convert_annually_to_fortnightly, #convert_annually_to_monthly, #convert_annually_to_weekly, #convert_fortnightly_to_annually, #convert_fortnightly_to_monthly, #convert_fortnightly_to_weekly, #convert_monthly_to_annually, #convert_monthly_to_fortnightly, #convert_monthly_to_weekly, #convert_weekly_to_annually, #convert_weekly_to_fortnightly, #convert_weekly_to_monthly

Constructor Details

#initialize(gross_pay:, frequency: Formulas::MONTHLY) ⇒ PAYG

Returns a new instance of PAYG.



45
46
47
# File 'lib/formulas/payg.rb', line 45

def initialize(gross_pay:, frequency: Formulas::MONTHLY)
  super(gross_pay, frequency, TAX_RATES)
end

Instance Method Details

#tax(request_frequency: Formulas::WEEKLY) ⇒ Object



49
50
51
# File 'lib/formulas/payg.rb', line 49

def tax(request_frequency: Formulas::WEEKLY)
  calculate_tax(request_frequency) * 1.02
end