[#4183] Implemented Contract#profit_budget and Deliverable#profit_budget.

This commit is contained in:
Eric Davis committed 2010-07-13 10:28:45 -07:00
1 parent f89e0bf14a
commit 4d475042f0
6 files changed
+85 -1

No files matched your search

+6 -1
View File
@@ -31,7 +31,7 @@ class Contract < ActiveRecord::Base
[:status, :contract_type, :labor_spent, :overhead_spent,
:fixed_spent, :fixed_budget, :total_spent,
:markup_spent, :markup_budget, :profit_spent, :profit_budget,
:markup_spent, :markup_budget, :profit_spent,
:discount_spent, :discount_budget, :client_point_of_contact,
:estimated_hour_spent
].each do |mthd|
@@ -58,6 +58,11 @@ class Contract < ActiveRecord::Base
deliverables.inject(0) {|total, deliverable| total += deliverable.total }
end
# OPTIMIZE: N+1
def profit_budget
deliverables.inject(0) {|total, deliverable| total += deliverable.profit_budget }
end
PaymentTerms = {
:net_0 => :text_payment_terms_net_0,
:net_15 => :text_payment_terms_net_15,