SQL Scripts for Microsoft Dynamics GP: Script Showing Quantities on Work Status Sales Transactions

Microsoft Dynamics GPThis script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted 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 work status sales transactions including the different quantity types.

/*
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). */
DECLARE @ITEMNMBR VARCHAR(30) = '100XLG' SELECT [Item Quantity Master'].ITEMNMBR ,[Item Quantity Master'].LOCNCODE ,SUM([Item Quantity Master'].QTYONHND - [Item Quantity Master'].ATYALLOC - ISNULL(['Sales Transaction Amounts Work'].QTYALLOC,0) - ISNULL(['Sales Transaction Amounts Work Backorder'].QTYALLOC,0)) AS 'QTYAVAIL' ,SUM([Item Quantity Master'].QTYONHND) AS QTYONHND ,SUM([Item Quantity Master'].ATYALLOC) AS 'QTYALLOC' ,SUM(['Sales Transaction Amounts Work'].QTYALLOC) AS 'OPENORDERS' ,SUM([Item Quantity Master'].QTYBKORD) AS 'OPENBACKORDERS' ,SUM(['Sales Transaction Amounts Work Backorder'].QTYONPO) AS 'QTYONORD' ,2 AS RCRDTYPE FROM IV00102 AS [Item Quantity Master'] --Item Quantity Master (IV00102) LEFT JOIN ( SELECT ITEMNMBR ,LOCNCODE ,SUM((QTYREMAI - ATYALLOC) * QTYBSUOM) AS QTYALLOC FROM SOP10200 AS ['Sales Transaction Amounts Work'] --Sales Transaction Amounts Work (SOP10200) WHERE ['Sales Transaction Amounts Work'].SOPTYPE = 2 GROUP BY ITEMNMBR ,LOCNCODE ,SOPTYPE ) AS ['Sales Transaction Amounts Work'] ON ['Sales Transaction Amounts Work'].ITEMNMBR = [Item Quantity Master'].ITEMNMBR AND ['Sales Transaction Amounts Work'].LOCNCODE = [Item Quantity Master'].LOCNCODE LEFT JOIN ( SELECT ITEMNMBR ,LOCNCODE ,SUM((QTYREMAI - ATYALLOC) * QTYBSUOM) AS QTYALLOC ,SUM(QTYONPO) AS QTYONPO FROM SOP10200 AS ['Sales Transaction Amounts Work'] --Sales Transaction Amounts Work (SOP10200) WHERE ['Sales Transaction Amounts Work'].SOPTYPE = 5 GROUP BY ITEMNMBR ,LOCNCODE ,SOPTYPE ) AS ['Sales Transaction Amounts Work Backorder'] ON ['Sales Transaction Amounts Work Backorder'].ITEMNMBR = [Item Quantity Master'].ITEMNMBR AND ['Sales Transaction Amounts Work Backorder'].LOCNCODE = [Item Quantity Master'].LOCNCODE WHERE [Item Quantity Master'].RCRDTYPE = 2 AND [Item Quantity Master'].ITEMNMBR = @ITEMNMBR GROUP BY [Item Quantity Master'].ITEMNMBR ,[Item Quantity Master'].LOCNCODE

Windows Start Menu Location

WindowsI recently needed to manually add an entry to the Windows start menu and was surprised at how hard it was to find the start menu location.

There are actually two locations; one for all users and one for a specific user.

The all users location is in %ProgramData%\Microsoft\Windows\Start Menu\Programs and the user specific one in %UserProfile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs.

SQL Scripts for Microsoft Dynamics GP: Update Inventory Item Accounts From CSV

Microsoft Dynamics GPThis script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.

This script updates inventory item accounts from a CSV file; I have posted a similar script before, but the one in this article is updating more of the account fields.

As with any script which does updates, test the script and make sure you have a good backup before running on a production system.

/*
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). */
CREATE TABLE #StockCodes (ITEMNMBR VARCHAR(100) ,ITEMDESC VARCHAR(100) --Item Description(Not Used) ,SALSCTGY VARCHAR(100) --Sales Category (Not Used) ,COGSCTGY VARCHAR(100) --Cost of Goods Sold (Not Used) ,ASMVRIDX VARCHAR(100) --Assembly Variance ,IVCOGSIX VARCHAR(100) --Cost of Goods Sold ,IVDMGIDX VARCHAR(100) --Damaged ,IVINSVIX VARCHAR(100) --In Service ,IVINUSIX VARCHAR(100) --In Use ,IVRETIDX VARCHAR(100) --Inventory Returns ,IVIVINDX VARCHAR(100) --Inventory ,IVIVOFIX VARCHAR(100) --Inventory Offset ,PURPVIDX VARCHAR(100) --Purchase Price Variance ,IVSLSIDX VARCHAR(100) --Sales ,IVSLDSIX VARCHAR(100) --Markdowns ,IVSLRNIX VARCHAR(100) --Sales Returns ,UPPVIDX VARCHAR(100) --Unrealised Purchase Price Variance ,IVVARIDX VARCHAR(100) --Variance ) GO BULK INSERT #StockCodes FROM 'D:\PI Files\Amino Go-Live Scripts\22. Update Accounts.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) GO UPDATE IV SET IVIVINDX = AIMIVIVINIX.ACTINDX --Inventory ,IVIVOFIX = AIMIVIVOFIX.ACTINDX --Inventory Offset ,IVCOGSIX = AIMIVCOGSIX.ACTINDX --Cost of Goods Sold ,IVSLSIDX = AIMIVSLSIDX.ACTINDX --Sales ,IVSLDSIX = AIMIVSLDSIX.ACTINDX --Markdowns ,IVSLRNIX = AIMIVSLRNIX.ACTINDX --Sales Returns ,IVINUSIX = AIMIVINUSIX.ACTINDX --In Use ,IVINSVIX = AIMIVINSVIX.ACTINDX --In Service ,IVDMGIDX = AIMIVDMGIDX.ACTINDX --Damaged ,IVVARIDX = AIMIVVARIDX.ACTINDX --Variance ,PURPVIDX = AIMPURPVIDX.ACTINDX --Purchase Price Variance ,UPPVIDX = AIMUPPVIDX.ACTINDX --Unrealised Purchase Price Variance ,IVRETIDX = AIMIVRETIDX.ACTINDX --Inventory Returns ,ASMVRIDX = AIMASMVRIDX.ACTINDX --Assembly Variance FROM IV00101 IV --Item Master (IV00101) INNER JOIN #StockCodes As Stock ON Stock.ITEMNMBR = IV.ITEMNMBR INNER JOIN --Assembly Variance GL00105 As AIMASMVRIDX --Item Currency Master (IV00105) ON AIMASMVRIDX.ACTNUMST = Stock.ASMVRIDX INNER JOIN --Cost of Goods Sold GL00105 As AIMIVCOGSIX ON AIMIVCOGSIX.ACTNUMST = Stock.IVCOGSIX INNER JOIN --Damaged GL00105 As AIMIVDMGIDX ON AIMIVDMGIDX.ACTNUMST = Stock.IVDMGIDX INNER JOIN --In Service GL00105 As AIMIVINSVIX ON AIMIVINSVIX.ACTNUMST = Stock.IVINSVIX INNER JOIN --In Use GL00105 As AIMIVINUSIX ON AIMIVINUSIX.ACTNUMST = Stock.IVINUSIX INNER JOIN --Inventory Returns GL00105 As AIMIVRETIDX ON AIMIVRETIDX.ACTNUMST = Stock.IVRETIDX INNER JOIN --Inventory GL00105 As AIMIVIVINIX ON AIMIVIVINIX.ACTNUMST = Stock.IVIVINDX INNER JOIN --Inventory Offset GL00105 As AIMIVIVOFIX ON AIMIVIVOFIX.ACTNUMST = Stock.IVIVOFIX INNER JOIN --Purchase Price Variance GL00105 As AIMPURPVIDX ON AIMPURPVIDX.ACTNUMST = Stock.PURPVIDX INNER JOIN --Sales GL00105 As AIMIVSLSIDX ON AIMIVSLSIDX.ACTNUMST = Stock.IVSLSIDX INNER JOIN --Markdowns GL00105 As AIMIVSLDSIX ON AIMIVSLDSIX.ACTNUMST = Stock.IVSLDSIX INNER JOIN --Sales Returns GL00105 As AIMIVSLRNIX ON AIMIVSLRNIX.ACTNUMST = Stock.IVSLRNIX INNER JOIN --Unrealised Purchase Price Variance GL00105 As AIMUPPVIDX ON AIMUPPVIDX.ACTNUMST = Stock.UPPVIDX INNER JOIN --Variance GL00105 As AIMIVVARIDX ON AIMIVVARIDX.ACTNUMST = Stock.IVVARIDX GO DROP TABLE #StockCodes GO

Merry Christmas

I’ve been a long-term member of the Microsoft Dynamics GP community, although I have recently left that for Microsoft Dynamics 365 Business Central, and for the last few years also that of ClassicPress.

Merry Christmas to everyone in all of those communities and I look forward to working with you all again next year.

Christmas tree image

Continue reading “Merry Christmas”

SQL Scripts for Microsoft Dynamics GP: Change Location on Word Status Purchase Order Lines From CSV

Microsoft Dynamics GPThis script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.

This script updates the location on work status purchase order lines from a CSV file. I vaguely recall this script and after running it we ran the reconcile process against both Purchase Ordering and Inventory Control.

As with any script, before running on production test the script to make sure it works and have a good backup of the database.

/*
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). */
CREATE TABLE #SiteXRef (PONUMBER VARCHAR(100) ,ITEMNMBR VARCHAR(100) ,LOCNCODE VARCHAR(100) ) GO BULK INSERT #SiteXRef FROM 'C:\TEMP\StockCodes.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) GO UPDATE POP SET POP.LOCNCODE = SiteXRef.LOCNCODE FROM POP10110 POP INNER JOIN #SiteXRef As SiteXRef ON SiteXRef.PONUMBER = POP.PONUMBER AND SiteXRef.ITEMNMBR = POP.ITEMNMBR GO DROP TABLE #SiteXRef GO

In Microsoft Dynamics 365 Business Central (Administration), how do I… Use List Pages

Microsoft Dynamics 365 Business CentralThis post is part of the In Microsoft Dynamics 365 Business Central (Administration), how do I… series and of the wider In Microsoft Dynamics 365 Business Central, how do I… series which I am posting as I familiarise myself with Microsoft Dynamics 365 Business Central.

In this series’ last article, I introduced the different types of pages used within Dynamics BC. I thought it might be useful to give a run through of how to use each of the pages, starting with the list pages.

A list page presents a view of data from a table and allows you to interact with the date; list pages are used for both card/master data and transactional data.

I am going to show a few of the ways in which you can interact with the data on a list page, using items as the example, but what I’ll show applies to all types of list page, whether card or transactional. Each list page will have a default view, which for items is Tile which shows a few pieces of information along with the associated image of the item.

Items list page in tile layout

Continue reading “In Microsoft Dynamics 365 Business Central (Administration), how do I… Use List Pages”

SQL Scripts for Microsoft Dynamics GP: Update Items to Discontinued Status

Microsoft Dynamics GPThis script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.

This script updates items with an Item Number starting 0 to a status of Discontinued.

As with any script, before running on production test the script to make sure it works and have a good backup of the database.

/*
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). */
UPDATE IV SET IV.ITEMTYPE = 2 FROM IV00101 IV WHERE IV.ITEMNMBR LIKE '0%' AND IV.ITEMTYPE <> 2 GO

Re-order Extensions on the Vivaldi Toolbar

Vivaldi BrowserI use Vivaldi as my main browser on desktop PC, tablet and mobile phone. I typically install the same extensions on each of them (excluding mobile which I don’t think supports extensions), but have sometimes installed them in a different order which means they end up in a different order on the toolbar (I regularly use about four computers and one tablet).

I have Google Translate installed on all of them as I listen to a lot of German music and my German is still rudimentary, although I am actively learning.

I prefer Google Translate to show up in the left-most position, but it is only there if I install it first.

Extensions can be reordered:

  • On a touchscreen tablet you need to press and hold and then drag to the new position.
  • On a traditional desktop a lot of online resources say to hold shift down and drag and drop, but this does not work; you actually need to hold down the control key while you drag and drop.

SQL Scripts for Microsoft Dynamics GP: Update Vendor Phone and Fax Numbers From CSV

Microsoft Dynamics GPThis script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.

This script will take a CSV file and update the three phone numbers and fax numbers on the vendor address supplied.

/*
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). */
CREATE TABLE #PM00200_IMPORT ( VENDORID VARCHAR(100) ,ADRSCODE VARCHAR(100) ,PHNUMBR1 VARCHAR(100) ,PHNUMBR2 VARCHAR(100) ,PHONE3 VARCHAR(100) ,FAXNUMBR VARCHAR(100) ) GO BULK INSERT #PM00200_IMPORT FROM 'C:\Temp\Supplier Phone and Fax.csv' WITH ( FIELDTERMINATOR = ',' ,ROWTERMINATOR = '\n' ,FIRSTROW = 2 ) GO select * from #PM00200_IMPORT -- VENDOR MASTER UPDATE PM SET PM.PHNUMBR1 = ISNULL(PM_I.PHNUMBR1,'') ,PM.PHNUMBR2 = ISNULL(PM_I.PHNUMBR2,'') ,PM.PHONE3 = ISNULL(PM_I.PHONE3,'') ,PM.FAXNUMBR = ISNULL(PM_I.FAXNUMBR,'') FROM PM00200 PM INNER JOIN #PM00200_IMPORT As PM_I ON UPPER(PM_I.ADRSCODE) = PM.VENDORID AND PM_I.ADRSCODE = "MAIN" GO -- VENDOR ADDRESS MASTER UPDATE PM SET PM.PHNUMBR1 = ISNULL(PM_I.PHNUMBR1,'') ,PM.PHNUMBR2 = ISNULL(PM_I.PHNUMBR2,'') ,PM.PHONE3 = ISNULL(PM_I.PHONE3,'') ,PM.FAXNUMBR = ISNULL(PM_I.FAXNUMBR,'') FROM PM00300 PM INNER JOIN #PM00200_IMPORT As PM_I ON PM_I.VENDORID = PM.VENDORID AND PM.ADRSCODE = UPPER(PM_I.ADRSCODE) GO DROP TABLE #PM00200_IMPORT GO

In Microsoft Dynamics 365 Business Central (Administration), how do I… Switch Between Companies

Microsoft Dynamics 365 Business CentralThis post is part of the In Microsoft Dynamics 365 Business Central (Administration), how do I… series and of the wider In Microsoft Dynamics 365 Business Central, how do I… series which I am posting as I familiarise myself with Microsoft Dynamics 365 Business Central.

If you’ve been following this series of posts where I familiarise myself with Dynamics BC, then the title of this post will look familiar; that’s because I did a post on the 6th September with the same name. I am not repeating that article, but posting a new version as the functionality available in Dynamics BC has changed since that article was published.

I originally started this series using Release 2022 Wave 1, but my environment has not been updated to Release 2022 Wave 2 which saw new functionality introduced which allows for switching between companies across environments and also within the same environment.

The new method of switching no longer requires you to go to the My Settings page; instead the entry on the app bar which used to state the name of the environment now shows the environment name in smaller letters below a title. When you click on it, a sidebar opens showing the available environments and companies therein:

New Available Companies sidebar showing environments and companies

Continue reading “In Microsoft Dynamics 365 Business Central (Administration), how do I… Switch Between Companies”