Class: Formulas::PAYE

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

Overview

Calculate basic salary in frequency paye = Formulas::PAYE.new(gross_pay: 52_000, frequency: Formulas::ANNUAL)

paye.tax(:monthly)

> 718.33

Provide a way to calculate pay as you earn calculator

Constant Summary collapse

TAX_RATES =

Provide a way to calculate PAYE tax

[
  [[0, 14_000], 10.5],
  [[14_000, 48_000], 17.5],
  [[48_000, 70_000], 30],
  [[70_000, 180_000], 33],
  [[180_000], 39]
]

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) ⇒ PAYE

Returns a new instance of PAYE.



22
23
24
# File 'lib/formulas/paye.rb', line 22

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

Instance Method Details

#levyObject



30
31
32
# File 'lib/formulas/paye.rb', line 30

def levy
  0.0139
end

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



26
27
28
# File 'lib/formulas/paye.rb', line 26

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