ERPNext Conference 2019* ERPNext.com Blog

Salary Component Formula - Age Based Calculation

erpnext

#1

We’re trying to configure a deduction component where the deduction percentage changes based on Age. But, couldn’t find a way to achieve this without long route of creating different structures for each age and manually switching the structure when Employee’s Age slab changes.

Is there any way of deriving Employee’s Age in Salary Component Formulas?

Is there a way to expose methods from Employee DocType in Formulas?

Thanks,
Vamyip


#2

You can configure Salary Component with conditions like

date_of_birth > date(dd, mm, yyyy)

Please note that date_of_birth is a field of Employee document.


#3

Hello Anoop,

Is there a way to derive dd, mm & yyyy for exactly say 60 Years ago in formula? Or any way to get a date X years ago?

If I put a static values – say date(01, 09, 1959) – as reference for comparing against date_of_birth, the formula would become invalid the very next month.

Thanks,
Vamyip