<%= l(:caption_materials) %>

<%= l(:caption_material_budget)%>

<% @deliverable.deliverable_costs.each do |deliverable_cost| %> <% end %>
<%= l(:caption_cost_unit_plural)%> <%= l(:caption_cost_type) %> <%= l(:caption_comment) %> <%= l(:caption_budget) %>
<%=h pluralize(deliverable_cost.units, deliverable_cost.cost_type.unit, deliverable_cost.cost_type.unit_plural) %> <%=h deliverable_cost.cost_type.name %> <%=h deliverable_cost.comments %> <%= number_to_currency(deliverable_cost.costs) %>
<%= number_to_currency(@deliverable.material_budget) %>

<%= l(:caption_material_costs) %>

<% @deliverable.issues.each do |issue| cost_entries = issue.cost_entries.inject(Hash.new) do |results, entry| result = results[entry.cost_type.id.to_s] unless result result = CostEntry.new(:cost_type => entry.cost_type, :deliverable => @deliverable, :costs => 0, :units => 0) results[entry.cost_type.id.to_s] = result end result.costs += entry.costs result.units += entry.units results end.values cost_entries.each do |c| %> <% end %> <% end %>
<%= l(:caption_issue)%> <%= l(:caption_cost_unit_plural) %> <%= l(:caption_cost_type) %> <%= l(:caption_costs) %>
<%= link_to_issue issue %>: <%= h(truncate(issue.subject, 50)) -%> <%= link_to pluralize(c.units, c.cost_type.unit, c.cost_type.unit_plural), {:controller => "costlog", :action => "details", :cost_type_id => c.cost_type, :issue_id => issue} %> <%= c.cost_type %> <%= number_to_currency(c.costs) %>
<%= number_to_currency(@deliverable.spent_material) %>

<%= l(:caption_labor) %>

<%= l(:caption_labor_budget)%>

<% @deliverable.deliverable_hours.each do |deliverable_hour| %> <% end %> <% if User.current.allowed_to?(:view_all_rates, @project) %> <% end %>
<%= l(:field_hours)%> <%= l(:label_user) %> <%= l(:caption_comment) %> <%= l(:caption_budget) %>
<%= deliverable_hour.hours %>h <%=h deliverable_hour.user.name %> <%=h deliverable_hour.comments %> <%= number_to_currency(deliverable_hour.costs) %>
<%= number_to_currency(@deliverable.labor_budget) %>

<%= l(:caption_labor_costs) %>

<% @deliverable.issues.each do |issue| time_entries = issue.time_entries.inject(Hash.new) do |results, entry| result = results[entry.user.id.to_s] unless result result = TimeEntry.new(:user => entry.user, :costs => 0, :hours => 0) results[entry.user.id.to_s] = result end result.costs += entry.costs result.hours += entry.hours results end.values time_entries.each do |t| %> <% end %> <% end %>
<%= l(:caption_issue)%> <%= l(:field_hours)%> <%= l(:label_user) %> <%= l(:caption_costs) %>
<%= link_to_issue issue %>: <%= h(truncate(issue.subject, 50)) -%> <%= link_to t.hours, {:controller => "timelog", :action => "details", :issue_id => issue} %> <%= t.user.name %> <%= number_to_currency(t.costs) %>
<%= number_to_currency(@deliverable.spent_material) %>