<%= l(:caption_materials) %>

<%= l(:caption_material_budget)%>

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

<%= l(:caption_material_costs) %>

<% @cost_object.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, :cost_object => @cost_object, :overridden_costs => 0.0, :units => 0) results[entry.cost_type.id.to_s] = result end result.overridden_costs += entry.real_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 %> <%= 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.real_costs) %>
<%= number_to_currency(@cost_object.spent_material) %>

<%= l(:caption_labor) %>

<%= l(:caption_labor_budget)%>

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

<%= l(:caption_labor_costs) %>

<% @cost_object.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, :overridden_costs => 0) result.hours = 0 results[entry.user.id.to_s] = result end result.overridden_costs += entry.real_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 %> <%= link_to "#{t.hours}h", {:controller => "timelog", :action => "details", :issue_id => issue} %> <%=h t.user.name %> <%= number_to_currency(t.real_costs) %>
<%= number_to_currency(@cost_object.spent_labor) %>