[#4183] Updated HourlyDeliverable#total to calculate the estimated total

This commit is contained in:
Eric Davis committed 2010-07-07 16:00:40 -07:00
1 parent 26aac777e4
commit 91b16a2310
4 files changed
+42 -5

No files matched your search

+4
View File
@@ -11,6 +11,10 @@ class FixedDeliverable < Deliverable
'F'
end
def total
read_attribute(:total) || 0.0
end
# Hardcoded value used as a wrapper for the old Budget plugin API.
#
# The Overhead plugin uses this in it's calcuations.
+7 -2
View File
@@ -14,11 +14,16 @@ class HourlyDeliverable < Deliverable
'H'
end
# Block getting and setting the total on HourlyDeliverables
def total
nil
return 0 if contract.nil?
return 0 if contract.billable_rate.blank?
return 0 if labor_budgets.count == 0 && overhead_budgets.count == 0
hours = labor_budgets.sum(:hours) + overhead_budgets.sum(:hours)
return contract.billable_rate * hours
end
# Block setting the total on HourlyDeliverables
def total=(v)
nil
end