[#4551] Change the Budget conversion to convert materials as FixedBudget items

This commit is contained in:
Eric Davis
2010-09-22 12:27:52 -07:00
parent c6d43d9149
commit 0ef87e7b9c
2 changed files with 20 additions and 25 deletions

View File

@@ -140,15 +140,15 @@ module RedmineContracts
total ||= 0
if old_deliverable['materials'].present? && old_deliverable['materials'] > 0.0
deliverable.overhead_budgets << OverheadBudget.new(:deliverable => deliverable,
:budget => old_deliverable['materials'],
:hours => 0)
deliverable.fixed_budgets << FixedBudget.new(:deliverable => deliverable,
:budget => old_deliverable['materials'],
:markup => 0)
elsif old_deliverable['materials_percent'].present? && old_deliverable['materials_percent'] > 0.0
materials = total * (old_deliverable['materials_percent'].to_f / 100)
deliverable.overhead_budgets << OverheadBudget.new(:deliverable => deliverable,
:budget => materials,
:hours => 0)
deliverable.fixed_budgets << FixedBudget.new(:deliverable => deliverable,
:budget => materials,
:markup => 0)
end
end