
Back when Australia introduced its Goods and Services Tax (GST) in July 2000, I designed and developed the Business Activity Statement (BAS) Tax reporting tool which also contained a utility to update tax schedules and recalculate taxes on unposted Sales Order Processing Transactions.
This code was re-used in October 2010 when New Zealand changed its GST tax rate. The code from the BAS reporting tool was copied and placed into Runtime Execute scripts for the Support Debugging Tool (see original article).
This week I was contacted by James Bacon from Green Rubber – Kennedy Ag as he wanted to use the code again to update some transactions when a tax rate had changed. While the code did “mostly” work, this was an opportunity to update the code to improve it and use more features in GP Power Tools.
Starting with the previous version of the scripts, we made the following changes:
- Created a project and added the two original scripts and all new resources to it.
- Added a Parameter List to allow selection of a range of Sales Transactions.
- Added updating of Shipping Address Tax Schedule at the line level (not supported in Microsoft GP when the update code was first created).
- Added option to run the recalculate script after updating tax schedules.
- Added triggers to add Update and Recalculate options to the Sales Transaction Entry window.
Here is the project setup window for the SOP_RECALC project:
Here is a quick summary of the components in the project:
Trigger SOP_RECALC
Trigger to add an Additional Menu option for recalculating tax for the currently displayed transaction. It will save the transaction, make its updates and then redisplay the transaction.
Trigger SOP_UPDATE
Trigger to add an Additional Menu option for updating tax schedules back to default values from the Customer Master and Item Master tables for the currently displayed transaction. It will save the transaction, make its updates and then redisplay the transaction.
Runtime Execute Script SOP_RECALC
This is the actual script for recalculating the tax for sales documents. When run from the Runtime Executer window, it will open a Parameter list window to allow for selection of the transactions.
Runtime Execute Script SOP_UPDATE
This is the actual script for updating tax schedules back to default values from the Customer Master and Item Master tables for sales documents. When run from the Runtime Executer window, it will open a Parameter list window to allow for selection of the transactions.
SQL Execute Script SOP_RECALC
This SQL script is used by the Parameter list to define the Sales Transaction Lookup. It also uses the SOP Type parameter to filter the transactions.
Parameter List SOP_RECALC
The Parameter list to select the transactions by SOP Type, SOP Number range and Document Date range.
Message SOP_RECALC
This message is used by the triggers when a document is not selected.
Downloading and Installing
Download the example code and import using the Project Setup window (now possible for first time imports with Build 28.8 onwards), or use Configuration Export/Import window (for older builds):
The code will be active on next login or after switching companies, or you can use start the triggers manually from the Project Setup window.
More Information
For more information see:
- Changing SOP Tax Rates using the Support Debugging Tool
- GP Power Tools Portal: http://winthropdc.com/GPPT
- GP Power Tools Samples: http://winthropdc.com/GPPT/Samples
- GP Power Tools Videos: http://winthropdc.com/GPPT/Videos
If you haven’t done so already, update to GP Power Tools Build 29 or later to get all the latest features and resolve the Security Vulnerability issue.
David
This article was originally posted on http://www.winthropdc.com/blog.

