[#4477] Scope fixed budget items by period too (for Retainers)

This commit is contained in:
Eric Davis
2010-09-17 14:51:48 -07:00
parent 67dd75a980
commit d78e7b1dc3
2 changed files with 9 additions and 1 deletions

View File

@@ -15,6 +15,14 @@ class FixedBudget < ActiveRecord::Base
end
end
named_scope :by_period, lambda {|date|
if date
{
:conditions => {:year => date.year, :month => date.month}
}
end
}
def markup_value
return 0 if budget.blank? || markup.blank?

View File

@@ -63,7 +63,7 @@
<td> TODO: Release 2 / TODO hrs </td>
</tr>
<% deliverable.fixed_budgets.each do |fixed_budget| %>
<% deliverable.fixed_budgets.by_period(period).each do |fixed_budget| %>
<% next if fixed_budget.blank_record? %>
<tr id="fixed_budget_<%= fixed_budget.id %>">
<td class="l fixed_title"><%= h(fixed_budget.title) %></td>