|
Netto, Brutto oder Mehrwertsteuer berechnen
Es ist mindestens eine Angabe in einer der Eingabefelder notwendig. Sourcecode:
<script type="text/javascript">
function nMWSt()
{
var StSatz, Net1, Mwst, Brut1, Net2, MwstS, Brut2;
Net1=0;
Mwst=0;
Brut1=0;
StSatz=19;
if (document.nForm.StSatz[0].checked==true) StSatz=7;
if (document.nForm.StSatz[1].checked==true) StSatz=16;
if (document.nForm.StSatz[2].checked==true) StSatz=19;
if (document.nForm.Net1.value!="") {
Net2=String(document.nForm.Net1.value);
Net2=Net2.replace(",",".");
Net1=parseFloat(Net2);
}
if (document.nForm.Mwst.value!="") {
MwstS=String(document.nForm.Mwst.value);
MwstS=MwstS.replace(",",".");
Mwst=parseFloat(MwstS);
}
if (document.nForm.Brut1.value!="") {
Brut2=String(document.nForm.Brut1.value);
Brut2=Brut2.replace(",",".");
Brut1=parseFloat(Brut2);
}
if (Net1>0) {
Brut1=Net1*(100+StSatz)/100;
Mwst=Brut1-Net1;
} else {
if (Mwst>0) {
Brut1=(100+StSatz)*Mwst/StSatz;
Net1=Brut1-Mwst;
} else {
if (Brut1>0) {
Net1=Brut1*100/(100+StSatz);
Mwst=Brut1-Net1;
}
}
}
document.nForm.Net1.value=Net1.toFixed(2);
document.nForm.Mwst.value=Mwst.toFixed(2);
document.nForm.Brut1.value=Brut1.toFixed(2);
}
</script>
</head>
<body>
<form name="nForm">
<table align="center" cellspacing="2" border="0">
<tr>
<th>Netto €</th>
<th></th>
<th>MwSt. €</th>
<th></th>
<th>Brutto €</th>
</tr>
<tr height="50">
<th width="70">
<input class="txtNumb" name="Net1" type="text" size="9" maxlength="8"
value="" onClick="document.nForm.Net1.value=''; document.nForm.Mwst.value='';
document.nForm.Brut1.value='';">
</th>
<th width="70">+</th>
<th width="70">
<input class="txtNumb" name="Mwst" type="text" size="9" maxlength="8"
value="" onClick="document.nForm.Net1.value=''; document.nForm.Mwst.value='';
document.nForm.Brut1.value='';">
</th>
<th width="70">=</th>
<th>
<input class="txtNumb" name="Brut1" type="text" size="9" maxlength="8"
value="" onClick="document.nForm.Net1.value=''; document.nForm.Mwst.value='';
document.nForm.Brut1.value='';">
</th>
</tr>
<tr height="50">
<th colspan="5" nowrap>
<input type="radio" name="StSatz" value="7">7%
<input type="radio" name="StSatz" value="16">16%
<input type="radio" name="StSatz" value="19" checked>19%</th>
</tr>
<tr height="50">
<th colspan="5">
<input type="button" value="Berechnen" onClick="nMWSt()">
</th>
</tr>
</table>
</form>
|