Add tax_references, its controller and some basic pages for viewing ref data about taxes.

This commit is contained in:
2020-09-10 12:36:43 +01:00
parent 49d17e5850
commit 83ba256f9d
15 changed files with 142 additions and 4 deletions
+17
View File
@@ -0,0 +1,17 @@
class TaxReference < ApplicationRecord
validates :year, uniqueness: true
MAX_MONTHLY_HOURS = 172
def worker_contribution(number_of_hours)
return self.hourly_wage * number_of_hours * self.worker_percentage / 100
end
def employer_contribution(number_of_hours)
return self.hourly_wage * number_of_hours * self.employer_percentage / 100
end
def total_contribution(number_of_hours)
return self.employer_contribution(number_of_hours) +
self.worker_contribution(number_of_hours)
end
end