Salary Slip year to date column calculation on print out

Any one know how to put the YTD column on salary slip.

1 Like

what is the use case?

The use case is that in many jurisdictions, knowing the YTD value for various salary components is useful to an employee from an awareness perspective (on printed salary slip) and is also very useful in varying tax calculations that need to know this value due to ways that tax are applied based on the value. This is a big need that is not in the platform today. I have mentioned the same in other threads.

This has popped up several GitHub issues and forum topics but hasnt yet got the attention:

I’m planning on a customisation template. Not much experience customising ERPNext under the hood. But we can do some new fields/doctypes and add a few scripts to achieve this. Doable with some help from the Pros.

In reply to @James_Robertson’s Github post. Heres my full idea:


I’m considering customising the HR module to achieve this. I plan to pull the values from past payslips and sum them up in the current payslip.

It’d also be useful to save the current value in the Employee Profile, or better a linked document.

This will need an opening value in case of an implementation with already existing YTD values (mid-year for example).

So the formula for YTD Tax would be:
Employee_YTD_Tax = Employee_Opening_Tax_Value + [Employee_Past_Payslip_Tax]

Does anyone know how to query this given item from all past payslips on a given Employee ID?

I need this functionality to (In Canada) I will be willing to put some effort into adding this but I don’t have the time currently. I will check back in on the progress and help out if you haven’t figured out a good way.

1 Like

I am no developer, but my guess would be that there is going to need to be some kind of back end python code that goes in and queries past payslips based on the employee id or some kind of key field. You will have to look up fiscal year information first to know when the “start” month is and then from there go back X months from current month and grab the data. If there is a way to store the data in a table, that would be good so that once the calculation is done once it is good for a full month before having to be queried again. I would think an update to the salary slip doctype would be a good place to capture this. This would save precious resources at server side.