From dfd189d341ebb730907765294a6741e1b50c843c Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sun, 16 Jun 2013 23:29:01 +0200 Subject: [PATCH] Add past_due methods to the Invoice model --- stoptime.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/stoptime.rb b/stoptime.rb index b82af71..fba20c3 100644 --- a/stoptime.rb +++ b/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