I am working on the script where I can fetch the data from Employee Paid Leaves, Balance Leaves from the leaves and show it on salary slip, but I am confused from which table I should call and How I should call.
Can anyone give me an example if I want to show the leave balance on Salary Slip then what should be the custom script?
I have already created the custom field name balance leave on salary slip doctype.
Thanks for the responses, but as I am not hard core programmer, can you give me an example that where I have to use this code? Currently I am putting it in Steup >> Custom Script>>
But it is giving me some error. Please find the below screen shot, the marked fields I want to fetch
Hi,
Please refer the pages in wiki on how to do client side scripting. Look for how to use frappe.call method to execute sever side methods. Its old, still you should be able to figure out.
Also look into leave_application.js on how the get_leave_balance method is invoked. You will have to do this for all leaves types based on your requirement.
Now I want to show this casual leave balance or any leave balance on salary slip custom filed which is Balance Paid Leave, that means if the employee has 3 Casual Leaves and 2 Sick Leaves then the Balance Paid Leaves will be 5.
Apart from that I also want to show the Leave Taken which will be the sum of Casual + Sick + Any other leave on the salary slip Paid Leaves.
Now with your code I was trying to fetch the balance leaves to the shown on balance paid leaves on the salary slip, so as instructed I put the code which is given by you, i.e.