class PayrolleeCz::TaxBonusChildConcept
Constants
- TAG_ADVANCE
- TAG_AMOUNT_BASE
- TAG_CLAIMS_CHILD
- TAG_RELIEF_CHILD
- TAG_RELIEF_PAYER
Public Class Methods
new(tag_code, values)
click to toggle source
Calls superclass method
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 11 def initialize(tag_code, values) super(PayConceptGateway::REFCON_TAX_BONUS_CHILD, tag_code) init_values(values) end
Public Instance Methods
bonus_after_relief(tax_advance, relief_payer, relief_child, claims_child)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 81 def bonus_after_relief(tax_advance, relief_payer, relief_child, claims_child) bonus_for_child = -[0, relief_child - claims_child].min if bonus_for_child >= 50 return bonus_for_child else return 0 end end
calc_category()
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 40 def calc_category PayrollConcept::CALC_CATEGORY_NETTO end
compute_result_value(year, is_tax_interest, advance_base_value, relief_payer_value, relief_child_value, relief_claim_value)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 44 def compute_result_value(year, is_tax_interest, advance_base_value, relief_payer_value, relief_child_value, relief_claim_value) if !is_tax_interest tax_advance_value = 0 else relief_bonus_value = bonus_after_relief(advance_base_value, relief_payer_value, relief_child_value, relief_claim_value) tax_advance_value = max_min_bonus(year, relief_bonus_value) end tax_advance_value end
dup_with_value(code, values)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 19 def dup_with_value(code, values) new_concept = self.dup new_concept.init_code(code) new_concept.init_values(values) return new_concept end
evaluate(period, tag_config, results)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 57 def evaluate(period, tag_config, results) is_tax_interest = interest_result(results, TAG_AMOUNT_BASE) advance_base = payment_result(results, TAG_ADVANCE) relief_payer = tax_relief_result(results, TAG_RELIEF_PAYER) relief_child = tax_relief_result(results, TAG_RELIEF_CHILD) relief_claim = sum_relief_by(results, TAG_CLAIMS_CHILD) tax_advance_value = compute_result_value(period.year, is_tax_interest, advance_base, relief_payer, relief_child, relief_claim) result_values = {payment: tax_advance_value} PaymentResult.new(@tag_code, @code, self, result_values) end
init_values(values)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 16 def init_values(values) end
max_bonus_monthly(year)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 103 def max_bonus_monthly(year) if year>=2012 5025 elsif year>=2009 4350 elsif year==2008 4350 elsif year>=2005 2500 else 0 end end
max_min_bonus(year, tax_child_bonus)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 90 def max_min_bonus(year, tax_child_bonus) if tax_child_bonus < min_bonus_monthly(year) 0 else max_bonus_value = max_bonus_monthly(year) if tax_child_bonus > max_bonus_value max_bonus_value else tax_child_bonus end end end
min_bonus_monthly(year)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 117 def min_bonus_monthly(year) if year>=2005 50 else 0 end end
pending_codes()
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 26 def pending_codes [ TaxAdvanceTag.new, TaxReliefPayerTag.new, TaxReliefChildTag.new ] end
sum_relief_by(results, pay_tag)
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 74 def sum_relief_by(results, pay_tag) result_hash = results.select { |key,_| key.code==pay_tag } result_suma = result_hash.inject (0) do |agr, item| agr + item.last.tax_relief end end
summary_codes()
click to toggle source
# File lib/payrollee_cz/concepts/tax_bonus_child_concept.rb, line 34 def summary_codes [ IncomeNettoTag.new ] end