class PayrolleeCz::TaxAdvanceConcept

Constants

TAG_ADVANCE_BASE
TAG_INCOME_BASE

Public Class Methods

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

Public Instance Methods

calc_category() click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_concept.rb, line 29
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_advance_concept.rb, line 33
def compute_result_value(period, taxable_income, taxable_partial)
  tax_adv_calculate(period, taxable_income, taxable_partial)
end
dup_with_value(code, values) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_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_advance_concept.rb, line 37
def evaluate(period, tag_config, results)
  taxable_income = income_base_result(results, TAG_INCOME_BASE)
  taxable_partial = income_base_result(results, TAG_ADVANCE_BASE)

  payment_value = compute_result_value(period, taxable_income, taxable_partial)

  result_values = {payment: payment_value}

  PaymentResult.new(@tag_code, @code, self, result_values)
end
init_values(values) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_concept.rb, line 13
def init_values(values)
end
pending_codes() click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_concept.rb, line 23
def pending_codes
  [
      TaxAdvanceBaseTag.new
  ]
end
tax_adv_bracket1(year) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_concept.rb, line 91
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_adv_calculate(period, tax_income, tax_base) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_concept.rb, line 48
def tax_adv_calculate(period, tax_income, tax_base)
  if tax_base <= 0
    0
  elsif tax_base <= 100
    fix_tax_round_up(big_multi(tax_base, tax_adv_bracket1(period.year)))
  else
    tax_adv_calculate_month(period, tax_income, tax_base)
  end
end
tax_adv_calculate_month(period, tax_income, tax_base) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_concept.rb, line 58
def tax_adv_calculate_month(period, tax_income, tax_base)
  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
      tax_standard = fix_tax_round_up(
          big_multi(tax_base, tax_adv_bracket1(period.year))
      )
      max_sol_base = tax_sol_bracket_max(period.year)
      eff_sol_base = [0,tax_income-max_sol_base].max
      tax_solidary = fix_tax_round_up(
          big_multi(eff_sol_base, tax_sol_bracket(period.year))
      )
      tax_standard + tax_solidary
    end
  end
end
tax_sol_bracket(year) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_concept.rb, line 105
def tax_sol_bracket(year)
  factor = 0.0
  if year >= 2013
    factor = 7.0
  else
    factor = 0.0
  end
  return BigDecimal.new(factor.fdiv(100), 15)
end
tax_sol_bracket_max(year) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_concept.rb, line 82
def tax_sol_bracket_max(year)
  if year >= 2013
    (4*25884)
  else
    0
  end
end