Hi.
Here's one for the pros!
I have a database that tracks sales commissions for our team of independent salespeople. The commission calculations are based on forumulas dependent on the individual sales person and the company that the sale was made on behalf of. For example, Salesperson Jane Doe sold a $1000 worth of widgets for Widgets-R-Us. Her commission would be calculated as follows:
Company sold for: Widgets-R-Us
Amount of sale: $1000.00
Jane Doe's Commission base: 30%
Our company's "cut": 10%
Jane Doe's commission formula:
(Amount of sale) * (Jane Doe's commission base) = $300
Our company's "cut" formula
(Amount of sale)* (our "cut"
= $100
The rest goes to Widgets-R-Us
There are currently 16 different companys we do business with and each company may have a different commission formula. Also, each salesperson may have different commission rates.
I used a SELECT statement to create the different formulas and all works great.
The problem I've identified with this is if (when) we add a new company (maybe 1/year), it's impossible to "add" the formula unless someone modifies the SELECT statement manually which I definately DON'T want to have happen.
I'm now trying to figure out a way to allow an end user to be able to add a new / or modify an existing formula by using a form and data input.
I thought about creating a table with all variables that exists in the current formulas and allow someone to use a form with combo boxes to "create" the formula (including combo boxes for "*","+","-", etc. Once complete, the new "formula" would be converted to a single string and stored in the table. The SELECT statement would reference the fields based on the company selected on the main data entry form and use the corresponding formula.
Does this sound feasible or would anyone have a better idea on how to handle this?
Many thanks in advance!
Here's one for the pros!
I have a database that tracks sales commissions for our team of independent salespeople. The commission calculations are based on forumulas dependent on the individual sales person and the company that the sale was made on behalf of. For example, Salesperson Jane Doe sold a $1000 worth of widgets for Widgets-R-Us. Her commission would be calculated as follows:
Company sold for: Widgets-R-Us
Amount of sale: $1000.00
Jane Doe's Commission base: 30%
Our company's "cut": 10%
Jane Doe's commission formula:
(Amount of sale) * (Jane Doe's commission base) = $300
Our company's "cut" formula
(Amount of sale)* (our "cut"
The rest goes to Widgets-R-Us
There are currently 16 different companys we do business with and each company may have a different commission formula. Also, each salesperson may have different commission rates.
I used a SELECT statement to create the different formulas and all works great.
The problem I've identified with this is if (when) we add a new company (maybe 1/year), it's impossible to "add" the formula unless someone modifies the SELECT statement manually which I definately DON'T want to have happen.
I'm now trying to figure out a way to allow an end user to be able to add a new / or modify an existing formula by using a form and data input.
I thought about creating a table with all variables that exists in the current formulas and allow someone to use a form with combo boxes to "create" the formula (including combo boxes for "*","+","-", etc. Once complete, the new "formula" would be converted to a single string and stored in the table. The SELECT statement would reference the fields based on the company selected on the main data entry form and use the corresponding formula.
Does this sound feasible or would anyone have a better idea on how to handle this?
Many thanks in advance!