I need to make an IF in Javascript. I'll explain:
A customer sells:
- 40kg barrels.
- 3kg tube.
I'm not sure how to do this IF. The idea is to show in the field qtd40kg
Only multiples of 40, which is the weight, ie:
If I need 40k in the field shows 1, 80kg shows 2, 120kg shows 3, this is because multiples are 40.
Now in the qtd3kg
field is a little different, it is multiples of 3kg that will fill the interval between qtd40kg
.
Link link
Ex:
qtd40kg
40kg -> qtd40kg = 1un;
80kg -> qtd40kg = 2un;
120kg -> qtd40kg = 3un;
160kg -> qtd40kg = 4un;
.
.
.
Até 1.000kg
qtd3kg
0kg -> qtd3kg = 0un;
3kg -> qtd3kg = 1un;
3kg -> qtd3kg = 1un;
9kg -> qtd3kg = 2un;
.
.
.
Até 30kg, depois ele irá fazer assim:
Suppose that:
peso = 43;
Então ''qtd40kg = 1'' e ''qtd3kg = 1''.
peso = 46;
Então ''qtd40kg = 1'' e ''qtd3kg = 2''.
peso = 49;
Então ''qtd40kg = 1'' e ''qtd3kg = 3''.
peso = 126;
Então ''qtd40kg = 3'' e ''qtd3kg = 2''.
Link link
Can anyone help me? This is a very high level for me.
Thanks for any help.