[#4477] Added the amounts spent for FixedBudgets

This commit is contained in:
Eric Davis
2010-09-22 11:27:42 -07:00
parent d4de581b3c
commit 4a7484e1ea
9 changed files with 168 additions and 13 deletions
+26
View File
@@ -133,6 +133,17 @@ class RetainerDeliverable < HourlyDeliverable
end
end
def fixed_budget_total_spent(date=nil)
case scope_date_status(date)
when :in
fixed_budgets.paid.sum(:budget, :conditions => {:year => date.year, :month => date.month})
when :out
0
else
super
end
end
def fixed_markup_budget_total(date=nil)
case scope_date_status(date)
when :in
@@ -145,6 +156,21 @@ class RetainerDeliverable < HourlyDeliverable
super
end
end
def fixed_markup_budget_total_spent(date=nil)
case scope_date_status(date)
when :in
fixed_budgets.
paid.
all(:conditions => {:year => date.year, :month => date.month}).
inject(0) {|total, fixed_budget| total += fixed_budget.markup_value }
when :out
0
else
super
end
end
def total_spent(date=nil)
case scope_date_status(date)
when :in