Class: RedmineRate::Hooks::PluginTimesheetViewsTimesheetTimeEntrySumHook

Inherits:
Redmine::Hook::ViewListener
  • Object
show all
Includes:
TimesheetHookHelper
Defined in:
lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook.rb

Instance Method Summary collapse

Methods included from TimesheetHookHelper

#cost_item, #td_cell

Instance Method Details

#plugin_timesheet_views_timesheet_time_entry_sum(context = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook.rb', line 6

def plugin_timesheet_views_timesheet_time_entry_sum(context={})
  time_entries = context[:time_entries]
  costs = time_entries.collect {|time_entry| cost_item(time_entry)}.compact.sum
  if costs >= 0
    return td_cell(number_to_currency(costs))
  else
    return td_cell(' ')
  end
end