Really strange. Salary Slip + Formula + Salary Component + Salary Structure

Hello all,

I could really use some help here. I’m really confused.

I’m new to ERPNext, and am trying to get the hang of using it.

Currently I’m evaluating on erpnext.com.

I’m trying to get payment slip working. I have created all the necessary parts needed to create a Salary Slip: employee, timesheet, salary structure, salary components and so on.

In the Salary Slip page, under Earnings & Deductions, I’m seeing 2 issues:

  1. Basic component will ignore all formulas in Salary Component Basic. It will be Total Working Hours * Hour Rate regardless of what’s in the formula mentioned above. Please see screen capture.

The reason we need to use formula for Basic is because we have 9-hours shifts. Any more work hours after that will be calculated as Overtime. Hence, we need to subtract what’s been clocked by - 9, and then times the hourly rate to get the Basic wage.

  1. the formula for Salary Component will be ignored; it will be effective if it is placed in Salary Structure. However, this Salary Component is referenced in Salary Structure! Please see screen capture.

I’m sure I’m doing something wrong. Appreciate any feedback.

Much thanks!

Can someone please please help? Any pointers?

Hi

First of all, you have to create a Componants which you refer in formula. let say if you are putting Total Working Hours so you have to pull the total hours by refering some component or some doctype field which is correct here. please check the if condition in the formula field.

also in Basic Componant you are directly entering a amount so you don’t need to checked amount based on formula

Best Regards
Ranbir Singh

Hello Ranbir, thank you for your reply. Much appreciated!

The reasons I entered an amount is to make sure the simplest approach works first. Unfortunately the amount doesn’t use this number…it is still calculated using total_working_hours * hour_rate.

As you can see in the first picture, the component Basic is already in place. Practically 2 components are already built: Basic and Overtime.

I’m not using any extra fields for this computation. The Total_working_hours seems to be valid as I can use it in Overtime component, but it has no effect in Basic component.

What else did I miss?

First thing I noticed is you put your overtime formula on 3 lines. in my years creating salary structures and calculating net pay and creating salary slip on ERPNext, putting conditions/formula on separate lines has never worked and I do wonder why this is so. All your formula should be on line 1. to Determine which aspect of the formula should apply, use the “and” “or” functions to combine and/or separate parameters.

Thank you very much @flexy2ky.

Thanks for the great tip!

I’m starting to get the hang on it, I think.

The reason why the Number in Basic Salary Component is not used might be, could be, because Salary Structure has already “remembered” the first version of the formula, so any further changes in Salary Component will not be used. Am I correct?

I deleted all Salary Component, Salary Structure and start over again. This time Salary Slip used the Basic and Overtime Salary Components’ formula properly.

Now I need to figure out how to add a Custom Field for Overtime Hour Rate and use this in Overtime’s formula.

Thanks again!

@flexy2ky @Ranbir please check this post for multiline formula

1 Like

Wow, I can’t imagine we can work this out without a collective effort, or without digging deep in the source code!

Thanks for the pointer!