class PayrolleeCz::SalaryMonthlyConcept

Constants

TAG_HOURS_ABSENCE
TAG_HOURS_WORKING
TAG_TIMESHEET_PERIOD

Attributes

amount_monthly[R]

Public Class Methods

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

Public Instance Methods

calc_category() click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 44
def calc_category
  PayrollConcept::CALC_CATEGORY_AMOUNT
end
compute_result_value(timesheet_hours, working_hours, absence_hours) click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 48
def compute_result_value(timesheet_hours, working_hours, absence_hours)
  schedule_factor = big_decimal_cast(1.0)
  amount_factor = factorize_amount(amount_monthly, schedule_factor)

  payment_from_amount(amount_factor, timesheet_hours, working_hours, absence_hours)
end
dup_with_value(code, values) click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 20
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/salary_monthly_concept.rb, line 55
def evaluate(period, tag_config, results)
  timesheet_hours = timesheet_hours_result(results, TAG_TIMESHEET_PERIOD)
  working_hours = term_hours_result(results, TAG_HOURS_WORKING)
  absence_hours = term_hours_result(results, TAG_HOURS_ABSENCE)

  payment_value = compute_result_value(timesheet_hours, working_hours, absence_hours)

  result_values = {payment: payment_value}

  PaymentResult.new(@tag_code, @code, self, result_values)
end
export_value_result() click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 86
def export_value_result
  format_amount = amount_monthly.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1 ")
  "#{format_amount} CZK"
end
export_xml(xml_builder) click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 76
def export_xml(xml_builder)
  attributes = {}
  attributes[:amount_monthly] = @amount_monthly
  xml_builder.spec_value(xml_value, attributes)
end
factorize_amount(amount, schedule_factor) click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 67
def factorize_amount(amount, schedule_factor)
  amount_factor = big_multi(amount, schedule_factor)
end
init_values(values) click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 16
def init_values(values)
  @amount_monthly = values[:amount_monthly]
end
payment_from_amount(big_amount, timesheet_hours, working_hours, absence_hours) click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 71
def payment_from_amount(big_amount, timesheet_hours, working_hours, absence_hours)
  salaried_hours = [0, working_hours-absence_hours].max
  payment_value = big_multi_and_div(salaried_hours, big_amount, timesheet_hours)
end
pending_codes() click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 27
def pending_codes
  [
      HoursWorkingTag.new,
      HoursAbsenceTag.new
  ]
end
summary_codes() click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 34
def summary_codes
  [
      IncomeGrossTag.new,
      IncomeNettoTag.new,
      InsuranceSocialBaseTag.new,
      InsuranceHealthBaseTag.new,
      TaxIncomeBaseTag.new
  ]
end
xml_value() click to toggle source
# File lib/payrollee_cz/concepts/salary_monthly_concept.rb, line 82
def xml_value
  "#{amount_monthly} CZK"
end