I have records that have dates against them and an occurring field that contains none
,yearly
and monthly
id status note date last_updated occurring
1 open --- 01/01/2011 01/02/2010 yearly
2 open --- 05/05/2011 03/05/2011 monthly
3 open --- 06/06/2011 05/06/2011 none
Now I need to be able to check if a record is due (the date set has passed) which works perfect if occurring
is set to none but I'm unsure of how to approach it when it's set to yearly or monthly (IE: This day in the year/month has passed)
So with the above records, if I had a method on the record called due?
providing the status is 'open' it needs to return true
every year when it's passed that date if it's not been updated within the year yet.
I apologise if this is confusing but it's melting my brain just trying to think of it, let alone put it into words.
date
andoccurring
are two separate fields. Sooccuring
would just be set tomonthly
.if last_updated > (due_day/due_month/this_year - 2 weeks) && last_updated < (due_day/due_month/next_year) then not_due