[#4183] Implemented Contract#profit_left.

This commit is contained in:
Eric Davis
2010-07-13 18:32:35 -07:00
parent 361b971100
commit 41e221119c
2 changed files with 53 additions and 7 deletions
+6 -6
View File
@@ -38,12 +38,6 @@ class Contract < ActiveRecord::Base
define_method(mthd) { "TODO in later release" }
end
[
:profit_spent
].each do |mthd|
define_method(mthd) { "TODO" }
end
# OPTIMIZE: N+1
def labor_budget
deliverables.inject(0) {|total, deliverable| total += deliverable.labor_budget_total }
@@ -91,6 +85,12 @@ class Contract < ActiveRecord::Base
deliverables.inject(0) {|total, deliverable| total += deliverable.profit_budget }
end
# OPTIMIZE: N+1
def profit_left
deliverables.inject(0) {|total, deliverable| total += deliverable.profit_left }
end
alias_method :profit_spent, :profit_left
PaymentTerms = {
:net_0 => :text_payment_terms_net_0,
:net_15 => :text_payment_terms_net_15,