diff --git a/app/views/cost_objects/_show_variable_cost_object.html.erb b/app/views/cost_objects/_show_variable_cost_object.html.erb index c2df2fb3dc..c922b57a92 100644 --- a/app/views/cost_objects/_show_variable_cost_object.html.erb +++ b/app/views/cost_objects/_show_variable_cost_object.html.erb @@ -22,16 +22,88 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

<%= VariableCostObject.human_attribute_name(:material_budget) %>

-
-
- - - - - - - - +
+
+
+
+ + + + + + + + + + + + + + + + <% @cost_object.material_budget_items.each do |material_budget_item| %> + + + + + + + <% end %> + <% if User.current.allowed_to?(:view_cost_rates, @project) %> + + <% end %> + +
+
+
+ + <%= MaterialBudgetItem.human_attribute_name(:units) %> + +
+
+
+
+
+ + <%= MaterialBudgetItem.human_attribute_name(:cost_type) %> + +
+
+
+
+
+ + <%= MaterialBudgetItem.human_attribute_name(:comment) %> + +
+
+
+
+
+ + <%= MaterialBudgetItem.human_attribute_name(: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 %><%= material_budget_item.costs_visible_by?(User.current) ? number_to_currency(material_budget_item.costs) : "" %>
<%= number_to_currency(@cost_object.material_budget) %>
+
+
+
+
+
+
+

<%= l(:caption_material_costs) %>

+
+
+
+ + + + + + + + - - - <% @cost_object.material_budget_items.each do |material_budget_item| %> - - - - - - - <% end %> - <% if User.current.allowed_to?(:view_cost_rates, @project) %> - - <% end %> - -
@@ -70,106 +142,38 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<%=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 %><%= material_budget_item.costs_visible_by?(User.current) ? number_to_currency(material_budget_item.costs) : "" %>
<%= number_to_currency(@cost_object.material_budget) %>
-
-
-
-
-
-

<%= l(:caption_material_costs) %>

-
-
- - - - - - - - - - - - - - - - - <% @cost_object.cost_entries.visible(User.current, @project).includes(:cost_type).group_by(&:work_package).each do |work_package, cost_entries| - entries = 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, overridden_costs: 0.0, units: 0) - results[entry.cost_type.id.to_s] = result - end + + + <% @cost_object.cost_entries.visible(User.current, @project).includes(:cost_type).group_by(&:work_package).each do |work_package, cost_entries| + entries = 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, 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 + result.overridden_costs += entry.real_costs + result.units += entry.units + results + end.values - entries.each do |c| - %> - - - - - - - <% end %> - <% end %> - <% if User.current.allowed_to?(:view_cost_rates, @project) %> - - <% end %> - -
-
-
- - <%= CostEntry.human_attribute_name(:work_package)%> - -
-
-
-
-
- - <%= CostEntry.human_attribute_name(:units) %> - -
-
-
-
-
- - <%= CostEntry.human_attribute_name(:cost_type) %> - -
-
-
-
-
- - <%= CostEntry.human_attribute_name(:costs) %> - -
-
-
<%= link_to_work_package work_package %><%= link_to pluralize(c.units, c.cost_type.unit, c.cost_type.unit_plural), {:controller => "/costlog", :action => "index", :cost_type_id => c.cost_type, :work_package_id => work_package} %><%= c.cost_type %><%= c.costs_visible_by?(User.current) ? number_to_currency(c.real_costs) : "" %>
<%= number_to_currency(@cost_object.spent_material) %>
-
+ entries.each do |c| + %> + + <%= link_to_work_package work_package %> + <%= link_to pluralize(c.units, c.cost_type.unit, c.cost_type.unit_plural), {:controller => "/costlog", :action => "index", :cost_type_id => c.cost_type, :work_package_id => work_package} %> + <%= c.cost_type %> + <%= c.costs_visible_by?(User.current) ? number_to_currency(c.real_costs) : "" %> + + <% end %> + <% end %> + <% if User.current.allowed_to?(:view_cost_rates, @project) %> + <%= number_to_currency(@cost_object.spent_material) %> + <% end %> + + +
+
@@ -180,161 +184,164 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

<%= VariableCostObject.human_attribute_name(:labor_budget)%>

-
-
- - - - - - - - - - + <% end %> + +
-
-
- - <%= LaborBudgetItem.human_attribute_name(:hours) %> - +
+
+
+ + + + + + + + + + - + - + - + - - - - <% @cost_object.labor_budget_items.each do |labor_budget_item| %> - - - - - <% if labor_budget_item.costs_visible_by?(User.current) %> - - <% else %> - + + + + + <% @cost_object.labor_budget_items.each do |labor_budget_item| %> + + + + + <% if labor_budget_item.costs_visible_by?(User.current) %> + + <% else %> + + <% end %> + <% end %> - - <% end %> - <% if User.current.allowed_to?(:view_hourly_rates, @project) || User.current.allowed_to?(:view_own_hourly_rate, @project) %> - - <% end %> - -
+
+
+ + <%= LaborBudgetItem.human_attribute_name(:hours) %> + +
- -
-
-
- - <%= LaborBudgetItem.human_attribute_name(:user) %> - +
+
+
+ + <%= LaborBudgetItem.human_attribute_name(:user) %> + +
- -
-
-
- - <%= LaborBudgetItem.human_attribute_name(:comment) %> - +
+
+
+ + <%= LaborBudgetItem.human_attribute_name(:comment) %> + +
- -
-
-
- - <%= LaborBudgetItem.human_attribute_name(:budget) %> - +
+
+
+ + <%= LaborBudgetItem.human_attribute_name(:budget) %> + +
- -
<%= labor_budget_item.hours %>h<%=h labor_budget_item.user.name %><%=h labor_budget_item.comments %> - <%= number_to_currency(labor_budget_item.costs)%> -
<%= 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) %>
-
+ <% if User.current.allowed_to?(:view_hourly_rates, @project) || User.current.allowed_to?(:view_own_hourly_rate, @project) %> +
<%= number_to_currency(@cost_object.labor_budget) %>
+
+
-

<%= l(:caption_labor_costs) %>

-
-
- - - - - - - - - -
-
-
- - <%= TimeEntry.human_attribute_name(:work_package) %> - +
+
+
+ + + + + + + + + + - + - + - + - - - - <% @cost_object.time_entries.visible(User.current, @project).group_by(&:work_package).each do |work_package, time_entries| - entries = 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 + + + + + <% @cost_object.time_entries.visible(User.current, @project).group_by(&:work_package).each do |work_package, time_entries| + entries = 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 + result.overridden_costs += entry.real_costs + result.hours += entry.hours + results + end.values - entries.each do |t| - %> - - - - - - + entries.each do |t| + %> + + + + + + + <% end %> <% end %> - <% end %> - + - -
+
+
+ + <%= TimeEntry.human_attribute_name(:work_package) %> + +
- -
-
-
- - <%= TimeEntry.human_attribute_name(:hours) %> - +
+
+
+ + <%= TimeEntry.human_attribute_name(:hours) %> + +
- -
-
-
- - <%= TimeEntry.human_attribute_name(:user) %> - +
+
+
+ + <%= TimeEntry.human_attribute_name(:user) %> + +
- -
-
-
- - <%= TimeEntry.human_attribute_name(:costs) %> - +
+
+
+ + <%= TimeEntry.human_attribute_name(:costs) %> + +
- -
<%= link_to_work_package work_package %><%= link_to "#{t.hours}h", {:controller => "/timelog", :action => "index", :work_package_id => work_package} %><%=h t.user.name %><%= number_to_currency(t.real_costs) %>
<%= link_to_work_package work_package %><%= link_to "#{t.hours}h", {:controller => "/timelog", :action => "index", :work_package_id => work_package} %><%=h t.user.name %><%= number_to_currency(t.real_costs) %>
<%= number_to_currency(@cost_object.spent_labor) %>
<%= number_to_currency(@cost_object.spent_labor) %>
-
+ +
+
+