How and how best to calculate a net value

Asked

Viewed 51 times

-5

These days I’ve come across a problem I can’t solve and I don’t know much where it starts.

inserir a descrição da imagem aqui

I have these 4 fields on my system, where, if the user infoma the discount in percentage, the system automatically shows to the user, in the field Discount in R$, value I get in cash, and if the user informs in the field Discount in R$, it shows in the field Discount %, value in percentage and vice versa, being something dynamic, and at the end of it all, show the liquid Total, but that’s the least, I just want something dynamic, with the 2 fields Discount % and Discount R$, where in the field that the user informs he shows either the percentage or the discount in cash.

If someone gives me a light where to start, to do it dynamically, I know I’ll have to use it script but I don’t know where it starts.

From now on, thank you !!!

1 answer

-1


Well, to automatically appear you can use an html event like onkeypress think.

Now, to calculate discount of % and of R$ you can give a name the input and with jQuery when the html event is activated check if the name corresponds to one of them, if it matches do a function to make the calculations of each one.

At least, that’s what I would do.

  • thank you very much, that already help me enough, now I have an idea of how to do !!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.