I want to make Earning calculation base on the employment type

(using python)

if (employment_type == ‘Adjunct’):

base * 4/100

else:

base = 100000

How do i implement this using erp salary structure Earning:

Thanks

# Salary Structure Multiple Condition on Earning

What is the condition/formula coding language for Salary Component?

**nabinhait**#2

Try adding 2 rows for the same component, one with the condition `employment_type == ‘Adjunct’`

and the other with `employment_type != ‘Adjunct’`

Tanks for ur reply…But I don’t understand what u mean. U said I should type the two condition == and != With the adjunct condition. do u mean just put it on the condition block… How do I differentiate the amount they earn.

I mean

employment.type==‘adjunct’ base *40/100 then employment.type !=‘adjunct’ base

Tanks

**nabinhait**#4

I was suggesting to add 2 rows in Earnings table for the same earning component.

For example, I want to add a earning component “HRA” based on employment_type. Then I will add 2 rows for “HRA”.

In the 1st row, add condition `employment_type == ‘Adjunct’`

and formula `base*40/100`

In the 2nd row, add condition `employment_type != ‘Adjunct’`

and formula `base*20/100`

Tanks very much. I understand now…But is there no way to do some complex calculation base on some condition .

Tanks

**nabinhait**#6

I think you can also write the formula like `base*40/100 if employment_type == ‘Adjunct’ else base*20/100`

and no condition needed in this case.

That will require 2 Salary Components to be defined. One with condition employment_type == “Adjunct” and the other with the negation of this condition. Otherwise the second salary component will be applied no matter what. That will be a logical error.

It works better to think of the components are calculation steps and make use of Statistical Components as much as possible for complex calculation structures. I am on v11 right now and successfully implemented the Turkish salary calculation and a few of the incentives.