[#6636] Add Users/Overhead table to the deliverable finance report

This commit is contained in:
Eric Davis
2011-10-13 11:30:25 -07:00
parent 084ab1dd96
commit f4fb025c13
2 changed files with 55 additions and 0 deletions

View File

@@ -154,4 +154,42 @@
</tbody>
</table>
<table id="deliverable-overhead-users" class="striped-contract-style">
<thead>
<th><%= l(:field_overhead) %></th>
<th><%= l(:field_cost) %></th>
<th><%= l(:field_hours) %></th>
</thead>
<tbody>
<% deliverable.users_with_non_billable_time.sort.each do |user| %>
<% content_tag_for(:tr, user, :class => 'overhead ' + cycle('even','')) do %>
<td class="overhead">
<%= h(user.name) %>
</td>
<td class="amount-cost overhead">
<%= number_to_currency(deliverable.spent_for_user(user, false), :precision => 0) %>
</td>
<td class="time-cost overhead">
<%= number_with_precision(deliverable.hours_spent_for_user(user, false), :precision => 0) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row overhead">
<td class="overhead">
Totals
</td>
<td class="amount-cost overhead">
<%= number_to_currency(deliverable.overhead_spent, :precision => 0) %>
</td>
<td class="time-cost overhead">
<%= number_with_precision(deliverable.overhead_hours_spent_total, :precision => 0) %>
</td>
</tr>
</tbody>
</table>
</div><%# /div.users %>

View File

@@ -137,5 +137,22 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
end
end
should "render the overhead finances for each user for the deliverable" do
assert_select "table#deliverable-overhead-users" do
assert_select "tr" do
assert_select "td.overhead", :text => /#{@manager.name}/
assert_select "td.amount-cost.overhead", :text => /\$500/
assert_select "td.time-cost.overhead", :text => /5/
end
assert_select "tr.summary-row" do
assert_select "td.overhead", :text => /Totals/
assert_select "td.amount-cost.overhead", :text => /\$500/
assert_select "td.time-cost.overhead", :text => /5/
end
end
end
end
end