class PayrolleeCz::TaxEmployersHealthConcept

Constants

TAG_AMOUNT_BASE

Public Class Methods

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

Public Instance Methods

calc_category() click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 35
def calc_category
  PayrollConcept::CALC_CATEGORY_NETTO
end
compute_result_value(period, employer_base, employee_base) click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 39
def compute_result_value(period, employer_base, employee_base)
  employer_income = 0
  employee_income = 0
  if !interest?
    employer_income = 0
    employee_income = 0
  else
    employer_income = [0,employer_base].max
    employee_income = [0,employee_base].max
  end

  insurance_payment(period, employer_income, employee_income)
end
dup_with_value(code, values) click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 16
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_employers_health_concept.rb, line 53
def evaluate(period, tag_config, results)
  employer_base = employer_income_result(results, TAG_AMOUNT_BASE)
  employee_base = employee_income_result(results, TAG_AMOUNT_BASE)

  payment_value = compute_result_value(period, employer_base, employee_base)

  result_values = {payment: payment_value}

  PaymentResult.new(@tag_code, @code, self, result_values)
end
export_xml(xml_builder) click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 96
def export_xml(xml_builder)
  attributes = {}
  attributes[:interest_code] = @interest_code
  xml_builder.spec_value(attributes)
end
health_insurance_factor(period) click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 84
def health_insurance_factor(period)
  factor = 0.0
  if (period.year < 2008)
    factor = 0.0
  elsif (period.year < 2009)
    factor = 13.5
  else
    factor = 13.5
  end
  return BigDecimal.new(factor.fdiv(100), 15)
end
init_values(values) click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 12
def init_values(values)
  @interest_code = values[:interest_code] || 0
end
insurance_payment(period, employer_income, employee_income) click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 64
def insurance_payment(period, employer_income, employee_income)
  employer_base = [employer_income, employee_income].max
  employee_self = [0, employee_income - employer_income].max
  employee_base = [0, employer_base - employee_self].max

  health_factor = health_insurance_factor(period)

  suma_payment_value = fix_insurance_round_up(
      big_multi(employer_base, health_factor)
  )
  empl_payment_value = fix_insurance_round_up(
      big_multi(employee_self, health_factor) + big_div(big_multi(employee_base, health_factor), 3)
  )
  cont_payment_value = suma_payment_value - empl_payment_value
end
interest?() click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 80
def interest?
  @interest_code!=0
end
pending_codes() click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 23
def pending_codes
  [
      InsuranceHealthBaseTag.new
  ]
end
summary_codes() click to toggle source
# File lib/payrollee_cz/concepts/tax_employers_health_concept.rb, line 29
def summary_codes
  [
      IncomeNettoTag.new
  ]
end