[#4183] Implemented Contract#total_budget.

This commit is contained in:
Eric Davis
2010-07-07 16:01:47 -07:00
parent 91b16a2310
commit f89e0bf14a
2 changed files with 19 additions and 1 deletions
+7 -1
View File
@@ -30,7 +30,7 @@ class Contract < ActiveRecord::Base
attr_accessible :details
[:status, :contract_type, :labor_spent, :overhead_spent,
:fixed_spent, :fixed_budget, :total_spent, :total_budget,
:fixed_spent, :fixed_budget, :total_spent,
:markup_spent, :markup_budget, :profit_spent, :profit_budget,
:discount_spent, :discount_budget, :client_point_of_contact,
:estimated_hour_spent
@@ -48,10 +48,16 @@ class Contract < ActiveRecord::Base
deliverables.inject(0) {|total, deliverable| total += deliverable.overhead_budget_total }
end
# OPTIMIZE: N+1
def estimated_hour_budget
deliverables.inject(0) {|total, deliverable| total += deliverable.estimated_hour_budget_total }
end
# OPTIMIZE: N+1
def total_budget
deliverables.inject(0) {|total, deliverable| total += deliverable.total }
end
PaymentTerms = {
:net_0 => :text_payment_terms_net_0,
:net_15 => :text_payment_terms_net_15,