Calculating renewall (prolongation) date
I have a date calculation, and I can’t figure out the best way to handle this. So what’s the problem?
I have a database with contracts. The contracts have a first period, an auto renewal period and a resignation period. But different for each contract. (The user has over 800 machines with a service contract, but all different contracts, with different renewal periods and resignation periods. The user wants to know every week when he has to do resignations)
Starting first periode: 01-01-2012
First periode: 12 months
Ending first periode: 12-31-2012
Resignation: 3 months
Ultimate date for first resignation: 09-31-2012
First renewal (prolongation): 01-01-2013
Renewal period: 6 months
Renewal end: 06-30-2013
Ultimate date for resignation: 03-31-2013
Next renewal: (In 2015) This is the problem.
Next renewal end:
Ultimate dat for next resignation: (It is all about this date for the user)
With older contracts there already has been a renewal for 5 or 10 times. In the example there already has been 5 automatic renewals after the first period.
I need a calculation that calculates the next renewal based on todays date.
I have a solution, but I don’t like my own solution. It is a script with a loop that keeps adding renewal periods until the appropriate date. But that means there has to be a complete recalculation each time the user loads a record or changes a record. And there has to be complete recalculation when the user prints a list with resignation dates for the coming week.
Anyone a better idea?
Thanks in advance,