Skip to end of banner
Go to start of banner

Payroll Script

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 47 Next »

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.

Here you can:

  • 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.

Script package is a text file containing small sentences written in Basic, normally used for Payroll calculations.

Each package has (.DEF) file format and can be exported/ imported out/into the system. The DEF file can be freely opened and adjusted with the help of Windows Notepad.

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.

1) PWSCRADO.DEF – is a file name where PWSCR is used to identify that this is a package, the following text before the dot is script package Code (ADO in this case) and (.DEF) is definition of the file format.

2) The inside of the package is as follows:

#####001þ???????? Is the structure for the first line of a script.

#####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.

The main purpose of a script is to be used for payroll calculations. For this the script needs to be linked to a corresponding Entry Code under Entry Code Maintenance > Calculation tab.

The script can also be used in other places, but in order to do this it is necessary to input the formula of the following pattern @@ADO:005 where:

Component

Description

@@

script package identifier

ADO

script package code

:

Separator (between script package code and order number of a script)

005

script number in the package PWSCRADO.DEF (always 3 digits)

! (optional component)

@@!ADO:005 is used to tell the script object to return a result as integer. If the result is in decimals, then the system truncates it to integer.

We can refer to a script with the above formula:

Place

Screenshot

In leave factor field at any level (Individual, Payscale Table/Code, Company, Activity)


In any field under Entry Code Maintenance -> Entry code details -> Input, Calculation, Pay slip, Accumulators tab.

 

Inside one payroll script to refer to another script (so called sub-script)

 



 

  • No labels