class PayrolleeCz::TimesheetPeriodConcept
Constants
- TAG_SCHEDULE_WORK
Public Class Methods
new(tag_code, values)
click to toggle source
Calls superclass method
# File lib/payrollee_cz/concepts/timesheet_period_concept.rb, line 7 def initialize(tag_code, values) super(PayConceptGateway::REFCON_TIMESHEET_PERIOD, tag_code) init_values(values) end
Public Instance Methods
calc_category()
click to toggle source
# File lib/payrollee_cz/concepts/timesheet_period_concept.rb, line 28 def calc_category PayrollConcept::CALC_CATEGORY_TIMES end
compute_result_value(period, week_schedule_hours)
click to toggle source
# File lib/payrollee_cz/concepts/timesheet_period_concept.rb, line 32 def compute_result_value(period, week_schedule_hours) month_calendar_days(week_schedule_hours, period) end
day_of_week_from_ordinal(day_ordinal, calendar_beg_cwd)
click to toggle source
# File lib/payrollee_cz/concepts/timesheet_period_concept.rb, line 61 def day_of_week_from_ordinal(day_ordinal, calendar_beg_cwd) day_of_week = (((day_ordinal-1)+(calendar_beg_cwd-1))%7)+1 day_of_week end
dup_with_value(code, values)
click to toggle source
# File lib/payrollee_cz/concepts/timesheet_period_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/timesheet_period_concept.rb, line 36 def evaluate(period, tag_config, results) week_hours = week_schedule_result(results, TAG_SCHEDULE_WORK) hours_calendar = compute_result_value(period, week_hours) result_values = {month_schedule: hours_calendar} TimesheetResult.new(@tag_code, @code, self, result_values) end
hours_from_week(week_hours, day_ordinal, calendar_beg_cwd)
click to toggle source
# File lib/payrollee_cz/concepts/timesheet_period_concept.rb, line 54 def hours_from_week(week_hours, day_ordinal, calendar_beg_cwd) #calendar_day = Date.new(calendar_beg.year, calendar_beg.month, day_ordinal) day_of_week = day_of_week_from_ordinal(day_ordinal, calendar_beg_cwd) work_hours = week_hours[day_of_week-1] work_hours end
init_values(values)
click to toggle source
# File lib/payrollee_cz/concepts/timesheet_period_concept.rb, line 12 def init_values(values) end
month_calendar_days(week_hours, period)
click to toggle source
# File lib/payrollee_cz/concepts/timesheet_period_concept.rb, line 46 def month_calendar_days(week_hours, period) calendar_beg = Date.new(period.year, period.month, 1) calendar_beg_cwd = calendar_beg.cwday date_count = Time.days_in_month(period.month, period.year) hours_calendar = (1..date_count).each.map { |x| hours_from_week(week_hours, x, calendar_beg_cwd) } hours_calendar end
pending_codes()
click to toggle source
# File lib/payrollee_cz/concepts/timesheet_period_concept.rb, line 22 def pending_codes [ ScheduleWorkTag.new ] end