[#4420] Display per period Retainer values on the Contract details page.
This commit is contained in:
1 parent
0a1bb9169d
commit
5ef7d0271d
8 files changed
+47
-20
No files matched your search
@@ -38,6 +38,11 @@ class Deliverable < ActiveRecord::Base
|
||||
''
|
||||
end
|
||||
|
||||
# Deliverable's aren't dated. Subclasses may override this for period behavior.
|
||||
def current_date
|
||||
nil
|
||||
end
|
||||
|
||||
def to_s
|
||||
title
|
||||
end
|
||||
|
||||
@@ -29,8 +29,8 @@ class FixedDeliverable < Deliverable
|
||||
|
||||
# The amount of money remaining after expenses have been taken out
|
||||
# Profit left = Total - Labor spent - Overhead spent
|
||||
def profit_left
|
||||
total_spent - labor_budget_spent - overhead_spent
|
||||
def profit_left(date=nil)
|
||||
total_spent(date) - labor_budget_spent(date) - overhead_spent(date)
|
||||
end
|
||||
|
||||
# Hardcoded value used as a wrapper for the old Budget plugin API.
|
||||
|
||||
@@ -19,8 +19,12 @@ class RetainerDeliverable < HourlyDeliverable
|
||||
'R'
|
||||
end
|
||||
|
||||
def current_date
|
||||
Date.today
|
||||
end
|
||||
|
||||
def current_period
|
||||
Date.today.strftime("%B %Y")
|
||||
current_date.strftime("%B %Y")
|
||||
end
|
||||
|
||||
def beginning_date
|
||||
@@ -32,7 +36,11 @@ class RetainerDeliverable < HourlyDeliverable
|
||||
end
|
||||
|
||||
def date_range
|
||||
(beginning_date..ending_date)
|
||||
if beginning_date && ending_date && beginning_date <= ending_date
|
||||
(beginning_date..ending_date)
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def within_date_range?(date)
|
||||
|
||||
Reference in new issue
Block a user