Add "Commision" earning type to calculate the commision of an employee automatically

I dont know if this topic should be posted here but I would like to ask the developer of ERPNext to add a way to calculate the commission based on sales made in any given period of time (actual month for example) of an employee automatically when you want to calculare his/her wage.
Nowadays you can only add it as a fiex item and add the amount of the commission manualy every period.
If that feature is available as of now, whoudl someone let me know where to find it or how to set it up? I’va been reading the documentation but there’s nothing i can find about the subject.
Thanks in advance

There is the commission section of the sales order, I don’t know if you have seen that.

Sales Partner

I don’t have sales partners just salesmen who work for their base salary and commissions over the sales they make every month.
My issue is that when I process their salary, I have to make the calculations by myself taking every sales they made during the period for each employee.
If the system knows what are the sales for every salesmen and if it knows what is the contribution they make to every sales (via the costumer info or selling order) it should be fairly easy to get the commission for every employee automatically in their salary slip.
BTW I know nothing about programing but I assume that it can be done. And it will save us a lot of potential mistakes having that calculated by the system instead of ourselves.

@pugalde I have the same needs and I don’t know how to do it as well, I can see the calculation in every invoice but it’s painful since I need to calculate all invoices happen in the last month to add it in his salary slip.

Did you figured out how to do it?


And how to use this commission in the salary structure?

@pugalde and @Ahmed_Ibrahim

Really I would to ask here in the forum if the following is possible:
Is it possible to add salary component that will call a method and this method will do the calculations and return value? Because you need to give the start_date and end_date for this method to calculate the employee sales and the employee commission based on the commission percentage.

Otherwise, a big change will be needed to be added for the ERPNext salary structure core code.