I'm maintaining a web application which deals with some kind of subscriptions. Users can to renew their subscriptions from 2 months before expiry (not earlier than that). Sometimes user does not renew before expiry and get grace period which is of 3 months. Now he can renew in these 3 months of grace period.
Now the problem part. In the previous transactions of renew requests I have to show what was the offer period for that particular request (subscription start and subscription end period if renew was granted). Things are pretty simple if user renews before expiry, but I'm not able to get things straight if there is grace period specially when the subscriptions is expiring in last months of the year. Also there sometimes calculations go haywire when subscription is ending in jan or feb.
All this is happening because offer period is not saved with the application anywhere (I don't know why). so if subscription is ending in 20 October 2008 and renew application is submitted in 16 January 2009 (because of grace period) the offer period should be 21 October 2008 to 20 October 2009.
How can I calculate correct offer period based on renew request submission date for old renew applications?
EDIT:- Now is 2010, suppose user is viewing past transaction from year 2009, when he submitted request to extend subscription from 21-10-2008 to 20-10-2009. But he has got grace period and requested renew on 16-Jan-2010. As I don't have 21-10-2008 to 20-10-2009 stored anywhere I have to calculate that it was 21-10-2008 to 20-10-2009 when the request was logged. And this is where I'm having trouble.