TXS150 – the Dread Tax Panel

I like Canada. I like Canadians, but well with the change in behaviour in M3 13.2 (aka 15.1.2) to accommodate tax changes has made staff grumpy, which has made me grumpy, which means I’m not happy with Canada J

In APS100, Supplier Invoice Entry we used to have a fairly clean data entry process.

  1. You select your function
  2. Key in a supplier number, invoice number and invoice amount
  3. Press enter
  4. You go to APS100/F and you could adjust the tax (typically the default is fine)
  5. Press enter
  6. Then you are taken to GLS120/J1 where you could do further breakdowns / adjustments

Under 13.2

  1. You select your function
  2. Key in a supplier number, invoice number and invoice amount
  3. Press enter
  4. You go to APS100/F then

Figure 1 – we used to have the tax adjustment fields on this panel

  1. Press enter
  2. TXS150 pops up and you can adjust the tax if needs be.
  3. Press F3 to close
  4. Then you are taken to GLS120/J1 where you could do further breakdowns / adjustments

From a data entry perspective, this is just horrible – it destroys any flow you have because you are now consciously moving your focus to an unused set of keys, or as with the case of many people, they end up grabbing the mouse.

Now, the key thing here is to remember that we can still change our tax values in the GLS120/J1 panel, so for IFL we can safely close TXS150 with a script in most instances. For those instances we do need to change the tax, our staff will change it in the subsequent panel.

Figure 2 – 9900 is out GST tax code, we can change this manually if needs be

 

Now I just went, hey, that’s easy. I’ll just use the PressKey method and issue the MNEProtocol.KeyF03 to close the panel from the Init() method.

So it would literally be adding one line of code to the Init() method

controller.PressKey(MNEProtocol.KeyF03);

So I throw that together, a grin of smug self-satisfaction on my face…

And it didn’t work…

Nothing happened…

Not a thing…

A quick check of the logs and my code was being executed, however I seemed to get a “Duplicate request skipped”

Which prompted a “huh?”

So it looks like we can’t call the normal F3 close from within the Init() function. Ok, so how about if we call it from a timer…and that’s exactly what I did and it works!

See the code below:

import System;
import System.Windows;
import System.Windows.Controls;
import MForms;

import System.Windows.Threading;

package MForms.JScript
{
	class TXS150_Close
	{
		// var gTimer : Timer;
		var gTimer : DispatcherTimer;
		var gController;
		var gDebug;
		
		public function Init(element: Object, args: Object, controller : Object, debug : Object)
		{
			debug.Debug("TXS150_Close::Init() Start");
			
			gController = controller;
			gDebug = debug;
			
			gTimer = new DispatcherTimer();
			gTimer.add_Tick(timer_Close);
			gTimer.Interval = new TimeSpan(1);
			gTimer.Start();
			
			debug.Debug("TXS150_Close::Init() End");
		}
		
		public function timer_Close(sender : Object, e : EventArgs)
		{
			gDebug.Debug("TXS150_Close::timer_Close() Start");
			try
			{
				gController.PressKey(MNEProtocol.KeyF03);
				gDebug.Debug("TXS150_Close::timer_Close() F3 simulated");
				
				gTimer.Stop();
			}
			catch(ex)
			{
				gDebug.Error(ex);
			}
			
			gDebug.Debug("TXS150_Close::timer_Close() End");
		}
	}
}

 

Enjoy!

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s