class PayrolleeCz::TaxWithholdConcept

Constants

TAG_INCOME_BASE
TAG_WITHHOLD_BASE

Public Class Methods

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

Public Instance Methods

calc_category() click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_concept.rb, line 35
def calc_category
  PayrollConcept::CALC_CATEGORY_NETTO
end
compute_result_value(period, taxable_income, taxable_partial) click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_concept.rb, line 39
def compute_result_value(period, taxable_income, taxable_partial)
  tax_withhold_calculate(taxable_income, taxable_partial, period)
end
dup_with_value(code, values) click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_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_withhold_concept.rb, line 43
def evaluate(period, tag_config, results)
  taxable_income = income_base_result(results, TAG_INCOME_BASE)
  taxable_partial = income_base_result(results, TAG_WITHHOLD_BASE)

  payment_value = compute_result_value(period, taxable_income, taxable_partial)

  result_values = {payment: payment_value}

  PaymentDeductionResult.new(@tag_code, @code, self, result_values)
end
init_values(values) click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_concept.rb, line 13
def init_values(values)
end
pending_codes() click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_concept.rb, line 23
def pending_codes
  [
      TaxWithholdBaseTag.new
  ]
end
summary_codes() click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_concept.rb, line 29
def summary_codes
  [
      IncomeNettoTag.new
  ]
end
tax_adv_bracket1(year) click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_concept.rb, line 80
def tax_adv_bracket1(year)
  factor = 0.0
  if year >= 2009
    factor = 15.0
  elsif year == 2008
    factor = 15.0
  elsif year >= 2006
    factor = 12.0
  else
    factor = 15.0
  end
  return BigDecimal.new(factor.fdiv(100), 15)
end
tax_withhold_calculate(tax_income, tax_base, period) click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_concept.rb, line 54
def tax_withhold_calculate(tax_income, tax_base, period)
  if tax_base <= 0
    0
  else
    tax_withhold_calculate_month(tax_income, tax_base, period)
  end
end
tax_withhold_calculate_month(tax_income, tax_base, period) click to toggle source
# File lib/payrollee_cz/concepts/tax_withhold_concept.rb, line 62
def tax_withhold_calculate_month(tax_income, tax_base, period)
  if tax_base <= 0
    0
  else
    if period.year < 2008
      0
    elsif period.year < 2013
      fix_tax_round_up(
          big_multi(tax_base, tax_adv_bracket1(period.year))
      )
    else
      fix_tax_round_up(
          big_multi(tax_base, tax_adv_bracket1(period.year))
      )
    end
  end
end