We need to write some code that will assign sales reps to our customers, but the percentages are not equal. Based on total purchases, we want to assign the sales reps to the customer based on this scale:
Sales Rep 1 - 21%
Sales Rep 2 - 21%
Sales Rep 3 - 17%
Sales Rep 4 - 17%
Sales Rep 5 - 15%
Sales Rep 6 - 9%
We assume some round robin logic will be needed. But how to assign the rep to the customer based on non-even percentages like that? So, if we have say 100 total orders, and then a new purchase makes it 101, then another purchase makes it 102, etc.
Any help would be great.