I have following condition<br>buying 3 pen gives 1 free pencil<br>buying 5 pen gives 1 free rubber<br>buying 10 pen gives 1 free chocolate <br><br><br>so if some one buys 19 pen then his free items will be<br><br>1 chocolate due to 10 pen<br>
1 rubber due to remaining (19-10) pen<br>1 pencil due to remaining (9-5) pen<br><br>I have objects of sales_details where trnqty is the quantity purchased how to calculate the free items using drl<br><br><br>