Payment Terms

I have been asked to set up the follwoing payment term in Dynamics AX 2009:

If invoice received on or before the 15th of the month the payment is due at the end of the current month.

If invoice received after the 15th of the month the payment is due at the end of the following month.

example 2: The invoice was received October 14, 2011 - the due date is October 31, 2011

example 1: The invoice was received October 20, 2011 - the due date is November 30, 2011

I have tried to set this up and cannot get it to be exact - I have set it to net, 15 days, oayment day = 31

works great for months that end in 30 days but not 31 or february (the dirty *** february)