This question has been flagged
3 Replies
12363 Views

Hello all,

I read that rules object can be used inside python calculation of salary rules . If I undestand correctly, with that object I can get any rule value (i.e. its total ) already calculated for the employee during the calculation process in execution, and use it in current salary rule calculation for the same employee. If thas is correct, can anybody indicate the way rules object should be? ( I already know how to get a category current value that has been calculated for an employee during the process, but my point is wheter it is possible to get a specific previosly calculated value for a salary rule of the employee)

I appreciate your response.

Avatar
Discard
Best Answer

use the code of the rule, for example of the rule name is 'pension contribution' and code is 'PENS' then you can simply put it as shown in example below:


result = categories.BASIC - PENS
Avatar
Discard

@Bernard Kipkorir Too: Great! directly rule code can able to access. Tried rule.PENS not working PENS is working. (Not clear in document)

Best Answer

You can get the previously calculated salary rule by using the salary code.

For Example,

If you salary rule name is Basic Salary and its code is BA then, you will get this data of this salary rule in another salary rule.

Lets Provident fund is another salary rule and its code is PF. Provident fund is 12% of the Basic Salary + Driving Allowance. (Assume that there is another salary rule called Driving Allowance with code DA)Then the PF is calculated as shown below.

result = (BA + DA) * 12 /100
By the above python code you can calculate the PF.
Avatar
Discard