Try ERPNext Buy Support Partners Foundation

Multiple Employee Variables in Salary Structure

I am trying to build 2 salary structures one to be applied to salaried staff and the other to hourly paid.

Our staff will be split roughly 50/50 between the 2 structures.

As I understand the ERPNext design goals the salary structure/rules should be relatively constant for each group but that employee specific data should be taken from either the employee record or the salary stucture header table where base and variable salaries are specified.

However for each of the employee groups there are a number of possible earnings and deductions that could vary from month to month for each employee but that should be shown in the salary slip eg performance bonus, per diem for nights spent away from base, repayment of loan…

The variable field does an OK job for this when there is just one possible component but not when there are many. Is is possible to customize this header table to have multiple variables?

Hello @mafrica,

Can you give me an example to understand the query better?

We are a hospital in Tanzania and a number of our staff work on outreach programmes travelling to tribal villages. They are payed on a fixed monthly salary basis, but with additional allowances for each night that they spend away from home this is a fixed amount per night and subject to tax. If I had a variable which I might call number_of_away_nights then if it is none zero I could have a standard earnings calculation that multiplied this by the nightly allowance and then fed into the earnings calculation. I need a second variable bonus for one off payments that occur from time to time. This would also feed into gross earnings but via a different standard calc.

Thus I would like the header section of the stucture where we select employees to have the id, base and a number of variable columns.

Is it possible that I could get a reply to this as it has quite significant impact on the way I design the salary process for our hospital? If it falls into the enhancement category then fine, but a timescale would be useful to know whether to expect the function to arrive before we need to go live?

You can add custom fields for that in Salary Slip Employee doctype.

Thank you. I think you may have meant Salary Structure Employee doctype. I have added 2 extra rows following “variable” but I am unable to edit the rows or save the modified doctype.

I have read that I may need to change into developer mode for this. To date I have been experimenting with your web service but guess that developer mode will not be available there and so have downloaded a standalone version into a virtualbox instance. This seems to generally work OK, but to turn developer mode on I have added “developer_mode”: 1 to the sites/common-site-config.json. Unfortunately this leads to an “Internal Server Error”

Can you suggest what I may be doing wrong?

You should never edit the doctype. You should always add custom fields via “Customize Form”

Thank you. As a newbie when the prior reply suggested “add custom fields for that in Salary Slip Employee doctype” I took that at face value. Customizing the Salary Structure Employee Form works fine.

Well almost fine. I am able to declare the additional variable fields and give them nice names and types, but when I come to reference them in the Salary Structure I am told that the field names are not defined.

Despite much reading I guess I do not understand how you reference a field name in the sub form of salary structure employee from within sub form salary component…

Can you help?

I would be really grateful for a response on this as I am sure the answer is simple, but it is now delaying my work. Thanks in anticipation.

I am sorry to bump this again but it is a month since the issue was raised and I think it must be a trivial problem of a hole in the documentation, but it is really blocking my progress. Could someone please respond?

@mafrica can you share some screenshots explaining your current setup? Generally you should never change the DocType

I have customized the form salary structure employee s recommended not the doctype and added the necessary fields eg dsa (this is intended to be the number of days where a subsistence payment is due.

The first screen shot shows this.

The second screen shot shows this extended salary structure employee completed in my test case

The third shows a very basic salary structure component based on DSA.

The fourth shows the error message that I get when I endeavour to generate a payslip

I hope this is what you needed. I would be grateful for advice on how to proceed.

I think currently you cannot use custom field in formula and condition of Salary Structure. Can you please raise the github issue for the same.

Thank you. I have posted on Github.

This now appears resolved in version 8.0

I have the same question again. I didn’t quite understand the solution taken vis-a-vis the question raised. The requirement to have salary structure per employee vs salary structure for group of employee is valid for me.

I would have loved to have a hierarchical salary structure, so that structure of company is applied, then structure of department/employee-group, then structure of per employee.

e.g. housing allowance could be different for each employee but consistent across months for each employee. How did you achieve this?

I created a salary structure using factors X base.
Could you put your screen shot of salary structure? thanks

Maybe the missing party of the explanation is that it is necessary to customize the form Salary Structure Employee. Here you can add potential benefits/allowances and deductions and give them some meaningful and abbreviated names.

You could then create a central/corporate structure using these added benefits etc which you clone/duplicate and adapt for each branch/division. Then add the appropriate employees to the right structure and plug the specific variables into each employee instance of the extended Salary Structure Employee.

Gosh that sounds complicated but it is not so bad other than the absence of direct inheritance and so any corporate changes will need to be hand replicated.

1 Like