Home      Ask a Question      My Stuff      Help   
  
Scripting - Entering Negative Numbers at a Numeric Prompt
This article explains how to set up, assuming that you are entering a negative number into a numeric prompt (i, j, or k), there is a available job code prompt (x, y, or z) and that you know how to set these up (How To - Setting Up Clock Prompts):

The process is in three parts:

1. First we need to enter in the amount at a numeric prompt.
2. We then need some way to tell the clock this amount needs to be a negative number. This is accomplished using a job code prompt.
3. We then need a script to translate this to a negative number on the time card.

This article will only go over part three. The script will read as below using the I numeric prompt the X job code prompt and an empty variable, I chose "a" (to do part of the calculation) in the example:

if (i > 0 and x = "2")
{
a = i * 2;
i = i - a;
x = "";
}
What this does is if it sees there is an amount in the "I" prompt (the amount you want to be negative) and if the job code "x" prompt equals to "2" which we are using to tell the system to change this to a negative number then do the calculation:

1. Make "a" be "i" times 2.
2. Subtract i from a so our original amount minus i times 2 to get the negative of our original number.
3. Remove "x" ("2") entry from the time card as it isn't needed.

See below for a screen shot of this in action.




NOTE: This will do this on the time card but may not work when exporting with every format and once imported into your Payroll Software. Please consult your payroll provider before considering using this script.
ID
587
Category
<Unassigned>
Date Created
7/8/2011 2:48:54 PM
Date Updated
12/17/2014 1:21:59 PM
Back to Search Results