class PayrolleeCz::TaxReliefChildConcept

Constants

TAG_ADVANCE
TAG_CLAIM_BASE
TAG_RELIEF_PAYER

Public Class Methods

new(tag_code, values) click to toggle source
Calls superclass method
# File lib/payrollee_cz/concepts/tax_relief_child_concept.rb, line 9
def initialize(tag_code, values)
  super(PayConceptGateway::REFCON_TAX_RELIEF_CHILD, tag_code)
  init_values(values)
end

Public Instance Methods

calc_category() click to toggle source
# File lib/payrollee_cz/concepts/tax_relief_child_concept.rb, line 32
def calc_category
  PayrollConcept::CALC_CATEGORY_NETTO
end
compute_result_value(advance_base, relief_value, claims_value) click to toggle source
# File lib/payrollee_cz/concepts/tax_relief_child_concept.rb, line 36
def compute_result_value(advance_base, relief_value, claims_value)
  relief_amount(advance_base, relief_value, claims_value)
end
dup_with_value(code, values) click to toggle source
# File lib/payrollee_cz/concepts/tax_relief_child_concept.rb, line 17
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_relief_child_concept.rb, line 40
def evaluate(period, tag_config, results)
  tax_advance = tax_payment_result(results, TAG_ADVANCE)
  tax_relief = tax_relief_result(results, TAG_RELIEF_PAYER)
  relief_claim = sum_relief_by(results, TAG_CLAIM_BASE)

  relief_value = compute_result_value(tax_advance, tax_relief, relief_claim)

  result_values = {tax_relief: relief_value}

  TaxReliefResult.new(@tag_code, @code, self, result_values)
end
init_values(values) click to toggle source
# File lib/payrollee_cz/concepts/tax_relief_child_concept.rb, line 14
def init_values(values)
end
pending_codes() click to toggle source
# File lib/payrollee_cz/concepts/tax_relief_child_concept.rb, line 24
def pending_codes
  [
      TaxAdvanceTag.new,
      TaxReliefPayerTag.new,
      TaxClaimChildTag.new
  ]
end
relief_amount(tax_advance, tax_relief, tax_claims) click to toggle source
# File lib/payrollee_cz/concepts/tax_relief_child_concept.rb, line 59
def relief_amount(tax_advance, tax_relief, tax_claims)
  tax_after_relief = tax_advance - tax_relief
  tax_claims - [0, tax_claims - tax_after_relief].max
end
sum_relief_by(results, pay_tag) click to toggle source
# File lib/payrollee_cz/concepts/tax_relief_child_concept.rb, line 52
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