[#6636] Add overhead table to the deliverable finance report

This commit is contained in:
Eric Davis
2011-10-13 09:28:31 -07:00
parent 1f9cd9e86f
commit acc825a4fe
4 changed files with 107 additions and 4 deletions
+4
View File
@@ -274,6 +274,10 @@ class Deliverable < ActiveRecord::Base
project.activities.select {|activity| activity.billable? }
end
def non_billable_time_entry_activities
project.activities.reject {|activity| activity.billable? }
end
# Total amount spent ($) for a given activity
def spent_for_activity(activity)
issues.all.inject(0.0) do |all_issues_total, issue|
+50
View File
@@ -59,3 +59,53 @@
</tbody>
</table>
<table id="deliverable-overhead-activities">
<thead>
<th><%= l(:field_overhead) %></th>
<th colspan="2"><%= l(:field_cost) %></th>
<th colspan="2"><%= l(:field_hours) %></th>
</thead>
<tbody>
<% deliverable.non_billable_time_entry_activities.each do |activity| %>
<% content_tag_for(:tr, activity, :class => 'overhead ' + cycle('even','')) do %>
<td class="overhead">
<%= h(activity.name) %>
</td>
<td class="spent-amount overhead">
<%= number_to_currency(deliverable.spent_for_activity(activity), :precision => 0) %>
</td>
<td class="total-amount overhead">
<%= number_to_currency(deliverable.budget_for_activity(activity), :precision => 0) %>
</td>
<td class="spent-hours overhead">
<%= number_with_precision(deliverable.hours_spent_for_activity(activity), :precision => 0) %>
</td>
<td class="total-hours overhead">
<%= number_with_precision(deliverable.hours_budget_for_activity(activity), :precision => 0) %>
</td>
<% end %>
<% end %>
<tr class="total overhead">
<td class="overhead">
Totals
</td>
<td class="spent-amount overhead">
<%= number_to_currency(deliverable.overhead_spent, :precision => 0) %>
</td>
<td class="total-amount overhead">
<%= number_to_currency(deliverable.overhead_budget_total, :precision => 0) %>
</td>
<td class="spent-hours overhead">
<%= number_with_precision(deliverable.overhead_hours_spent_total, :precision => 0) %>
</td>
<td class="total-hours overhead">
<%= number_with_precision(deliverable.overhead_budget_hours, :precision => 0) %>
</td>
</tr>
</tbody>
</table>