Pb total formulaire
pierre_gomes
Messages postés
9
Date d'inscription
Statut
Membre
Dernière intervention
-
pierre_gomes Messages postés 9 Date d'inscription Statut Membre Dernière intervention -
pierre_gomes Messages postés 9 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Je souhaiterais faire le total de plusieurs champs de formulaire mais ce dernier ne se calcule pas ; j'ai pourtant bien regarder mais je ne trouve pas ; merci
voici le code :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- saved from url=(0078)file:///C:/Users/PIERRE/Documents/PHP/DECLARATION_DUCS/calcul_cotisations.html -->
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<title>calcul_cotisations</title>
</head>
<body>
<form method="post" name="calcul_cotisations">
<table style="text-align: left; width: 1150px; height: 110px;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="width: 281px; font-family: Arial; font-weight: bold; text-align: center; background-color: rgb(226, 189, 255);"><small>Code
et catégories de salariés</small></td>
<td
style="width: 228px; font-family: Arial; font-weight: bold; text-align: center; background-color: rgb(226, 189, 255);"><small>Salaires<br>
arrondis</small></td>
<td
style="width: 134px; font-family: Arial; font-weight: bold; text-align: center; background-color: rgb(226, 189, 255);"><small>Taux
en %</small></td>
<td
style="width: 302px; font-family: Arial; font-weight: bold; text-align: center; background-color: rgb(226, 189, 255);"><small>Cotisations
arrondies </small></td>
</tr>
<tr>
<td style="width: 281px; font-family: Arial;"><small>100
A RG cas général - accident du travail</small></td>
<td
style="text-align: center; width: 228px; font-family: Arial;"><small><input
id="base_at" onchange="somme();" value="0"
type="text"></small></td>
<td
style="width: 134px; font-family: Arial; text-align: center;"><small><input
id="at" onchange="somme();" value="2" type="text"></small></td>
<td
style="text-align: center; width: 302px; font-family: Arial;"><small><span><input
id="resultat" value="0" type="text"></span></small></td>
</tr>
<tr>
<td style="width: 281px;">100 D RG cas
général - base déplafonnée</td>
<td style="text-align: center;"><input
id="base_cg" onchange="somme();" value="0"
type="text"></td>
<td style="width: 134px; text-align: center;"><input
id="cg" onchange="somme();" value="21" type="text"></td>
<td style="text-align: center; width: 302px;"><input
id="resultat_cg" value="0" type="text"></td>
</tr>
<tr>
<td style="font-family: Arial;"><small>100 A
RG cas général - base plafonnée</small></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
</tr>
<tr>
<td style="font-family: Arial;"><small>236 D
FNAL sur totalité des salaires</small></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
</tr>
<tr>
<td style="font-family: Arial;"><small>260 D
CSG - CRDS Régime général</small></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
</tr>
<tr>
<td style="font-family: Arial;"><small>671 P
Réduction Fillon - base plafonnée</small></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
</tr>
</tbody>
</table>
<br>
<table style="text-align: left; width: 1153px; height: 118px;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="font-family: Arial; width: 325px;"><small>Salaires
versés le </small></td>
<td style="font-family: Arial; width: 187px;"><small><input
name="date_versement"></small></td>
<td style="font-family: Arial; width: 68px;"></td>
<td
style="background-color: rgb(226, 189, 255); font-family: Arial; width: 177px;"><small>Total
des cotisations</small></td>
<td
style="font-family: Arial; width: 358px; text-align: center; background-color: rgb(226, 189, 255);"><input
id="total_cotisations" value="0" type="text"></td>
</tr>
<tr>
<td style="font-family: Arial; width: 325px;"><small>Effectif
au dernier jour de la période</small></td>
<td style="font-family: Arial; width: 187px;"><small><input
name="effectif_fin_periode"></small></td>
<td style="font-family: Arial; width: 68px;"></td>
<td
style="background-color: rgb(226, 189, 255); font-family: Arial; width: 177px;"><small>Déduction</small></td>
<td
style="font-family: Arial; width: 358px; text-align: center; background-color: rgb(226, 189, 255);"><small><input
name="deduction"></small></td>
</tr>
<tr>
<td style="font-family: Arial; width: 325px;"><small>Effectif
remunéré pour la période</small></td>
<td style="font-family: Arial; width: 187px;"><small><input
name="effectif_remunere_fin"></small></td>
<td style="font-family: Arial; width: 68px;"></td>
<td
style="background-color: rgb(226, 189, 255); font-family: Arial; width: 177px;"><small>Montant
à payer</small></td>
<td
style="font-family: Arial; width: 358px; text-align: center; background-color: rgb(226, 189, 255);"><small><input
name="montant_a_payer"></small></td>
</tr>
<tr>
<td style="font-family: Arial; width: 325px;"></td>
<td style="font-family: Arial; width: 187px;"></td>
<td style="font-family: Arial; width: 68px;"></td>
<td style="font-family: Arial; width: 177px;"></td>
<td style="font-family: Arial; width: 358px;"></td>
</tr>
</tbody>
</table>
<br>
<table style="text-align: left; width: 1153px; height: 60px;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="width: 328px; font-family: Arial; text-align: center; background-color: rgb(226, 189, 255);"><small>Libellé
du compte bancaire</small></td>
<td colspan="4" rowspan="1"
style="width: 200px; font-family: Arial; text-align: center; background-color: rgb(226, 189, 255);"><small>RIB</small></td>
<td
style="width: 398px; font-family: Arial; text-align: center; background-color: rgb(226, 189, 255);"><small>Montant</small></td>
</tr>
<tr>
<td
style="width: 328px; font-family: Arial; text-align: center;"></td>
<td
style="width: 66px; font-family: Arial; text-align: center;"></td>
<td
style="width: 68px; font-family: Arial; text-align: center;"></td>
<td
style="width: 124px; font-family: Arial; text-align: center;"></td>
<td
style="width: 200px; font-family: Arial; text-align: center;"></td>
<td
style="width: 398px; font-family: Arial; text-align: center;"></td>
</tr>
</tbody>
</table>
<br ="">
<script type="text/javascript">
function testInt(value) {
return value == parseInt(value);
}
function somme() {
var total = document.getElementById('total_cotisations');
var result = document.getElementById('resultat');
var resultat = document.getElementById('resultat_cg');
var value1 = document.getElementById('base_at').value;
var value2 = (document.getElementById('at').value);
var value3 = document.getElementById('base_cg').value;
var value4 = document.getElementById('cg').value;
if (testInt(value1) && testInt(value2)) {
result.value = parseInt(value1) * parseInt(value2)/100;
} else {
alert('Les valeurs introduites ne sont pas des nombres');
}
if (testInt(value3) && testInt(value4)) {
resultat.value = parseInt(value3) * parseInt(value4)/100;
} else {
alert('Les valeurs introduites ne sont pas des nombres');
}
if (testInt(result) && testInt(resultat)) {
total.value = parseInt(result)*1 + parseInt(resultat)*1;
} else {
alert('Les valeurs introduites ne sont pas des nombres');
}
}
</script></form>
</body>
</html>
Je souhaiterais faire le total de plusieurs champs de formulaire mais ce dernier ne se calcule pas ; j'ai pourtant bien regarder mais je ne trouve pas ; merci
voici le code :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- saved from url=(0078)file:///C:/Users/PIERRE/Documents/PHP/DECLARATION_DUCS/calcul_cotisations.html -->
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<title>calcul_cotisations</title>
</head>
<body>
<form method="post" name="calcul_cotisations">
<table style="text-align: left; width: 1150px; height: 110px;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="width: 281px; font-family: Arial; font-weight: bold; text-align: center; background-color: rgb(226, 189, 255);"><small>Code
et catégories de salariés</small></td>
<td
style="width: 228px; font-family: Arial; font-weight: bold; text-align: center; background-color: rgb(226, 189, 255);"><small>Salaires<br>
arrondis</small></td>
<td
style="width: 134px; font-family: Arial; font-weight: bold; text-align: center; background-color: rgb(226, 189, 255);"><small>Taux
en %</small></td>
<td
style="width: 302px; font-family: Arial; font-weight: bold; text-align: center; background-color: rgb(226, 189, 255);"><small>Cotisations
arrondies </small></td>
</tr>
<tr>
<td style="width: 281px; font-family: Arial;"><small>100
A RG cas général - accident du travail</small></td>
<td
style="text-align: center; width: 228px; font-family: Arial;"><small><input
id="base_at" onchange="somme();" value="0"
type="text"></small></td>
<td
style="width: 134px; font-family: Arial; text-align: center;"><small><input
id="at" onchange="somme();" value="2" type="text"></small></td>
<td
style="text-align: center; width: 302px; font-family: Arial;"><small><span><input
id="resultat" value="0" type="text"></span></small></td>
</tr>
<tr>
<td style="width: 281px;">100 D RG cas
général - base déplafonnée</td>
<td style="text-align: center;"><input
id="base_cg" onchange="somme();" value="0"
type="text"></td>
<td style="width: 134px; text-align: center;"><input
id="cg" onchange="somme();" value="21" type="text"></td>
<td style="text-align: center; width: 302px;"><input
id="resultat_cg" value="0" type="text"></td>
</tr>
<tr>
<td style="font-family: Arial;"><small>100 A
RG cas général - base plafonnée</small></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
</tr>
<tr>
<td style="font-family: Arial;"><small>236 D
FNAL sur totalité des salaires</small></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
</tr>
<tr>
<td style="font-family: Arial;"><small>260 D
CSG - CRDS Régime général</small></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
</tr>
<tr>
<td style="font-family: Arial;"><small>671 P
Réduction Fillon - base plafonnée</small></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
<td style="font-family: Arial;"></td>
</tr>
</tbody>
</table>
<br>
<table style="text-align: left; width: 1153px; height: 118px;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="font-family: Arial; width: 325px;"><small>Salaires
versés le </small></td>
<td style="font-family: Arial; width: 187px;"><small><input
name="date_versement"></small></td>
<td style="font-family: Arial; width: 68px;"></td>
<td
style="background-color: rgb(226, 189, 255); font-family: Arial; width: 177px;"><small>Total
des cotisations</small></td>
<td
style="font-family: Arial; width: 358px; text-align: center; background-color: rgb(226, 189, 255);"><input
id="total_cotisations" value="0" type="text"></td>
</tr>
<tr>
<td style="font-family: Arial; width: 325px;"><small>Effectif
au dernier jour de la période</small></td>
<td style="font-family: Arial; width: 187px;"><small><input
name="effectif_fin_periode"></small></td>
<td style="font-family: Arial; width: 68px;"></td>
<td
style="background-color: rgb(226, 189, 255); font-family: Arial; width: 177px;"><small>Déduction</small></td>
<td
style="font-family: Arial; width: 358px; text-align: center; background-color: rgb(226, 189, 255);"><small><input
name="deduction"></small></td>
</tr>
<tr>
<td style="font-family: Arial; width: 325px;"><small>Effectif
remunéré pour la période</small></td>
<td style="font-family: Arial; width: 187px;"><small><input
name="effectif_remunere_fin"></small></td>
<td style="font-family: Arial; width: 68px;"></td>
<td
style="background-color: rgb(226, 189, 255); font-family: Arial; width: 177px;"><small>Montant
à payer</small></td>
<td
style="font-family: Arial; width: 358px; text-align: center; background-color: rgb(226, 189, 255);"><small><input
name="montant_a_payer"></small></td>
</tr>
<tr>
<td style="font-family: Arial; width: 325px;"></td>
<td style="font-family: Arial; width: 187px;"></td>
<td style="font-family: Arial; width: 68px;"></td>
<td style="font-family: Arial; width: 177px;"></td>
<td style="font-family: Arial; width: 358px;"></td>
</tr>
</tbody>
</table>
<br>
<table style="text-align: left; width: 1153px; height: 60px;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="width: 328px; font-family: Arial; text-align: center; background-color: rgb(226, 189, 255);"><small>Libellé
du compte bancaire</small></td>
<td colspan="4" rowspan="1"
style="width: 200px; font-family: Arial; text-align: center; background-color: rgb(226, 189, 255);"><small>RIB</small></td>
<td
style="width: 398px; font-family: Arial; text-align: center; background-color: rgb(226, 189, 255);"><small>Montant</small></td>
</tr>
<tr>
<td
style="width: 328px; font-family: Arial; text-align: center;"></td>
<td
style="width: 66px; font-family: Arial; text-align: center;"></td>
<td
style="width: 68px; font-family: Arial; text-align: center;"></td>
<td
style="width: 124px; font-family: Arial; text-align: center;"></td>
<td
style="width: 200px; font-family: Arial; text-align: center;"></td>
<td
style="width: 398px; font-family: Arial; text-align: center;"></td>
</tr>
</tbody>
</table>
<br ="">
<script type="text/javascript">
function testInt(value) {
return value == parseInt(value);
}
function somme() {
var total = document.getElementById('total_cotisations');
var result = document.getElementById('resultat');
var resultat = document.getElementById('resultat_cg');
var value1 = document.getElementById('base_at').value;
var value2 = (document.getElementById('at').value);
var value3 = document.getElementById('base_cg').value;
var value4 = document.getElementById('cg').value;
if (testInt(value1) && testInt(value2)) {
result.value = parseInt(value1) * parseInt(value2)/100;
} else {
alert('Les valeurs introduites ne sont pas des nombres');
}
if (testInt(value3) && testInt(value4)) {
resultat.value = parseInt(value3) * parseInt(value4)/100;
} else {
alert('Les valeurs introduites ne sont pas des nombres');
}
if (testInt(result) && testInt(resultat)) {
total.value = parseInt(result)*1 + parseInt(resultat)*1;
} else {
alert('Les valeurs introduites ne sont pas des nombres');
}
}
</script></form>
</body>
</html>
A voir également:
- Pb total formulaire
- Whatsapp formulaire opposition - Guide
- Formulaire de réclamation facebook - Guide
- Total uninstall - Télécharger - Divers Utilitaires
- Formule total excel - Guide
- Total video converter - Télécharger - Conversion & Codecs