TimeWorksPlus Knowledge Base

Alternate Pay Rate Scripting - TWP

Last Updated: Feb 01, 2017 10:06AM MST
A Pay Rate Script can be used to change pay rates based on a value in Employee Setup, a clock prompt or a combination of the two. Scripts that change pay rates are entered in the PayRateScript box which is found in the Accountant Menu > Processing Rules > Scripting category. 

If you are looking for information on scripting pay rates in TimeWorks, please see, Alternate Pay Rates- TimeWorks.

This article will go through some examples of basic pay rate scripts that will help you customize the timekeeping account for your client.

IMPORTANT: In order to script pay rates, the PayRates rule must be turned on. This is done in the Processing Rules > Pay rate calculation category.

Change Rate Based on Employee Setup

A very basic example that adds a dollar to an employee's rate based on the Home1 field would look like this:
 

if (employee.home1 = "100"){
     payrate = payrate + 1.00;
}


The above states that if Home 1 equals "100" then give the employee a pay rate of the current pay rate in effect plus $1.00. The employee.home1 field could be replaced by any field in Employee Setup. More information on the keywords used to reference Employee Setup can be found here.

Change Rate Based on Day of the Week

You can also use reportingdate.weekday to determine the day of the week and alter a pay rate accordingly. This script, placed in the PayRateScript rule will pay any Sunday hours at 1.5x.

if(reportingdate.weekday = "U" and istimes){
  payrate = payrate * 1.5;}

Change Rate Based on Clock Prompt Entry

We can also use alternate pay rates based on what an employee selects from a clock prompt. Suppose employees earn an additional $1.00 not based on having "100" in their Home1 field, but instead earn an additional $1.00 for clocking into a clock prompt with the Department number "100". For our purposes, the field name "Dept" will be used when referring to this clock prompt. More on setting up clock prompts can be found here.
 

if (Dept = "100"){
     payrate = payrate + 1.00;
}

Using Alternate Pay Rates from Employee Setup

TimeWorks Plus only supports one pay rate field by default and you will need to add additional pay rate fields like the ones we will be using in our examples below by first enabling the extra filed though Settings Menu > Processing Rules > PayRates.

Here is an example of a pay rate change based on a clock prompt with the Field Name of Dept. The Field Name could be whatever you choose to call the clock prompt. 

Note that in TimeWorksPlus, the default pay rate is referred to as employee.payrate0, so an alternate pay rate would be entered in PayRate1 and referred to as employee.payrate1 in the script.
 

if (Dept = "100"){
     payrate = employee.payrate1;
}


The above states that if there is an entry at the prompt of "100" then change the pay rate in effect to "Pay Rate 1" in Employee Setup.

Change Pay Rate Based on Category

If you would like to change the pay rate based on the Punch Category and use an alternate rate from Employee Setup, you would then create a script like the below:


if (category = "Training"){
    payrate = employee.payrate1;
}


The above script checks to see if the category matches "Training" (note, this category must be setup in the Punch Categories Rule) and then uses Pay Rate 1 from employee setup as the timecard's pay rate.

For adding a differential to the Default Payrate in Employee Setup we would create a script like the below using the differential of payrate x 1.5:


if (category = "Training"){
     payrate = employee.payrate0 * 1.5;
}

Validate Clock Prompt Entry Against Employee Setup

You can even us more advanced scripting like the below which takes an entry at our x prompt and matches it up to Dept 1, 2 or 3 and if it finds a match changes the pay rates to either "Pay Rate 1", "Pay Rate 2", or "Pay Rate 3".

It also includes an exception stating that if the entry doesn't match any of the Department fields to flag the punch with a message stating that "Employee clocked into unrecognized department":
 

if (Dept <> "") {
     if (Dept = employee.department1) {
            payrate = employee.payrate1; }
     else if (Dept = employee.department2) {
            payrate = employee.payrate2; }
     else if (Dept = employee.department3) {
            payrate = employee.payrate3; }
      else {addalert("Employee clocked into unrecognized department");}
}


This script begins by checking to see if, in fact, there was an entry made by the employee when clocking in. If the entry is blank, the rest of the script will not run. If the entry is not blank or empty (<> ""), the script will check the entry against the alternate Department entries in Employee Setup until it finds a match. When it gets a match, it will change the pay rate. If no match is found in Employee Setup, an alert will be added to the time card that they clocked into an unrecognized department.

Please note that the default department for an employee is employee.department and the first alternative department is employee.department1.

IMPORTANT: TimeWorksPlus Employee Data fields do have an effective date, so if your script isn't running, it may be because the entries in Employee Setup are effective after the day on which the script is running.
  • Get More in Support Center

    Swipeclock partners can submit cases to technical support and view additional articles in Support Center.

    Your accountant login to TimeWorksPlus is required to access Support Center.
75a03bdcd095922b9b9f549098e014fe@swipeclock.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete