This script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posting the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.
This script returns a list of open purchase orders.
/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
SELECT
PONUMBER AS 'PO Number'
,CASE WHEN POSTATUS = 1 THEN
'New'
WHEN POSTATUS = 2 THEN
'Released'
WHEN POSTATUS = 3 THEN
'Change Order'
WHEN POSTATUS = 4 THEN
'Received'
WHEN POSTATUS = 5 THEN
'Closed'
ELSE
'Cancelled'
END AS 'PO Status'
,CASE WHEN STATGRP = 0 THEN
'Voided'
WHEN STATGRP = 1 THEN
'Active' -- Includes New, Open & Modified
ELSE
'Closed' -- Includes Cancelled & Closed
END AS 'Status Group'
,CASE WHEN POTYPE = 1 THEN
'Standard'
WHEN POTYPE = 2 THEN
'Drop Ship'
WHEN POTYPE = 3 THEN
'Blanket'
ELSE
'Blanket Drop Ship'
END AS 'PO Type'
,DOCDATE AS 'Document Date'
,REMSUBTO AS 'Remaining Subtotal'
,SUBTOTAL AS 'Subtotal'
,TRDISAMT AS 'Trade Discount Amnt'
,FRTAMNT AS 'Freight Amnt'
,MSCCHAMT AS 'Misc Charge Smnt'
,TAXAMNT AS 'Tax Amnt'
,VENDORID AS 'Vendor ID'
,VENDNAME AS 'Vendor Name'
,PYMTRMID AS 'Payment Terms ID'
,DUEDATE AS 'Due Date'
,CREATDDT AS 'Created Date'
,MODIFDT AS 'Modified Date'
,BUYERID AS 'Buyer ID'
,CASE WHEN HOLD = 1 THEN
'On Hold'
ELSE
'Open'
END AS 'Hold Status'
,ONHOLDDATE AS 'Hold Date'
,Revision_Number AS 'Revision Number'
,TAXSCHID AS 'Tax Schedule ID'
FROM
POP10100 --Purchase Order Work (POP10100)
WHERE
STATGRP = 1
AND
POSTATUS IN (1,2,3)
AND
REMSUBTO <> 0
Click to show/hide the SQL Scripts for Microsoft Dynamics GP Series Index
What should we write about next?
If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.
Looking for support or consultancy with Microsoft Dynamics GP?
I no longer work with Microsoft Dynamics GP, but the last company I worked for was ISC Software in the UK; if you’re looking for support or consultancy services with Microsoft Dynamics GP you can contact them here.