loop through transactions to get total discounts for employee
$30-75 USD
Closed
Posted about 16 years ago
$30-75 USD
Paid on delivery
i need some code added to my existing application to loop through each transaction for an employee to calculate the total discounts.? each transaction can consist of multiple service items.? an employee can also have hundreds of transactions associated to them.? it gets a little tricky where there are multiple discount coupons presented for 1 transaction. an example would be if they had a $7 transaction and they get a 1 bonus then a coupon is presented to the cashier for $7 off that is 100%
so bonus of $1*100%=1 so that cancels out.
then in the same transaction they have another service item for 4 and they get $.50 bonus and another coupon is presented for $4 off, but that is only percent value in the lookups table is 50% so the so .50*50%=.25 so the less discount for this 1 transaction is .25 then it would have to loop through the other transactions and do the same thing.
i've attached an xls to let you see the sample data that we have in the db.
i've also attached my db schema.
transactions table consist of 1 transactions.
tvalues consist of all service item for a transactions? ? tvalues.transid2=transactions.transid.
lookups table consist of bonuses and discounts.