class PayrolleeCz::PayrollConcept
Constants
- CALC_CATEGORY_AMOUNT
- CALC_CATEGORY_FINAL
- CALC_CATEGORY_GROSS
- CALC_CATEGORY_NETTO
- CALC_CATEGORY_START
- CALC_CATEGORY_TIMES
- TERM_BEG_FINISHED
- TERM_END_FINISHED
Attributes
tag_code[R]
tag_pending_codes[R]
Public Class Methods
new(code_refer, tag_code)
click to toggle source
Calls superclass method
PayrolleeCz::CodeNameRefer::new
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 17 def initialize(code_refer, tag_code) super(code_refer.code, code_refer.name) @tag_code = tag_code @tag_pending_codes = nil end
Public Instance Methods
<=>(concept_other)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 188 def <=>(concept_other) if count_pending_codes(tag_pending_codes, concept_other.tag_code)!=0 return 1 elsif count_pending_codes(concept_other.tag_pending_codes, tag_code)!=0 return -1 elsif count_summary_codes(summary_codes, concept_other.tag_code)!=0 return -1 elsif count_summary_codes(concept_other.summary_codes, tag_code)!=0 return 1 elsif calc_category == concept_other.calc_category tag_code <=> concept_other.tag_code else calc_category <=> concept_other.calc_category end end
big_decimal_cast(number)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 297 def big_decimal_cast(number) BigDecimal.new(number, 15) end
big_div(op1, op2)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 230 def big_div(op1, op2) big_op1 = BigDecimal.new(op1, 15) big_op2 = BigDecimal.new(op2, 15) if (big_op2 == 0) return BigDecimal(0, 15) end return big_op1/big_op2 end
big_insurance_round_up(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 249 def big_insurance_round_up(value_dec) round_up_to_big(value_dec) end
big_multi(op1, op2)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 224 def big_multi(op1, op2) big_op1 = BigDecimal.new(op1, 15) big_op2 = BigDecimal.new(op2, 15) return big_op1*big_op2 end
big_multi_and_div(op1, op2, div)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 239 def big_multi_and_div(op1, op2, div) big_op1 = BigDecimal.new(op1, 15) big_op2 = BigDecimal.new(op2, 15) big_div = BigDecimal.new(div, 15) if (big_div == 0) return BigDecimal(0, 15) end return big_op1*big_op2/big_div end
big_near_round_down(value_dec, nearest=100)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 293 def big_near_round_down(value_dec, nearest=100) big_multi(round_down_to_big(big_div(value_dec, nearest)), nearest) end
big_near_round_up(value_dec, nearest=100)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 289 def big_near_round_up(value_dec, nearest=100) big_multi(round_up_to_big(big_div(value_dec, nearest)), nearest) end
big_tax_round_down(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 265 def big_tax_round_down(value_dec) round_down_to_big(value_dec) end
big_tax_round_up(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 257 def big_tax_round_up(value_dec) round_up_to_big(value_dec) end
calc_category()
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 49 def calc_category CALC_CATEGORY_START end
count_pending_codes(concept_pending, code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 204 def count_pending_codes(concept_pending, code) _codes = concept_pending.select { |x| x.code==code } _codes.count end
count_summary_codes(concept_summary, code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 209 def count_summary_codes(concept_summary, code) _codes = concept_summary.select { |x| x.code==code } _codes.count end
day_end_result(results, tag_code, default_value)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 179 def day_end_result(results, tag_code, default_value) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? default_value else result_for_tag.day_ord_end end end
day_from_result(results, tag_code, default_value)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 170 def day_from_result(results, tag_code, default_value) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? default_value else result_for_tag.day_ord_from end end
declared_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 143 def declared_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? false else result_for_tag.declared? end end
description()
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 27 def description name end
employee_income_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 71 def employee_income_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? big_decimal_cast(0) else result_for_tag.employee_base end end
employer_income_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 80 def employer_income_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? big_decimal_cast(0) else result_for_tag.employer_base end end
export_value_result()
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 34 def export_value_result end
export_xml(xml_builder)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 31 def export_xml(xml_builder) end
fix_insurance_round_up(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 253 def fix_insurance_round_up(value_dec) round_up_to_fix(value_dec) end
fix_tax_round_down(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 269 def fix_tax_round_down(value_dec) round_down_to_fix(value_dec) end
fix_tax_round_up(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 261 def fix_tax_round_up(value_dec) round_up_to_fix(value_dec) end
get_result_by(results, pay_tag)
click to toggle source
get term from Results by key of tag
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 215 def get_result_by(results, pay_tag) result_hash = results.select { |key,_| key.code==pay_tag } if result_hash.empty? nil else result_hash.values[0] end end
income_base_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 89 def income_base_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? big_decimal_cast(0) else result_for_tag.income_base end end
init_code(code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 23 def init_code(code) @tag_code = code end
interest_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 134 def interest_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? false else result_for_tag.interest? end end
month_schedule_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 161 def month_schedule_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? Array.new(31) {0} else result_for_tag.month_schedule end end
payment_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 98 def payment_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? big_decimal_cast(0) else result_for_tag.payment end end
pending_codes()
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 41 def pending_codes [] end
round_down_to_big(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 281 def round_down_to_big(value_dec) BigDecimal.new(value_dec < 0 ? -value_dec.abs.floor : value_dec.abs.floor) end
round_down_to_fix(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 285 def round_down_to_fix(value_dec) (value_dec < 0 ? -value_dec.abs.floor : value_dec.abs.floor) end
round_up_to_big(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 273 def round_up_to_big(value_dec) BigDecimal.new(value_dec < 0 ? -value_dec.abs.ceil : value_dec.abs.ceil) end
round_up_to_fix(value_dec)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 277 def round_up_to_fix(value_dec) (value_dec < 0 ? -value_dec.abs.ceil : value_dec.abs.ceil) end
set_pending_codes(pending_codes)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 37 def set_pending_codes(pending_codes) @tag_pending_codes = pending_codes.dup end
summary_codes()
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 45 def summary_codes [] end
tax_claim_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 116 def tax_claim_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? big_decimal_cast(0) else result_for_tag.tax_relief end end
tax_payment_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 107 def tax_payment_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? big_decimal_cast(0) else result_for_tag.payment end end
tax_relief_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 125 def tax_relief_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? big_decimal_cast(0) else result_for_tag.tax_relief end end
term_hours_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 62 def term_hours_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? 0 else result_for_tag.hours end end
timesheet_hours_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 53 def timesheet_hours_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? 0 else result_for_tag.hours end end
week_schedule_result(results, tag_code)
click to toggle source
# File lib/payrollee_cz/core_items/payroll_concept.rb, line 152 def week_schedule_result(results, tag_code) result_for_tag = get_result_by(results, tag_code) if result_for_tag.nil? Array.new(7) {0} else result_for_tag.week_schedule end end