Salary Component Formula Not Evaluating

Hey, so I’ve tried to do a Formula in my Salary Component, but it resulting 0, what happened?

Can anyone help me?

‘Base’ is not the same as ‘Basic’. Base comes from Salary Structure Assignment.

have successfully resolved the previous variable scope issue by using the Abbreviation (B) of my Basic Salary component, instead of base or Basic.

The deduction component works perfectly uses the formula B * 0.01 and produces the correct result.

However, I cannot get the corresponding Earning component to calculate. With same B * 0.01 Formula.

That would be a circular reference to use the same earning component to calculate itself.

All earnings components are evaluated first (then deductions). This is why the deduction component works. When evaluating the earnings component, ‘B’ is not calculated until earnings calcs are done.

If you can put your earnings component in the ‘base’ in the structure assignment, you’ll be able to use it in other earnings components.

You can use the base amount as an hourly, weekly, monthly, yearly fixed amount, then calculate Basic from this field.

1 Like

Ah, so what should I do if i want one of the earning component to be equal with one of the deduction component? I used Gross Up Method

Try using another method to calculate earnings like the ‘Base’ in structure assignment.

1 Like

is there anyway i dont have to input base?

How are you calculating Basic?

I have set my Basic component (Abbreviation B) to represent the Basic Salary. When generating a salary slip, is there a specific setting or formula to ensure this amount is automatically populated (autofilled) from the employee’s Salary Structure/Contract, or must I always manually enter the value?

Or I have been using this wrong.

When I ask how are you calculating Basic I mean how are you calculating the employee wages (hourly,fixed salary, variable salary, piece work, etc)?

Explain your use case (how you calculate without ERPNext) and how you would like to automate your workflow

Sorry, I think I don’t know the difference of Base and Basic Salary, I thought those two are the same thing? And what’s variable?

My goal is to implement a full Gross-Up mechanism across the salary structure.

This means that for any deduction component where the employee is technically responsible for the cost (e.g., Health Insurance, etc.), the company will provide an equivalent Allowance (Earning).

The objective is to ensure that the Earning (Allowance) value equals the Deduction value for that specific component, resulting in a net-zero impact on the employee’s take-home pay for that specific item

Consider ‘base’ and ‘variable’ as special fields because they are part of the Structure Assignment. You are free to use these or not.

Example of how I use them:

Base (hourly wage, annual/monthly/weekly salary amount, etc)
Variable (rate employee has elected as percentage of salary allocated towards 401K)

‘Base’ and ‘variable’ can be used in both deductions and income component’s.

You are correct to think about balancing (sum of the income must equal sum of deductions (credits and debits respectively)

‘Basic’ is simply a sample component provided out of the box.

Can you provide the logic of how salary and other components are calculated? Like “employees get paid $50/hour and health care insurance is fully paid by the employer $1000/month for single employees or $1,500/month for those with families, etc”.

Thank you for the clarification on base and variable fields. I understand they are special fields tied to the Salary Structure Assignment.

1. Basic Salary Logic (Fixed Monthly)

You asked about my salary calculation logic:

  • Our Calculation Method: We do not calculate based on /hour or any variable metrics. Currently we only use the full paid fixed monthly salary.
  • Basic Salary Component (Basic / B): This is a fixed monthly amount, always Rp 20.000.000,00, which is pulled directly from the employee’s contract (the base field if this possible?). The purpose of this component is simply to record the agreed-upon gross wage.

2. Gross-Up Logic (Balancing)

You are correct that I am aiming for a balance where the sum of income equals the sum of deductions for certain components.

My payroll calculation logic for components like Health Insurance and the 1% Health Insurance Employee Share is:

  • Fixed Deduction: We have a static deduction calculation, for example, Basic Salary×0.1 (or base * 0.1) in the Deduction column.
  • Matching Allowance (Gross-Up): If the company decides to provide an allowance to fully cover this deduction, the formula in the Earning component must be identical to the deduction formula (e.g., Basic Salary * 0.1).

Goal: The value of the Allowance Earning must equal the value of the Deduction.

Earning (Allowance)=Deduction (one of equal component)

This ensures zero net impact on the employee’s take-home pay for that specific expense."

Use the base (in the structure assignment) field instead. If you pay monthly (12 payments per year) you’ll enter the $20k in the structure assignment ’base’ field.

You can use Basic or create your own component like “Salary”. The calculation of Basic/salary = “base“ or “ base * 1”. If you put the annual salary amount in ‘base’ then Basic = base/12.

Health care will be “base * .1” for both the income and deduction (or “(base/12) * .1” when base has the annual salary in the assignment)

Ah okay, I understand, thank you so much! I’ll try your way.

Also consider if the healthcare earnings component should be included in gross_year_to_date. If you don’t want it included you’ll check to box “Do not include in total” you’ll need to do the same for the deduction for net zero.

Also the chart of accounts will be unique for the matching components. Health care income goes to a payable account and the deduction will likely be an expense account.

Check this out.

Hello, I am coming back. What about Overtime? Should I do it with Formula? I am using Frappe 15 dev

Overtime can get complex, especially if you are not keeping track of hours.

How do you handle OT now? How does the record keeping occur?

Typically overtime is done via a formula.

Here’s what I’ve done in the past (using hourly wage in the Structure assignment base field).

This is based on a forty hour work week. Overtime is 1.5*hourly for all hours over 40.

(total_working_hours - 40) * (base * 1.5)
if total_working_hours > 40
else 0

For the standard hourly wage component:

(base * total_working_hours) if (total_working_hours <= 40)
else (base * 40)
1 Like

I guess I tried to use the Timesheet doctype, but honestly, I can’t use it because it keeps giving me weird values. (or i don’t know how to use it)
Is total_working_hours a variable in Frappe?

by the way should i apply this in formula or condition? if i ever apply this.