Home      Ask a Question      My Stuff      Help   
  
TimeWorksPlus Scripting: Changing / Copying Clock Prompt Data on Time Card
Oftentimes, it is helpful to change how a clock prompt entry appears on the time card.

For instance, suppose the employees are using a physical clock and entering a numeric job number, (like "10" for Servers, or "20" for Bus Boy) and the client would prefer to see the label "Server" or "Bus Boy" when viewing the the time card or reports.

Conversely, you may also want to convert a client's designated job codes and/or department descriptions into a code more suitable for your payroll export.

Both of these scenarios can be accommodated through scripting.
Change How a Clock Prompt/Labor Code Appears on a Time Card
For the first example of how this would be scripted, we'll use the following scenario.

Monument Fitness has employees clock in via a biometric clock. Certain employees work as Trainers in addition to working the Front Desk. When they clock in, they enter "10" via a clock prompt for Trainers and "20" for Front Desk. The Field Name of the clock prompt is Dept. This means, when you refer to the prompt in scripting, you will use "Dept".

First, the script will check to see if the value of Dept is equal 10. If it is, we will change the value of Dept to Trainers, if not, the script will move on to the next condition.

if(Dept = "10"){
Dept = "Trainers;}

Next, if the Dept is not equal to "10", it will check to see if the Dept equals 20.

else if(Dept = "20"){
Dept = "Front Desk";}

You can continue adding else if statements for as many ​values are necessary. When you reach the end of your list of possible values, you can close it with an else statement that would apply if an employee enters an invalid department number. This will allow the supervisor to see that the time card needs to be changed.

else{Dept = "Invalid Entry";}
Converting a Clock Prompt/Labor Code to a New Clock Prompt
In the prior example, we took a clock prompt value and changed it while keeping it in the same field on the time card. In this example, we'll take a clock prompt value and change it, but put it in a new clock prompt.

Sampson Floral has employees using the WebClock. Rather than have them try to remember cryptic code numbers for their various departments, they have a drop down list that has the following departments that they want tracked in payroll for job costing.
Delivery
Cashier
Sales
Maintenance
However, the codes you have setup for these departments in payroll are short, numeric codes, so you would like to maintain the descriptive names from above for the client, but use a number when exporting. To achieve this, you would set up a second clock prompt and write a script that sets the value of that new clock prompt. The field name for the actual prompt used by the employees is Dept and the clock prompt used for export is called DeptCode.

The script will start by checking if the value of Dept is Delivery, if it is, it will set the value of DeptCode to 10, if not, it will move on to the next possibility.

if(Dept = "Delivery"){
DeptCode = "10";}

If the Dept was not Delivery, it will check if the Dept was Cashier.

else if(Dept = "Cashier"){
DeptCode = "20";}

You can continue adding else if statements for as many ​values are necessary. If the Dept clock prompt is set with up with a requred entry and a Prompt List, you could finish your script with the following else statement.

else{DeptCode = "40";}

The reason is, the restriction list on the prompt means the value must be one of the four listed departments. If the Dept wasn't Deliver, Cashier or Sales, it must be Maintenance, which is code "40".

If the employee is allowed to skip this clock prompt entry and leave it blank, you would instead want to change your script to the following:

else{DeptCode = "";}

Visible/Editable- Not Editable
IMPORTANT: When you are scripting data from one clock prompt into another, it is usually wise to set the Visible/Editable setting on the destination clock prompt (in this case DeptCode) to Visible/Not Editable. This will prevent unintentional changes made by the manager if they edit the DeptCode and not the Dept field on the time card.

You could also set the prompt to Not Visible/Not Editable if the prompts sole purpose is for the payroll export. This may cause less confusion for the client.
ID
1579
Category
>Support
  Scripting
Date Created
7/15/2015 4:27:42 PM
Date Updated
7/15/2015 4:28:11 PM
Back to Search Results