SQL view for Payables invoices originating from POP in Dynamics GP
September 1, 2010 7 Comments
This Dynamics GP SQL view originated from a request on the Dynamics GP customer forum, but is also something that I can see being useful in a variety of situations. It returns all posted Payables invoices that came from the Purchase Order Processing module with details of the items that were received on each invoice.
~~~~~
CREATE VIEW view_Payables_POP_Invoices AS /******************************************************************* view_Payables_POP_Invoices Created on Sep 1, 2010 by Victoria Yudin - Flexible Solutions, Inc. For updates visit http://victoriayudin.com/gp-reports/ Returns Payables Invoices only *******************************************************************/ SELECT PM.VCHRNMBR Voucher_Number, PM.VENDORID Vendor_ID, POP.VENDNAME Vendor_Name, PM.DOCDATE Invoice_Date, PM.DUEDATE Due_Date, PM.DOCNUMBR Invoice_Number, PM.DOCAMNT Invoice_Amount, PM.CURTRXAM Unpaid_Amount, CASE PM.VOIDED WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' END Voided, POP.POPRCTNM POP_Receipt_Number, CASE POP.POPTYPE WHEN 2 THEN 'Invoice' WHEN 3 THEN 'Shipment/Invoice' END Receipt_Type, POP.receiptdate Receipt_Date, I.RCPTLNNM Receipt_Line_Num, I.PONUMBER PO_Number, I.ITEMNMBR Item_Number, I.ITEMDESC Item_Description, R.QTYINVCD Quantity_Invoiced, R.UOFM U_of_M, I.UNITCOST Unit_Cost, I.EXTDCOST Extended_Cost, I.LOCNCODE Site_ID, CASE I.NONINVEN WHEN 0 THEN 'Inventory Item' WHEN 1 THEN 'Non-Inventory Item' END Item_Type FROM (SELECT VCHRNMBR,VENDORID, DOCDATE, DUEDATE, DOCNUMBR, DOCAMNT, CURTRXAM, DOCTYPE, VOIDED FROM PM20000 UNION ALL SELECT VCHRNMBR,VENDORID, DOCDATE, DUEDATE, DOCNUMBR, DOCAMNT, CURTRXAM, DOCTYPE, VOIDED FROM PM30200) PM -- PM trx INNER JOIN POP30300 POP -- POP header ON PM.VENDORID = POP.VENDORID AND PM.DOCNUMBR = POP.VNDDOCNM INNER JOIN POP30310 I -- POP detail ON I.POPRCTNM = POP.POPRCTNM INNER JOIN POP10500 R -- recceipt details ON R.POPRCTNM = I.POPRCTNM AND R.RCPTLNNM = I.RCPTLNNM WHERE PM.DOCTYPE = 1 -- invoices only AND POP.POPTYPE in (2,3) -- invoices only /** the following will grant permissions to this view to DYNGRP, leave this section off if you do not want to grant permissions **/ GO GRANT SELECT ON view_Payables_POP_Invoices TO DYNGRP
~~~~~
For more Dynamics GP SQL scripts take a look at the GP Reports page on this blog.
Disclaimer: I tested this on limited data, if you find an issue or have a suggestion for improvement, please let me know and I will post the update here for everyone.





Recent Comments