Points: 55409

6/8/2018 9:51:18 AM

Stored procedure that mimics the Payables Inquiry 'Re-create check stub' button

* This article, and all our great SQL (Dynamics) documentation, Is available on the SQL (Dynamics) menu

If you call up a Payment in Dynamics Payables Transaction Inquiry, you'll get the Payables Payments Zoom window. 

On that window is a button that says 'Re-create check stub'. A client recently asked me to recreate this for an integration

The task was MUCH harder than I thought it would be. It turns out that you have to recursively add in credits, then related invoices, and loop until you've got all the data. In testing we had to loop as many as three times. 

Finally, we needed to bring in related invoices at the end. 

Hope this is useful to you. 

Here's the output that we were trying to mimic:
Version: Unknown or N/A
Section: SQL Scripts
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables