Help with Date calculation

Help with Date calculation

Hello all,

I would kindly like to request for help in writing a code that does the following:

On my form, I have two date fields, 1 with the date, the client makes an order and the other when the client is to make a payment.

I would like to do the following: within 14 days, of entering the 1st date, the second date should be updated i.e the client should make the payment, if not then send an email to the client informing him/her of the due payment. If however, within the 14 days, there is a payment, no mail should be sent out. 

Thank you in advance for the help.