class PayrolleeCz::TaxAdvanceBaseConcept

Constants

TAG_AMOUNT_BASE
TAG_HEALTH_BASE
TAG_SOCIAL_BASE

Public Class Methods

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

Public Instance Methods

advance_rounded_base(period, tax_decl, tax_base) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_base_concept.rb, line 74
def advance_rounded_base(period, tax_decl, tax_base)
  year = period.year

  amount_for_calc = [0, tax_base].max
  if amount_for_calc > 100
    big_near_round_up(amount_for_calc, 100)
  else
    if year >= 2011
      big_tax_round_up(amount_for_calc)
    else
      big_tax_round_down(amount_for_calc)
    end
  end
end
calc_category() click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_base_concept.rb, line 32
def calc_category
  PayrollConcept::CALC_CATEGORY_NETTO
end
compute_result_value(period, is_tax_interest, is_tax_declared, taxable_health, taxable_social, taxable_base) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_base_concept.rb, line 36
def compute_result_value(period, is_tax_interest, is_tax_declared, taxable_health, taxable_social, taxable_base)
  if !is_tax_interest
    taxable_super = 0
  else
    taxable_super = taxable_base+taxable_health+taxable_social
  end

  tax_rounded_base(period, is_tax_declared, taxable_base, taxable_super)
end
dup_with_value(code, values) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_base_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_advance_base_concept.rb, line 46
def evaluate(period, tag_config, results)
  is_tax_interest = interest_result(results, TAG_AMOUNT_BASE)
  is_tax_declared = declared_result(results, TAG_AMOUNT_BASE)

  taxable_health = payment_result(results, TAG_HEALTH_BASE)
  taxable_social = payment_result(results, TAG_SOCIAL_BASE)
  taxable_base = income_base_result(results, TAG_AMOUNT_BASE)

  payment_value = compute_result_value(period, is_tax_interest, is_tax_declared,
                                       taxable_health, taxable_social, taxable_base)

  result_values = {income_base: payment_value}

  IncomeBaseResult.new(@tag_code, @code, self, result_values)
end
init_values(values) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_base_concept.rb, line 14
def init_values(values)
end
pending_codes() click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_base_concept.rb, line 24
def pending_codes
  [
      TaxIncomeBaseTag.new,
      TaxEmployersHealthTag.new,
      TaxEmployersSocialTag.new
  ]
end
tax_rounded_base(period, tax_decl, tax_income, tax_base) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_base_concept.rb, line 62
def tax_rounded_base(period, tax_decl, tax_income, tax_base)
  if tax_decl
    advance_rounded_base(period, tax_decl, tax_base)
  else
    if tax_income > tax_withhold_max(period.year)
      advance_rounded_base(period, tax_decl, tax_base)
    else
      0
    end
  end
end
tax_withhold_max(year) click to toggle source
# File lib/payrollee_cz/concepts/tax_advance_base_concept.rb, line 89
def tax_withhold_max(year)
  if year>=2004
    5000
  elsif year>=2001
    3000
  else
    2000
  end
end