[#6636] Show deliverable calculations for Labor in the finance lightbox
This commit is contained in:
@@ -6,3 +6,56 @@
|
||||
</div>
|
||||
|
||||
<h2><%= h(deliverable.title) %></h2>
|
||||
|
||||
<h3>Activities</h3>
|
||||
|
||||
<table id="deliverable-labor-activities">
|
||||
<thead>
|
||||
<th><%= l(:field_labor) %></th>
|
||||
<th colspan="2"><%= l(:field_cost) %></th>
|
||||
<th colspan="2"><%= l(:field_hours) %></th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<%# Each labor activity + non-budgeted activities %>
|
||||
<% deliverable.billable_time_entry_activities.each do |activity| %>
|
||||
|
||||
<% content_tag_for(:tr, activity, :class => 'labor ' + cycle('even','')) do %>
|
||||
<td class="labor">
|
||||
<%= h(activity.name) %>
|
||||
</td>
|
||||
<td class="spent-amount labor">
|
||||
<%= number_to_currency(deliverable.spent_for_activity(activity), :precision => 0) %>
|
||||
</td>
|
||||
<td class="total-amount labor">
|
||||
<%= number_to_currency(deliverable.budget_for_activity(activity), :precision => 0) %>
|
||||
</td>
|
||||
<td class="spent-hours labor">
|
||||
<%= number_with_precision(deliverable.hours_spent_for_activity(activity), :precision => 0) %>
|
||||
</td>
|
||||
<td class="total-hours labor">
|
||||
<%= number_with_precision(deliverable.hours_budget_for_activity(activity), :precision => 0) %>
|
||||
</td>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<tr class="total labor">
|
||||
<td class="labor">
|
||||
Totals
|
||||
</td>
|
||||
<td class="spent-amount labor">
|
||||
$80
|
||||
</td>
|
||||
<td class="total-amount labor">
|
||||
$100
|
||||
</td>
|
||||
<td class="spent-hours labor">
|
||||
1.5
|
||||
</td>
|
||||
<td class="total-hours labor">
|
||||
2
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -102,3 +102,5 @@ en:
|
||||
text_contract_closed_warning: "This contract is closed and cannot be saved without changing it's status to Open."
|
||||
field_time_entry_activity: "Activity"
|
||||
text_deliverable_spending_summary: "You've spent %{spent} / %{total} and %{hours} Billable Hours"
|
||||
field_cost: "Cost"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
|
||||
@contract = Contract.generate!(:project => @project, :billable_rate => 10)
|
||||
@manager = User.generate!
|
||||
@deliverable1 = RetainerDeliverable.spawn(:contract => @contract, :manager => @manager, :title => "Retainer Title", :start_date => '2010-01-01', :end_date => '2010-03-31')
|
||||
@deliverable1.labor_budgets << LaborBudget.spawn(:budget => 100, :hours => 10)
|
||||
@deliverable1.labor_budgets << LaborBudget.spawn(:budget => 100, :hours => 10, :time_entry_activity => @billable_activity)
|
||||
@deliverable1.overhead_budgets << OverheadBudget.spawn(:budget => 200, :hours => 10)
|
||||
|
||||
@deliverable1.save!
|
||||
@@ -54,10 +54,13 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
|
||||
|
||||
|
||||
context "for an authorized request" do
|
||||
should "render the finance report title section for the deliverable" do
|
||||
setup do
|
||||
visit "/projects/#{@project.id}/contracts/#{@contract.id}/deliverables/#{@deliverable1.id}/finances"
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "render the finance report title section for the deliverable" do
|
||||
assert_select "h2", :text => /#{@deliverable1.title}/
|
||||
|
||||
assert_select "div#summary" do
|
||||
@@ -67,5 +70,28 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
should "render the activities table for the deliverable" do
|
||||
assert_select "h3", :text => /Activities/
|
||||
|
||||
assert_select "table#deliverable-labor-activities" do
|
||||
assert_select "tr" do
|
||||
assert_select "td.labor", :text => /#{@billable_activity.name}/
|
||||
assert_select "td.spent-amount.labor", :text => /\$200/
|
||||
assert_select "td.total-amount.labor", :text => /\$300/
|
||||
assert_select "td.spent-hours.labor", :text => /2/
|
||||
assert_select "td.total-hours.labor", :text => /30/ # 3 month retainer * 10
|
||||
end
|
||||
|
||||
assert_select "tr.total" do
|
||||
assert_select "td.labor", :text => /Totals/
|
||||
assert_select "td.spent-amount.labor", :text => /\$200/
|
||||
assert_select "td.total-amount.labor", :text => /\$300/
|
||||
assert_select "td.spent-hours.labor", :text => /2/
|
||||
assert_select "td.total-hours.labor", :text => /30/
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user