class PayrolleeCz::TaxIncomeBaseConcept
Public Class Methods
new(tag_code, values)
click to toggle source
Calls superclass method
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 5 def initialize(tag_code, values) super(PayConceptGateway::REFCON_TAX_INCOME_BASE, tag_code) init_values(values) end
Public Instance Methods
calc_category()
click to toggle source
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 22 def calc_category PayrollConcept::CALC_CATEGORY_GROSS end
compute_result_value(tag_config, results)
click to toggle source
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 26 def compute_result_value(tag_config, results) result_income = 0 if !interest? result_income = 0 else result_income = results.inject(0) do |agr, term_item| term_key = term_item.first term_result = term_item.last agr + sum_term_for(tag_config, tag_code, term_key, term_result) end end result_income end
declared?()
click to toggle source
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 66 def declared? @declare_code!=0 end
dup_with_value(code, values)
click to toggle source
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 15 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_income_base_concept.rb, line 40 def evaluate(period, tag_config, results) result_income = compute_result_value(tag_config, results) result_values = { income_base: result_income, interest_code: @interest_code, declare_code: @declare_code } IncomeBaseResult.new(@tag_code, @code, self, result_values) end
export_xml(xml_builder)
click to toggle source
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 70 def export_xml(xml_builder) attributes = {} attributes[:interest_code] = @interest_code attributes[:declare_code] = @declare_code xml_builder.spec_value(attributes) end
init_values(values)
click to toggle source
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 10 def init_values(values) @interest_code = values[:interest_code] || 0 @declare_code = values[:declare_code] || 0 end
interest?()
click to toggle source
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 62 def interest? @interest_code!=0 end
sum_term_for(tag_config, tag_code, result_key, result_item)
click to toggle source
# File lib/payrollee_cz/concepts/tax_income_base_concept.rb, line 52 def sum_term_for(tag_config, tag_code, result_key, result_item) tag_config_item = tag_config.find_tag(result_key.code) if result_item.summary_for?(tag_code) if tag_config_item.tax_advance? return result_item.payment end end return 0 end