[#4182] Show the total Labor and Overhead values on the Contract details page.
This commit is contained in:
1 parent
b22db284c5
commit
f2e640b5f8
4 files changed
+62
-4
No files matched your search
@@ -5,4 +5,15 @@ module ContractsHelper
|
||||
d.overhead_budgets.build if d.overhead_budgets.empty?
|
||||
end
|
||||
end
|
||||
|
||||
def format_budget_for_deliverable(deliverable, total)
|
||||
# TODO LATER: calculate amount used
|
||||
if total > 0
|
||||
content_tag(:span, "0", :class => 'spent-amount') +
|
||||
" " +
|
||||
content_tag(:span, h(number_to_currency(total, :unit => '')), :class => 'total-amount')
|
||||
else
|
||||
'---'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -32,7 +32,15 @@ class Deliverable < ActiveRecord::Base
|
||||
write_attribute(:total, v)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def labor_budget_total
|
||||
labor_budgets.sum(:budget)
|
||||
end
|
||||
|
||||
def overhead_budget_total
|
||||
overhead_budgets.sum(:budget)
|
||||
end
|
||||
|
||||
if Rails.env.test?
|
||||
generator_for :title, :method => :next_title
|
||||
|
||||
|
||||
@@ -42,9 +42,12 @@
|
||||
<td class="title"><%= h deliverable.title %></td>
|
||||
<%# TODO: Status %>
|
||||
<td class="manager"><%= h deliverable.manager.try(:name) %></td>
|
||||
<%# TODO: deliverable calculations %>
|
||||
<td class="labor">---</td>
|
||||
<td class="overhead">---</td>
|
||||
<td class="labor">
|
||||
<%= format_budget_for_deliverable(deliverable, deliverable.labor_budget_total) %>
|
||||
</td>
|
||||
<td class="overhead">
|
||||
<%= format_budget_for_deliverable(deliverable, deliverable.overhead_budget_total) %>
|
||||
</td>
|
||||
<td class="fixed">---</td>
|
||||
<td><%= link_to(l(:button_edit), edit_contract_deliverable_path(@project, resource, deliverable), :class => 'icon icon-edit') %></td>
|
||||
<td><%= link_to(l(:button_delete), contract_deliverable_path(@project, resource, deliverable), :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %></td>
|
||||
|
||||
Reference in new issue
Block a user