diff --git a/app/models/deliverable.rb b/app/models/deliverable.rb index 692ed8d..72562fd 100644 --- a/app/models/deliverable.rb +++ b/app/models/deliverable.rb @@ -69,8 +69,11 @@ class Deliverable < ActiveRecord::Base overhead_budgets.sum(:budget) end + # The amount of profit that is budgeted for this deliverable. + # Profit = Total - ( Labor + Overhead + Fixed + Markup ) def profit_budget(date=nil) - nil + budgets = labor_budget_total(date) + overhead_budget_total(date) + fixed_budget_total(date) + fixed_markup_budget_total(date) + (total(date) || 0.0) - budgets end def labor_budget_hours(date=nil) diff --git a/app/models/fixed_deliverable.rb b/app/models/fixed_deliverable.rb index 090861d..491109c 100644 --- a/app/models/fixed_deliverable.rb +++ b/app/models/fixed_deliverable.rb @@ -20,13 +20,6 @@ class FixedDeliverable < Deliverable total end - # The amount of profit that is budgeted for this deliverable. - # Profit = Total - ( Labor + Overhead + Fixed + Markup ) - def profit_budget(date=nil) - budgets = labor_budget_total(date) + overhead_budget_total(date) + fixed_budget_total(date) + fixed_markup_budget_total(date) - (total(date) || 0.0) - budgets - end - # The amount of money remaining after expenses have been taken out # Profit left = Total - Labor spent - Overhead spent - Fixed - Markup def profit_left(date=nil) diff --git a/app/models/hourly_deliverable.rb b/app/models/hourly_deliverable.rb index d8e00d8..73a3b4d 100644 --- a/app/models/hourly_deliverable.rb +++ b/app/models/hourly_deliverable.rb @@ -50,13 +50,6 @@ class HourlyDeliverable < Deliverable write_attribute(:total, nil) end - # The amount of profit that is budgeted for this deliverable - # Profit = Total - ( Labor + Overhead + Fixed + Markup ) - def profit_budget(date=nil) - budgets = labor_budget_total(date) + overhead_budget_total(date) + fixed_budget_total(date) + fixed_markup_budget_total(date) - (total(date) || 0.0) - budgets - end - # The amount of money remaining after expenses have been taken out # Profit left = Total - Labor spent - Overhead spent - Fixed - Markup def profit_left(date=nil)