Hello @jpbenfica,
I’ve evaluated your equations manually and the result is correct:
PREC(fieldname2*(fieldname7+fieldname8)+(fieldname9+fieldname16),2) =
PREC(1*(2.2+1.5)+(0.34+0),2) =
PREC(3.7+0.34,2) =
PREC(4.4,2) = 4.40
If you are referring to the fieldname9 field:
PREC((fieldname8*23.00*fieldname2)/100,2) =
PREC((1.5*23.00*1)/100,2) =
PREC(0.345,2) = 0.34
You can evaluate it directly with the javascript method “toFixed” but the result is the same:
(0.345).toFixed(2) = 0.34
Best regards.
PREC(0.345,2) = 0.34
I need round 0.345 to 0.35
Hello @jpbenfica,
In this case, instead to use the “PREC” function, I recommend you to use the following mathematical operation:
ROUND(0.345*100)/100
Best regards.
For 1 item is ok. But for 2 items, same problem.
If enter in this page
2
20
20
0
Calculate
the Round is 8.09 when it was supposed to be 8.10
Hello,
I’ve checked your form again, but you have not edited the equations. Please, replace all calls to the PREC function with the mathematical operation I sent you in the previous entry.
Best regards.
this
PREC(((fieldname8*23.00*fieldname2)/100),2)
to
this
ROUND(((fieldname8*23.00*fieldname2)/100),2)
In this case, instead to use the “PREC” function, I recommend you to use the following mathematical operation:
ROUND(0.345*100)/100
But the fieldname8 is this
(function(){
if(fieldname4 <= 0) return '0.00';
if(fieldname4 <= 100) return '1.50';
if(fieldname4 <= 500) return '2.60';
if(fieldname4 <= 1000) return '4.85';
if(fieldname4 <= 2500) return '11.00';
})();
Hello,
Not really, this operation:
PREC(((fieldname8*23.00*fieldname2)/100),2)
should transformed as:
ROUND((fieldname8*23.00*fieldname2/100)*100)/100
Best regards.
With
1 ok, 2 or 3 or 4 ERROR in Round
20
20
0
Hello,
I don’t know what form are you editing but you don’t have modified the equations in the form inserted on the webpage:
https://www.mundoemalerta.com/simulador-de-custos-para-envios-cobranca-ctt
Best regards.
Hello i have the same probleme
with this page https://www.a3com.fr/simulationtarifaire/?TempOp=90&NbApp=300&TVA=20
*
when i excute my link in Internet Explorer it word corectly
but when i use Google Chrome i have a different result
I used Prec function and i flow your solution about mathematic function( Round(x*100)/100 and still wrong result
I use this
ROUND(fieldnameX*23.00)/100;
The field Tax in my site
(function(){
if(fieldname23 > 0) return ROUND(fieldname23*23.00)/100;
if(fieldname25 > 0) return ROUND(fieldname25*23.00)/100;
})();
Hello @jpbenfica,
Thank you very much for sharing your solution, and yes, it is perfect.
Best regards.