Skip to main content
Participant
June 5, 2023
Question

Formulaires PDF : calculs

  • June 5, 2023
  • 1 reply
  • 302 views

Bonjour, 

J'ai crée un formulaire PDF avec des calculs avec un champ quantité et un autre prix TTC 

Quand je réalise le calcul quantité x prix TTC mon résultat affiche plus de 2 décimales après la virgule malgré le fait que j'ai rempli 2 décimales après la virgule en format monétaire.

Comment faire pour résoudre ce problème ? Merci 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 5, 2023

You will need to use a script to perform the calculation, and to round the result to 2 decimals.

For example, if the fields are called Qty1 and Price1, use the following script:

var qty = Number(this.getField("Qty1").valueAsString);
var price = Number(this.getField("Price1").valueAsString);
event.value = (qty*price).toFixed(2);