#GPPT Reporting for Minnesota’s Wage Theft Law

David Meego - Click for blog homepageThis article is comes about thanks to my friend, Melissa Brown, who approached me for a solution to a reporting requirement she had for a customer due to new legislation brought in by the US state of Minnesota.

The requirement was not possible to solve with the Dynamics Report Writer alone as it involved an array in a table which prevented a static relationship from working to retrieve the data needed.

I will let Melissa explain:

Minnesota passed a Wage Theft Law that went into effect July 1, 2019.  One of the requirements of this new law was that specific information has to be included on the earning statement.  One of those pieces of information was “Employee’s rate or rates of pay and basis thereof, including whether the employee is paid by the hour, shift, day, week, salary, piece, commission or other method”

This customer has hundreds of pay codes in order to facilitate everything we are doing through the Project Accounting module and their business needs.  Neither the pay codes nor their descriptions are set up or modifiable in a way to meet the above requirement.  Putting a key on the earning statement was also not possible because of the vast number of pay codes they have.  The “easy” solution was to pull the pay type field onto the pay checks and earning statements, even creating a calculated field to convert the integer value into appropriate text.  That was not so easy.

Because of how the payroll processing tables are structured with each pay code being an array, I could not get a good link back to the pay code set up table to pull on the pay type.  Here is where GP Power Tools saved the day!


The solution was to use GP Power Tools to create a custom Report Writer (RW) function to return a Pay Type Description based on a supplied Employee ID and element number from the Pay Code Array.

The first version of the custom Report Writer function created used the method where a SQL script is used to get the data. We found that this caused a performance issue due to the large amount of payroll data.  So the custom Report Writer function was rewritten to use Dexterity only and the performance was improved and the customer was happy.

Below is a screenshot of the custom Report Writer function created using the Runtime Execute Setup window.

Here is the full script used. Note that the code at the beginning and end of the script is provided for you by GP Power Tools and you only need to provide the code in the section marked for your code.

local string MBS_TableHeaderString;
local string MBS_Number;
local integer MBS_Type;
local integer MBS_Control;
local string MBS_String;

call with name "MBS_Param_Get" in dictionary 5261, "Number", MBS_Number;
call with name "MBS_Param_Get" in dictionary 5261, "Type", MBS_String;
MBS_Type = integer(value(MBS_String));
call with name "MBS_Param_Get" in dictionary 5261, "Control", MBS_String;
MBS_Control = integer(value(MBS_String));
MBS_TableHeaderString = "";

{ Add your code below here }
clear table uprWorkChkDesc;
'User ID' of table uprWorkChkDesc = 'User ID' of globals; {Assuming this is populated with current user ID}
'Employee ID' of table uprWorkChkDesc = MBS_Number;
get table uprWorkChkDesc;
if err() = OKAY then
	clear table UPR_MSTR_Pay_Type;
	'Employee ID' of table UPR_MSTR_Pay_Type = 'Employee ID' of table uprWorkChkDesc;
	'Pay Record' of table UPR_MSTR_Pay_Type = 'Pay Code Array'[MBS_Control] of table uprWorkChkDesc;
	get table UPR_MSTR_Pay_Type;
	if err() = OKAY then
		case 'Pay Type' of table UPR_MSTR_Pay_Type
			in [1]
				MBS_TableHeaderString = "Hourly";
			in [2]
				MBS_TableHeaderString = "Salary";
			in [3]
				MBS_TableHeaderString = "Piecework";
			in [4]
				MBS_TableHeaderString = "Commission";
			in [5]
				MBS_TableHeaderString = "Business Expense";
			in [6]
				MBS_TableHeaderString = "Overtime";
			in [7]
				MBS_TableHeaderString = "Double Time";
			in [8]
				MBS_TableHeaderString = "Vacation";
			in [9]
				MBS_TableHeaderString = "Sick";
			in [10]
				MBS_TableHeaderString = "Holiday";
			in [11]
				MBS_TableHeaderString = "Pension";
			in [12]
				MBS_TableHeaderString = "Other";
			in [13]
				MBS_TableHeaderString = "Earned Income Credit";
			in [14]
				MBS_TableHeaderString = "Charged Tips";
			in [15]
				MBS_TableHeaderString = "Reported Tips";
			in [16]
				MBS_TableHeaderString = "Minimum Wage Balance";
			else
		end case;
	
	end if;
end if;
{ Add your code above here }

call with name "MBS_Param_Set" in dictionary 5261, "TableHeaderString", MBS_TableHeaderString;

In the Report Writer you can create a series of string Calculated Fields to return the data using the rw_TableHeaderString User Defined function in the system series. The first two parameters need to be 5261 for GP Power Tools Product ID and “RW_GET_PAYTYPE” script ID to be called. Then the following parameters are the MBS_Number, MBS_Type and MBS_Control variables passed into the script.

Pay Type 1: FUNCTION_SCRIPT( rw_TableHeaderString  5261  “RW_GET_PAYTYPE”  uprWorkChkDesc.Employee ID  0  1 )

Pay Type 2: FUNCTION_SCRIPT( rw_TableHeaderString  5261  “RW_GET_PAYTYPE”  uprWorkChkDesc.Employee ID  0  2 )

Pay Type 3: FUNCTION_SCRIPT( rw_TableHeaderString  5261  “RW_GET_PAYTYPE”  uprWorkChkDesc.Employee ID  0  3 )

etc.

Here is the exported configuration setup file which can be imported into GP PowerTools:

For more information see the following articles:

Thanks Melissa for working with me to solve this customer’s problems.

David

This article was originally posted on http://www.winthropdc.com/blog.

Please post feedback or comments

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.