Dynamics GP Payment Term dates are sometimes difficult to calculate, there are several different types of calcs that are possible.
This post documents how to call the native taCalcDueDatePM stored procedure, all the calcs are doe for you.