class PayrolleeCz::TimesheetWorkConcept

Constants

TAG_SCHEDULE_TERM
TAG_TIMESHEET_PERIOD

Public Class Methods

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

Public Instance Methods

calc_category() click to toggle source
# File lib/payrollee_cz/concepts/timesheet_work_concept.rb, line 30
def calc_category
  PayrollConcept::CALC_CATEGORY_TIMES
end
compute_result_value(month_schedule_hours, day_ord_from, day_ord_end) click to toggle source
# File lib/payrollee_cz/concepts/timesheet_work_concept.rb, line 34
def compute_result_value(month_schedule_hours, day_ord_from, day_ord_end)
  timesheet_period = month_schedule_hours.to_enum.with_index(1).to_a

  hours_calendar = timesheet_period.map do |x, day|
    hours_from_calendar(day_ord_from, day_ord_end, day, x)
  end
  hours_calendar
end
dup_with_value(code, values) click to toggle source
# File lib/payrollee_cz/concepts/timesheet_work_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/timesheet_work_concept.rb, line 43
def evaluate(period, tag_config, results)
  day_ord_from = day_from_result(results, TAG_SCHEDULE_TERM, PayrollConcept::TERM_BEG_FINISHED)

  day_ord_end = day_end_result(results, TAG_SCHEDULE_TERM, PayrollConcept::TERM_END_FINISHED)

  month_schedule = month_schedule_result(results, TAG_TIMESHEET_PERIOD)

  hours_calendar = compute_result_value(month_schedule, day_ord_from, day_ord_end)

  result_values = {month_schedule: hours_calendar}

  TimesheetResult.new(@tag_code, @code, self, result_values)
end
hours_from_calendar(day_ord_from, day_ord_end, day_ordinal, work_hours) click to toggle source
# File lib/payrollee_cz/concepts/timesheet_work_concept.rb, line 57
def hours_from_calendar(day_ord_from, day_ord_end, day_ordinal, work_hours)
  hours_in_day = work_hours
  hours_in_day = 0 if (day_ord_from > day_ordinal)
  hours_in_day = 0 if (day_ord_end < day_ordinal)
  return hours_in_day
end
init_values(values) click to toggle source
# File lib/payrollee_cz/concepts/timesheet_work_concept.rb, line 13
def init_values(values)
end
pending_codes() click to toggle source
# File lib/payrollee_cz/concepts/timesheet_work_concept.rb, line 23
def pending_codes
  [
      TimesheetPeriodTag.new,
      ScheduleTermTag.new
  ]
end