Cancelling a PO Line Created From a Purchase Requisition

August 17th, 2017 by Ian Grieve

Microsoft Dynamics GPCancelling a purchase order line which came from a purchase requisition should, one would think, be a simple task. However, prior to Microsoft Dynamics GP 2016 R2, this was not necessarily the case.

This recently came back to mind when a client, who has recently implemented Purchase Order Processing with Workflow approvals on the requisitions (PO Entry window has been customised to lock a lot of the fields) raised an issue with me about not being able to cancel a line on the PO. After writing and demoing the functionality of Dynamics GP 2016 R2 a few times recently, it took a few minutes to identify a workaround for them as the client was running Dynamics GP 2015 R2 (14.00.1016).

The problem, is that you cannot cancel the link to the requisition in the same way you would a Sales commitment. If you try to cancel by entering a Qty Canceled, you get this error:

Microsoft Dynamics GP - The quantity can't be changed because the remaining quantity doesn't satisfy the commitments for this line item

Microsoft Dynamics GP

The purchase order commitment can't be deleted; an attached sales line item is in use or is in history. Line items that weren't in use or in history are no longer committed to a purchase order.

If you open the Commitment for Purchase Order window from the Purchase Order Entry window, you can delete a Sales commitment in one of two ways.

Firstly, you can select the line and click the Delete Sales Doc button, but for a requisition commitment you get the following error:

Microsoft Dynamics GP - The purchase order commitment can't be deleted; an attached sales line item is in use or is in history. Line items that weren't in use or in history are no longer committed to a purchase order.

Microsoft Dynamics GP

The quantity can't be changed because the remaining quantity doesn't satisfy the commitments for this line item

Secondly, you can hit the Delete button on the action pane and get the following error:

Microsoft Dynamics GP - The delete document action isn't available for purchase requisitions.

Microsoft Dynamics GP

The delete document action isn't available for purchase requisitions.

If you try to cancel the PO or lines from the Edit Purchase Orders window, you get similar errors.

Part of my issue with this is that when I tested, the demo environment I had available was actually a later hotfix (14.00.1059) and this allowed me to change the Purchase Order Status or Line status fields to Cancelled without any problem. Telling the client to try this wasn’t successful; they had to change the Quantity Cancelled and this will allow the line to be cancelled.

Reminding me that you really do need to do your testing on exactly the same version as even the difference between 14.00.1016 and 14.00.1059 was quite big in this area.

Dynamics GP 2016 R2 has additional functionality which allows a Cancelled Quantity to be entered in PO Entry.

Read original post Cancelling a PO Line Created From a Purchase Requisition at azurecurve|Ramblings of a Dynamics GP Consultant

Comments >>

Source: azurecurve

SQL View to Return Sales By Customer By Year

August 15th, 2017 by Ian Grieve

Microsoft Dynamics GPThe last post was a SQL view to return purchases by vendor by year; in this one I am posting a similar view, but for the Sales series.

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (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).
*/
IF OBJECT_ID (N'uv_AZRCRV_SalesByCustomerByYear', N'V') IS NOT NULL
	DROP VIEW uv_AZRCRV_SalesByCustomerByYear
GO
CREATE VIEW uv_AZRCRV_SalesByCustomerByYear AS
SELECT
	['Receivables Transactions'].CUSTNMBR AS 'Customer ID'
	,['RM Debtor MSTR'].CUSTNAME AS 'Customer Name'
	,['RM Debtor MSTR'].CUSTCLAS AS 'Class ID'
	,FORMAT(['Receivables Transactions'].DOCDATE, 'yyyy') AS 'Year'
	,CASE WHEN ['RM Debtor MSTR'].INACTIVE = 1 THEN
		'Inactive'
	ELSE
		'Active'
	END AS 'Status'
	,SUM(CASE WHEN ['Receivables Transactions'].RMDTYPAL <= 3 THEN ['Receivables Transactions'].SLSAMNT ELSE ['Receivables Transactions'].SLSAMNT * -1 END) AS 'Purchases Amount'
	,SUM(CASE WHEN ['Receivables Transactions'].RMDTYPAL <= 3 THEN ['Receivables Transactions'].TRDISAMT * -1 ELSE ['Receivables Transactions'].TRDISAMT END) AS 'Trade Discount'
	,SUM(CASE WHEN ['Receivables Transactions'].RMDTYPAL <= 3 THEN ['Receivables Transactions'].FRTAMNT ELSE ['Receivables Transactions'].FRTAMNT * -1 END) AS 'Freight'
	,SUM(CASE WHEN ['Receivables Transactions'].RMDTYPAL <= 3 THEN ['Receivables Transactions'].MISCAMNT ELSE ['Receivables Transactions'].MISCAMNT * -1 END) AS 'Miscalleneous'
	,SUM(CASE WHEN ['Receivables Transactions'].RMDTYPAL <= 3 THEN ['Receivables Transactions'].TAXAMNT ELSE ['Receivables Transactions'].TAXAMNT * -1 END) AS 'Tax Amount'
	,SUM(CASE WHEN ['Receivables Transactions'].RMDTYPAL <= 3 THEN ['Receivables Transactions'].DOCAMNT ELSE ['Receivables Transactions'].DOCAMNT * -1 END) AS 'Total Amount'
FROM
	(SELECT
		CUSTNMBR
		,DOCDATE
		,GLPOSTDT
		,DOCNUMBR
		,RMDTYPAL
		,SLSAMNT
		,TRDISAMT
		,FRTAMNT
		,MISCAMNT
		,TAXAMNT
		,SLSAMNT - TRDISAMT + FRTAMNT + MISCAMNT + TAXAMNT AS DOCAMNT
	FROM
		RM20101
	WHERE
		VOIDSTTS >= 0
	AND
		RMDTYPAL IN (1,3,4,7,8)
	UNION ALL
		SELECT
			CUSTNMBR
			,DOCDATE
			,GLPOSTDT
			,DOCNUMBR
			,RMDTYPAL
			,SLSAMNT
			,TRDISAMT
			,FRTAMNT
			,MISCAMNT
			,TAXAMNT
			,SLSAMNT - TRDISAMT + FRTAMNT + MISCAMNT + TAXAMNT AS DOCAMNT
		FROM
			RM30101
		WHERE
			VOIDSTTS >= 0
		AND
			RMDTYPAL IN (1,3,4,7,8)
	) AS ['Receivables Transactions']
LEFT JOIN
	RM00101 AS ['RM Debtor MSTR']
		ON
			['Receivables Transactions'].CUSTNMBR >= ['RM Debtor MSTR'].CUSTNMBR
GROUP BY
	['Receivables Transactions'].CUSTNMBR
	,['RM Debtor MSTR'].CUSTNAME
	,['RM Debtor MSTR'].CUSTCLAS
	,['RM Debtor MSTR'].INACTIVE
	,FORMAT(['Receivables Transactions'].DocDate, 'yyyy')
GO
GRANT SELECT ON uv_AZRCRV_SalesByCustomerByYear TO DYNGRP
GO

The view can easily be plugged into SmartList Designer, SmartList Builder, a refreshable Excel Report, a SQL Server Reporting Services report or any other type of reporting tool.

Read original post SQL View to Return Sales By Customer By Year at azurecurve|Ramblings of a Dynamics GP Consultant

Comments >>

Source: azurecurve

SQL Script to Prefix Email Message Subjects with Test

August 15th, 2017 by Ian Grieve

Microsoft Dynamics GPI had an issue reported with purchase requisitions the other day. I logged on and did a little testing and then, a short wile later, got an email from the client asking about some workflow approval emails some managers had received.

The email to the approvers did not contain the word “test” anywhere in either the subject or body. This lead to me having a horrible moment when I thought I might have done my testing on live; I was able to confirm quickly that I had not.

After this I decided I had better knock a quick script together which the client could incorporate into their live to test copy.

The script is more engineered than it might otherwise need to be as I have included code to only do the update when it is running against a test company (flagged with <TEST> at the end of the Company Name) and where the email subject isn’t already prefixed with the word TEST:

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (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
	['Email Messages']
SET
	EmailMessageSubject = 'TEST: ' + LEFT(CAST(['Email Messages'].EmailMessageSubject AS CHAR(150)), 150)
FROM
	SY04901 AS ['Email Messages']
INNER JOIN
	DYNAMICS..SY01500 AS ['Company Master']
		ON
			['Company Master'].INTERID = DB_NAME()
WHERE
	['Company Master'].CMPNYNAM LIKE '%<TEST>'
AND
	LEFT(['Email Messages'].EmailMessageSubject, 4) <> 'TEST'
GO

As always, before running a script against a database, make sure you understand the scirpt and have a good backup of the database.

Read original post SQL Script to Prefix Email Message Subjects with Test at azurecurve|Ramblings of a Dynamics GP Consultant

Comments >>

Source: azurecurve