<% @report.hours.collect {|h| h[criterias[level]].to_s}.uniq.each do |value| %> <% hours_for_value = select_hours(hours, criterias[level], value) -%> <% next if hours_for_value.empty? -%> <%= ("" * level).html_safe %> <%= format_criteria_value(@report.available_criteria[criterias[level]], value) %> <%= ("" * (criterias.length - level - 1)).html_safe -%> <% total = 0 -%> <% @report.periods.each do |period| -%> <% sum = sum_hours(select_hours(hours_for_value, @report.columns, period.to_s)); total += sum -%> <%= html_hours(format_hours(sum)) if sum > 0 %> <% end -%> <%= html_hours(format_hours(total)) if total > 0 %> <% if criterias.length > level+1 -%> <%= render(:partial => 'report_criteria', :locals => {:criterias => criterias, :hours => hours_for_value, :level => (level + 1)}) %> <% end -%> <% end %>