Home      Ask a Question      My Stuff      Help   
  
TimeWorks: Scripting - Examples
This article will show some examples of different ways that the scripting language can be used.

CLOCK PROMPT EXAMPLE

The following example is based on the "X" Prompt. In this case, the "X" prompt has the options 1, 2 and 3 set.
When the employee enters any of those numbers at the prompt, it will name the corresponding choice accordingly.

if ( x = "1" ) {
x = "Server" ;
}
if ( x = "2" ) {
x = "Hostess" ;
}
if ( x = "3" ) {
x = "Bartender" ;
}

CATEGORY EXAMPLE

This example takes a time range and gives it a name.

if(touches (2:00pm, 10:30pm))
{
category = "D1";
}
if(touches (10:30pm, 7:00am))
{
category = "D2";
}

PAYRATE EXAMPLE

This example defines a payrate based on various factors.

if ( "SU" contains weekday (punchdate) )
{
if ( touches ( 15:01, 22:59 ) )
{
split ( 15:00 );
split ( 23:30 );
category = "WKND1";
payrate = payrate + 1.25;
}
}

INTIME EXAMPLE

This example defines a shift based on the In Punch.

if((intime > 2:00pm) and (intime < 3:00pm))
{
category = "Shift";
}

OUTTIME EXAMPLE

This example defines the shift and the payrate based on the Out Punch.

if((outtime > 7:00am) and (outtime < 8:00am))
{
category = "Shift";
}
if(category = "Shift")
{
payrate = payrate + 1.00;
}
}


HOURS EXAMPLE

The following example sets payrate based on the time frame that was worked.

if (overlaps (8:00pm, 4:00am) and hours > 7.99)
{
y = "3";
category = "Regular3";
payrate = payrate0 * 1.10;
}


NONOTWEEK EXAMPLE

This example defines when the time worked rolls into OT. In this case, OT does not go into affect until after 2000 hours have been worked for the week.

nonotweek=2000;
(please remember to use no spaces)
----------------------------------------------------------------------------------------------------------------

Here are some other examples of ways to script...

Istimes Example:

if (istimes = true)
{
split (5:30p);
if (touches (5:30p, 8:30p))
{
category = "Diff";
}
}


Ishours Example:

If(ishours = true)
{
Category = “Sick”;
}


Ispayonly Example:

If(ispayonly = true)
{
Category = “Bonus”;
}


Isholiday Example:

if (isholiday and (category="Regular")and (z <> "3"))
{
category = "WK Holiday";
}


Inismissing Example:

if ( inismissing = false and istimes = true ) {
if ( intime < 1:00am ) {
yesterday ( 0 ) ;
}
}


Outismissing Example:

if ( inismissing = false and outismissing = false and istimes = true ) {
if ( intime < 9:00am ) {
roundin ( "N15" ) ;
}
if ( outtime > 5:00pm ) {
roundout ( "N15" ) ;
}
}


Inisedited Example:

If(inisedited = true)
{
if((intime > 4:00am)and (intime < 6:03am))
{
if(touches(9:30am,2:03pm))
{
category = "RegWage";
}
else
{
category = "Shift 3";
}}
}


Outisedited Example:

If(outisedited = false)
{
if (touches(12:00am, 4:00am))
{
category = "Shift 3";
}}
ID
108
Category
Training
  FAQ's
Date Created
2/22/2007 4:27:03 PM
Date Updated
8/13/2014 3:01:34 PM
Back to Search Results