[#6573] Add the total spent and total budget to the deliverable row

This commit is contained in:
Eric Davis
2011-09-14 13:13:46 -07:00
parent f5ca74e420
commit 668b1e0991
3 changed files with 49 additions and 2 deletions
+2
View File
@@ -121,6 +121,7 @@
<th colspan="2"><%= l(:field_labor) %></th>
<th colspan="2"><%= l(:field_overhead) %></th>
<th colspan="2"><%= l(:field_fixed) %></th>
<th colspan="2"><%= l(:field_total) %></th>
</tr>
</thead>
@@ -135,6 +136,7 @@
<%= format_budget_for_deliverable(deliverable, deliverable.labor_budget_spent, deliverable.labor_budget_total, :class => 'labor') %>
<%= format_budget_for_deliverable(deliverable, deliverable.overhead_spent, deliverable.overhead_budget_total, :class => 'overhead') %>
<%= format_budget_for_deliverable(deliverable, deliverable.fixed_budget_total_spent, deliverable.fixed_budget_total, :class => 'fixed') %>
<%= format_budget_for_deliverable(deliverable, deliverable.total_spent, deliverable.total, :class => 'total') %>
<% end %>
<tr id="deliverable_details_<%= h(deliverable.id) %>" class="ign">
+1 -1
View File
@@ -1,6 +1,6 @@
<% validated_period = validate_period(deliverable, period) %>
<td colspan="11" class="deliverable_details_outer_wrapper_<%= h(deliverable.id) %>">
<td colspan="13" class="deliverable_details_outer_wrapper_<%= h(deliverable.id) %>">
<div class="expanded">
+46 -1
View File
@@ -261,7 +261,52 @@ class ContractsShowTest < ActionController::IntegrationTest
assert_select "td.fixed.spent-amount", :text => /1,000/
end
end
should "show the total budget for a Deliverable" do
@manager = User.generate!
@deliverable1 = FixedDeliverable.generate!(:contract => @contract, :manager => @manager, :total => '5404')
visit_contract_page(@contract)
assert_select "table#deliverables" do
assert_select "td.total.total-amount", :text => /5,404/
end
end
should "show the total spent for a Deliverable" do
configure_overhead_plugin
@manager = User.generate!
@contract.billable_rate = 200
assert @contract.save
@deliverable1 = HourlyDeliverable.generate!(:contract => @contract, :manager => @manager, :total => '1504')
@issue1 = Issue.generate_for_project!(@project)
@time_entry1 = TimeEntry.generate!(:issue => @issue1,
:project => @project,
:activity => @billable_activity,
:spent_on => Date.today,
:hours => 15,
:user => @manager)
@rate = Rate.generate!(:project => @project,
:user => @manager,
:date_in_effect => Date.yesterday,
:amount => 100)
@deliverable1.issues << @issue1
assert_equal 1, @deliverable1.issues.count
visit_contract_page(@contract)
assert_select "table#deliverables" do
# Using the contract billable rate and not the user rate because it's income, not an expense
assert_select "td.total.spent-amount", :text => /3,000/
end
end
should "show each fixed budget item in the details for the Deliverable" do
@manager = User.generate!