Have you already used webERP?
I think the first thing you have to solve how to separate retail sale and whole sale.
And you also should define the commission rate in webERP's set up->Sales People link.
Then you can create a by the tool provided by webERP or create it yourselves. .
Best regards!