Hey all,

I work for an organization and we're trying to figure out how to calculate and assign some end user fees.

Typing this out is a little tough so I'll do the best I can. We have an event registration system that uses a ticketmaster type of model where the user pays a fee at the very end. We are currently using this registration system for sports camps and are having some trouble assigning user fees. The fee is dependent upon the total amount of the transaction. This is very simple for a single transaction, but becomes increasingly difficult when multiple camps are registered for at once.

Fee structure example:
$1-$99 - 5% + $1.50
$100-$250 - 4% + $2.00
$251+ - 3% + 3.00

Obviously, our system automatically calculates the TOTAL transaction fee, but we need to assign the weighted transaction fee individually to each item of a transaction. Each item is cataloged in the output individually, but if two camps were registered and paid for in the same transaction, they are given the same transaction ID. Example below:

Transaction ID CAMP Cost TOTAL FEE
1 Tennis $50 $8.00
1 Baseball $100 $8.00

2 Basketball $80 $5.50
3 Tennis $50 $11.25
3 Baseball $100 $11.25
3 Hockey $125 $11.25


As you can see, we get the total fee for each, but I'd like to assign an individual fee to each. See Transaction 1: the total fee for both is $8.00. I'd like to calculate that total fee based on the total amount of the two items ($150) then calculate the fee for each item based on its weighted amount towards the total transaction (Tennis: $50 - 33.33333% of total transaction - fee: $2.67 / Baseball: $100 - 66.66666667 of total transaction - fee: $5.33).

I would like to come up with a way to automatically calculate this.

Thoughts?

Thanks for your help - please let me know if you need clarification on any of these.