[#4420] Added a second Retainer calculation method for specific dates.

This commit is contained in:
Eric Davis
2010-09-08 14:54:36 -07:00
parent 0cc2523084
commit c8b86db4c4
3 changed files with 49 additions and 1 deletions
+4
View File
@@ -66,6 +66,10 @@ class Deliverable < ActiveRecord::Base
overhead_budgets.sum(:budget)
end
def overhead_budget_total_for_date(date=nil) #Used on subclasses
overhead_budget_total
end
# Total number of hours estimated in the Deliverable's budgets
def estimated_hour_budget_total
(labor_budgets.sum(:hours) || 0.0) +
+12
View File
@@ -87,6 +87,18 @@ class RetainerDeliverable < HourlyDeliverable
end
end
def overhead_budget_total_for_date(date=nil)
if date
if within_date_range?(date)
overhead_budgets.sum(:budget, :conditions => {:year => date.year, :month => date.month})
else
0 # outside of range
end
else
overhead_budgets.sum(:budget)
end
end
def create_budgets_for_periods
# For each month in the time span
months.each do |month|