I wrote a SQL based integration for a client that takes customer and vendor invoices from a proprietary system, and inserts them into their MS Dynamics database. Overall the integration is working pretty well -- but some vendor invoices fail with error 4610 (Unable to calculate the discount and due dates) when calling "taPMTransactionInsert". I've looked at the data, and don't see any patterns (e.g., not always happening to a specific customer or vendor) and I really don't know much about dynamics in general.
Can someone point me in the right direction to troubleshooting this problem? I can provide the procedure code in a private message if necessary, but the general flow I have is this...
1) begin transaction
2) Call taGetPMNextVoucherNumber and store next voucher number
3) Validate customer # I have exists in Dynamics (by querying GL00100)
4) Validate vendor # I have exists (by querying GL00100)
5) Call taPMTransactionInsert twice (once for the AP account and once for the customer account)
6) Each of the calls above are wrapped w/ try catches where I do error logging and a rollback on the transaction