I am in a bit of a pickle, may just be the hour that Im still up working.. however what i need to achieve is to come to a date based on a double which is the amount of money being collected.
my software charges interest on a loan per month or part thereof. when a loan is processed a due date is calculated based on X number of months (predefined). So a loan drawn up today (2011-12-23) where X = 3 the due date would be 2012-03-23.
if the person whom has obtained the loan cannot pay the loan back by the due date they can make a payment on this loan to extend the due date. If the the interest on this loan is $30.00 per month or part thereof and they make a payment of $30.00 the loan due date is extended by 1 month becoming 2012-04-23, if the person is to pay $60.00 then the loan due date would be extended by 2 months becoming 2012-05-23, and so on.
the above calculation is easily achieved. my issue is when the amount being paid is not equal of the monthly interest. Say the customer only pays $15.00 the due date would need to be recalculated to somewhere in the middle of the 2012-03-23 and 2012-04-23. If the person was to pay $45.00 then the due date would be recalculated to somewhere in the middle of 2012-04-23 and 2012-05-23.
If anyone would be willing to help me that would be great :) thanks guys!