Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article gives an overview on how to work with Payroll scripts.
You might also be interested in the following article: Fields Overview available for Payroll Scripts

1)    Location

All the scripts are located under Payroll > Scripts Editor.

...

  • Add new Packages and Scripts;

  • Export/Import existing Script Packages;

  • Add content to the newly created Payroll Scripts or edit the existing ones etc.

...

2)   Script Package Description

All payroll scripts are logically grouped into packages and you can add as many script packages into the system as you need. Each package consists of maximum 999 scripts.

...

Commonly we have one package for all the Entry Code scripts and one for the sub-scripts.

2.1)  The structure of the script file

Let’s take PWSCRADO.DEF package as an example.

...

#####001 means the number of the script, while þ???????? is the name (e.g. #####001þBasic Wages)

3)    Script components/operators

Operator

Description

Example of use

=

to say that parameter 1 equals to parameter 2

(the position of the parameter matters)

L61=L21

to identify that parameter 1 is less than parameter 2

L21<PR1

to identify that parameter 1 is greater than parameter 2

L21>PR1

+

to plus the values of parameter 2 with parameter 1

L61=L21+PR1

-

to deduct the value of parameter 2 from parameter 1

L61=L21-PR1

*

to multiply parameter 1 with parameter 2

L61= L21*GB1

/

to divide parameter 1 by parameter 2

L61= L21/GB2

()

to separate the condition into a separate clause

L61=(GB1/30)+PR2

[]

to round the amount within those brackets

+0,5 is usually added to round to whole/integer number

to round to 2 decimals you can multiply and then divide by 100

L61=[((GB1/30)*L22)+0,5]


L61=[((GB1/30)*L22)*100)+0,5]/100

“ ”

All the plain text values should be put into quotes.

Numbers can be used without the quotes.

Empty value can be identified with “” without a space between them.

H1=”SAIL”


L21=””

//

Any line starting with // will be considered a comment line

(the commented part of a script will be inactive)

//this is a test script

// L61=L21

IF

to identify the start of the condition clause

IF PR1<>0

THEN

to identify the result of the condition clause

THEN

L21=(PR1/30)*L22

ENDIF

to identify the ending of the condition clause

ENDIF

AND

to add several equal parameters to the IF clause

the clause will work only if all the conditions are true

IF PR1<>0 AND H1=”SAIL”

THEN

L21=(PR1/30)*L22

ENDIF

OR

to add several equal parameters to the IF clause

the clause will work if at least one of the conditions is true

IF H1=’SAIL’ OR H1=’LEAVE’

THEN

L21=(PR1/30)*L22

ENDIF

@@

to make a reference to another script

@@ADO:005

Functions that can be used in Payroll scripts

Function

Description

Example

IncDateBy (Date: String; Type: String; NumberOf: Integer): String

The function converts the date calculations (made in days) into a text format. 

Returns a date shifted by a specified number of days or months or years.
IncDateBy returns the value of the Date parameter, incremented by NumberOf days or months or years according to Type option. NumberOf can be negative.

  • Date - it should be as "YYYYMMDD" format.

  • Type - "d" day, "m" - month, "y" - year.

  • NumberOf - number of days or months or years.

  • Result - new date in "YYYYMMDD" format.

L25=IncDateBy (P603a,"d",W2) - can be used to show the date that corresponds to Current period start date (P603a) + nr of days ("d") defined by internal accumulator W2.

E.g.:

P603a=20210101

W2=14

L25=20210101+14=20210115


...

Check out our article on Fields Overview available for Payroll Scripts


4)    Script usage

We have several places in the program, especially related to payroll, where it is possible to refer to a Script.

...