Hi,

I'm not sure if this is in the right place but I'm trying to develop logic for a promotions mechanic for some software. The example deal I'm working with is as follows:

Buy 2 cases - get 2 bottles free

Buy 3 cases - get 3 bottles free

Buy 10 cases - get 12 bottles free

I buy 5 cases - I get 5 bottles free (2,3)

I buy 7 cases - I get 7 bottles free (2,2,3)

I buy 13 cases - I get 15 bottles free (10,3)

etc....

The problem comes when I'm trying to program the logic on the 2 and 3 case deals. Because the ratio of free stock is the same, the calculations throw up all sorts of issues. Also, this is just one example....it could be a buy 5 get - 5 free / buy 12 get 15 free.... so in effect, a formula that can be used against any sort of promotion is needed.

I'd appreciate any help on this one, it's driving me mad!!

Thanks

Matt