diff --git a/app/helpers/reporting_helper.rb b/app/helpers/reporting_helper.rb index 510b1fdd2b..3d6b98016c 100644 --- a/app/helpers/reporting_helper.rb +++ b/app/helpers/reporting_helper.rb @@ -66,6 +66,11 @@ module ReportingHelper @show_row[key][value] ||= field_representation_map(key, value) end + def raw_field(key, value) + @raw_row ||= Hash.new { |h,k| h[k] = {}} + @raw_row[key][value] ||= field_sort_map(key, value) + end + def cost_object_link(cost_object_id) co = CostObject.find(cost_object_id) if User.current.allowed_to_with_inheritance?(:view_cost_objects, co.project) @@ -98,6 +103,15 @@ module ReportingHelper end end + def field_sort_map(key, value) + return "" if value.blank? + case key.to_sym + when :issue_id, :tweek, :tmonth, :week then value.to_i + when :spent_on then value.to_date.mjd + else field_representation_map(key, value) + end + end + def show_result(row, unit_id = @unit_id) case unit_id when -1 then l_hours(row.units) diff --git a/app/views/cost_reports/_cost_entry_table.rhtml b/app/views/cost_reports/_cost_entry_table.rhtml index d8f164918b..390c8a56e7 100644 --- a/app/views/cost_reports/_cost_entry_table.rhtml +++ b/app/views/cost_reports/_cost_entry_table.rhtml @@ -23,9 +23,13 @@ <% @query.each_direct_result do |result| %> - <% list.each do |field| %><%= show_field field, result.fields[field.to_s] %><% end %> - ><%= show_result(result, result.fields['cost_type_id'].to_i) %> - ><%= show_result(result, 0) %> + <% list.each do |field| %> + > + <%= show_field field, result.fields[field.to_s] %> + + <% end %> + ><%= show_result(result, result.fields['cost_type_id'].to_i) %> + ><%= show_result(result, 0) %> <%= link_to_if_authorized image_tag('edit.png'), action_for(result, :action => 'edit'), :title => l(:button_edit) %> diff --git a/app/views/cost_reports/_simple_cost_report_table.rhtml b/app/views/cost_reports/_simple_cost_report_table.rhtml index 7c91e7db68..c195c90ff6 100644 --- a/app/views/cost_reports/_simple_cost_report_table.rhtml +++ b/app/views/cost_reports/_simple_cost_report_table.rhtml @@ -28,7 +28,9 @@ show_units = list.include? "cost_type_id" <% @query.each do |result| %> - <%= show_row result %> + > + <%= show_row result %> + <%= result.count %> <% if show_units %> ><%= show_result result, result.fields[:cost_type_id].to_i %>