Bonjour j'ai créé un formulaire dans ce formulaire il y a un bouton pour calculer la tva, le calcul de la tva se fait de la facon suivante

Etant donné que c'est pour la belgique

si le client est belge alors il faut calculer la tva,

si le client est un francais , si il a un n° de tva intracommunautaire il ne paie pas la tva et si il n'as pas de numero de tva il paie la tva

donc voici mon code javascript

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
// JavaScript Document
function calcultva()
{
 var paysclient=(document.FormCdeCartesLuxe.EditFactPays.value);
 var tvaclient=(document.FormCdeCartesLuxe.EditFactTva.value);
 if (paysclient=="Belgique")
   {
    var prixhtva=parseFloat(document.FormCdeCartesLuxe.EditPrixHTVA.value);
    var tva=(prixhtva*21)/100;
    var prixtvac=prixhtva+tva
    document.FormCdeCartesLuxe.EditPrixTVA.value=tva;
    document.FormCdeCartesLuxe.EditPrixTVAC.value=prixtvac;
   }
 else
 if (paysclient=="France")
   {
     if (tvaclient=="")
	 {
	   var prixhtva=parseFloat(document.FormCdeCartesLuxe.EditPrixHTVA.value);
       var tva=(prixhtva*21)/100;
       var prixtvac=prixhtva+tva
       document.FormCdeCartesLuxe.EditPrixTVA.value=tva;
       document.FormCdeCartesLuxe.EditPrixTVAC.value=prixtvac;
	 }
	 else
	 {
	 var prixhtva=parseFloat(document.FormCdeCartesLuxe.EditPrixHTVA.value);
     var tva=0;
	 var prixtvac=prixhtva;
	 document.FormCdeCartesLuxe.EditPrixTVA.value=tva;
     document.FormCdeCartesLuxe.EditPrixTVAC.value=prixtvac;
	 }
   }
}
je vous donne aussi le code du formulaire

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
 
<?php
$host="localhost"; // localhost pour le local
$user="root";//nom d'utilisateur
$pass="";//mot de pass
$base="printopubbase";//nom de la bases de données
$connect=mysql_connect($host,$user,$pass);
mysql_select_db($base, $connect);
 
$sql="SELECT * FROM clients WHERE email='".$_POST['EditDonnees']."'";
$resultat = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
if(!mysql_num_rows($resultat)) {
   ?>
   <script>
   alert ("Cet email est inconnu de notre base de données, veuillez verifier votre email !");
   window.history.back();
   </script>
   <?php
} 
else 
{
 
 
 
 while ($data = mysql_fetch_array($resultat)) {
 
?>
<form name="FormCdeCartesLuxe" action="envoi_commande_cartes_luxe_rech_donnees.php" method="post">
<table width="525" border="1" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;">
  <tr>
    <td colspan="2" ><strong>Adresse de facturation</strong></td>
 
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
 
  </tr>
  <tr>
    <td>Email :</td>
    <td><input name="EditFactEmail" type="text" value="<?php echo $data['email'] ?>" /></td>
  </tr>
  <tr>
    <td>Nom :</td>
    <td><input name="EditFactNom" type="text" value="<?php echo $data['nom'] ?>" /></td>
  </tr>
  <tr>
    <td>Prénom :</td>
    <td><input name="EditFactPrenom" type="text" value="<?php echo $data['prenom'] ?>" /></td>
  </tr>
  <tr>
    <td>Société :</td>
    <td><input name="EditFactSociete" type="text" value="<?php echo $data['societe'] ?>" /></td>
  </tr>
  <tr>
    <td>N° TVA :</td>
    <td><input name="EditFactTva" type="text" value="<?php echo $data['tva'] ?>" /></td>
  </tr>
  <tr>
    <td>Adresse :</td>
    <td><input name="EditFactAdresse" type="text" value="<?php echo $data['adressefacturation'] ?>" /></td>
  </tr>
  <tr>
    <td>Code postal :</td>
    <td><input name="EditFactCp" type="text" value="<?php echo $data['codepostalfacturation'] ?>" /></td>
  </tr>
  <tr>
    <td>Localité :</td>
    <td><input name="EditFactLocalite" type="text" value="<?php echo $data['localitefacturation'] ?>" /></td>
  </tr>
  <tr>
    <td>Pays :</td>
    <td><input name="EditFactPays" type="text" value="<?php echo $data['paysfacturation'] ?>" /></td>
  </tr>
 <tr>
    <td>Téléphone :</td>
    <td><input name="EditFactTelephone" type="text" value="<?php echo $data['telephone'] ?>" /></td>
  </tr>
  <tr>
    <td>Gsm :</td>
    <td><input name="EditFactGsm" type="text" value="<?php echo $data['gsm'] ?>" /></td>
  </tr>
  <tr>
    <td>Fax :</td>
    <td><input name="EditFactFax" type="text" value="<?php echo $data['fax'] ?>" /></td>
  </tr>
</table>
 
 
<br />
<table width="525" border="1" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;">
<tr>
<td><strong>Récapitulatif de votre commande</strong></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>1000 cartes de visite LUXE impression laquée, 2 faces quadri, papier 350gr demi-couché mat.</td>
</tr>
</table>
<br />
<table width="525" border="1" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;">
<tr>
<td colspan="3"><strong>Calcul du prix de votre commande</strong></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td width="175">Prix HTVA</td>
<td width="175">TVA</td>
<td width="175">Prix TVAC</td>
</tr>
 
<tr>
 
<td><input name="EditPrixHTVA" type="text" value="59" style="width:60px; text-align:right; " readonly="readonly" onclick="javascript:alert('Le prix est fixe, il vous est impossible de le changer !');"/>&nbsp;euros</td>
<td><input name="EditPrixTVA" type="text" value="0" style="width:60px; text-align:right; " readonly="readonly" onclick="javascript:alert('Le prix est fixe, il vous est impossible de le changer !');"/>&nbsp;euros</td>
<td><input name="EditPrixTVAC" type="text" value="0" style="width:60px; text-align:right; " readonly="readonly" onclick="javascript:alert('Le prix est fixe, il vous est impossible de le changer !');"/>&nbsp;euros</td>
</tr>
<tr>
<td colspan="3"><input name="bouton_calculer" type="button" value="Calculer" class="style_bouttons"  onclick="calcultva()"/></td>
</tr>
</table>
<br />
 <table width="525" border="1" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;">
  <tr>
    <td colspan="2" ><strong>Adresse de livraison</strong></td>
 
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
 
  </tr>
 
  <tr>
    <td>Nom :</td>
    <td><input name="EditLivNom" type="text" value="<?php echo $data['nom'] ?>" /></td>
  </tr>
  <tr>
    <td>Prénom :</td>
    <td><input name="EditLivPrenom" type="text" value="<?php echo $data['prenom'] ?>" /></td>
  </tr>
  <tr>
    <td>Société :</td>
    <td><input name="EditLivSociete" type="text" value="<?php echo $data['societe'] ?>" /></td>
  </tr>
 
 
 
 
 
 <tr>
    <td>Téléphone :</td>
    <td><input name="EditLivTelephone" type="text" value="<?php echo $data['telephone'] ?>" /></td>
  </tr>
 
  <tr>
    <td>Adresse :</td>
    <td><input name="EditLivAdresse" type="text" value="<?php echo $data['adresselivraison'] ?>" /></td>
  </tr>
  <tr>
    <td>Code postal :</td>
    <td><input name="EditLivCp" type="text" value="<?php echo $data['codepostallivraison'] ?>" /></td>
  </tr>
  <tr>
    <td>Loalité :</td>
    <td><input name="EditLivLocalite" type="text" value="<?php echo $data['localitelivraison'] ?>" /></td>
  </tr>
  <tr>
    <td>Pays :</td>
    <td><input name="EditLivPays" type="text" value="<?php echo $data['payslivraison'] ?>" /></td>
  </tr>
 
</table>
<br />
<table width="525" border="1" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;">
<tr>
<td><strong>Valider votre commande</strong></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><input name="BtnValider" type="submit" value="Valider la commande"/>&nbsp;<input name="BtnAnnuler" type="button" value="Annuler" onclick="location.href='cartes_luxe.php'"/></td>
</tr>
</table>
<?php
 
}
 
}
?>
</form>
alors le résultat est le suivant

si le client est belge cela marche il calcule bien la tva

si le client est francais ca marche pas il ne calcule pas la tva que ce soit si le client a un n° ou n'as pas un n°

je pense qu'il doit y avoir une erreur dans la page javascript mais je ne trouve pas l'erreur

merci pour votre aide