Discount code fields

I think you are using it wrong.
alse maybe you are not callig the function in the right way.

however, I want to see the user interface that you have and the code of cal() function please, to understand what you’ve done better.
also how you do you get the item price?