The process of creating a Tax Return in Microsoft Dynamics GP can sometimes take a while when there are a large number of transactions to process. While this usually isn’t a problem, on occasion a network connectivity issue (or a Citrix server cutting the user off after a certain length of time) can cut GP off from the database resulting in corrupt information in the Tax Return tables.
The following script will remove the corrupt data from the Tax tables and reset the flag on the transactions which shows which tax Return they’re on.
Change the highlighted section to the Tax Return ID to be reset:
/* Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (https://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 @TAX_RETURN_ID AS VARCHAR(100) = 'taxreturnid' DELETE FROM TX00301 WHERE TAX_RETURN_ID = @TAX_RETURN_ID GO DELETE FROM TX00303 WHERE TAX_RETURN_ID = @TAX_RETURN_ID GO DELETE FROM TX00304 WHERE TAX_RETURN_ID = @TAX_RETURN_ID GO UPDATE TX30000 SET Included_On_Return = 0 ,Tax_Return_ID = '' WHERE TAX_RETURN_ID = @TAX_RETURN_ID GO
Before running the script make sure you have a good backup of the database and test afterwards to make sure everything is OK.