Add past_due methods to the Invoice model
This commit is contained in:
parent
f7c0ffff15
commit
dfd189d341
12
stoptime.rb
12
stoptime.rb
|
@ -411,6 +411,18 @@ module StopTime::Models
|
|||
subtotal + vattotal
|
||||
end
|
||||
end
|
||||
|
||||
# Returns if the invoice is past due (i.e. it has not been paid within
|
||||
# the required amount of days).
|
||||
def past_due?
|
||||
not paid? and (Time.now - created_at) > 30.days # FIXME: hardcoded!
|
||||
end
|
||||
|
||||
# Returns if the invoice is past due (i.e. it has not been paid within
|
||||
# the required amount of days).
|
||||
def way_past_due?
|
||||
past_due? and (Time.now - created_at) > 2 * 30.days
|
||||
end
|
||||
end
|
||||
|
||||
# == The company information class
|
||||
|
|
Loading…
Reference in New Issue