forked from gnibeil/simplekolecalc
38 lines
1.7 KiB
HTML
38 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<style>
|
||
input[type='number']{text-align:right;}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<p>Bei Eingaben werden Komma und Punkt als Dezimaltrennzeichen betrachtet.</p>
|
||
<table>
|
||
<tr><td>Berechne:</td><td><input type="radio" name="b" value="k" id="bk" class="bb" checked="checked" /><label for="bk">KoLe</label><input type="radio" name="b" value="e" id="be" class="bb" /><label for="be">Einnahmen</label></td></tr>
|
||
<tr><td>Einnahme</td><td><input type="number" step="0.01" id="e" value="1"/> €</td></tr>
|
||
<tr><td>Umsatzsteuer</td><td><input type="number" step="0.01" id="u" value="19"/> %</td></tr>
|
||
<tr><td>Entropieumlage</td><td><input type="number" step="0.01" id="z" value="23"/> %</td></tr>
|
||
<tr><td>KoLe</td><td><input type="number" step="0.01" id="k" value=""/> €</td></tr>
|
||
<tr><td> </td><td><input value="Berechnen" id="b" type="button"/></td></tr>
|
||
</table>
|
||
<script>
|
||
var e=document.getElementById('e');
|
||
var u=document.getElementById('u');
|
||
var z=document.getElementById('z');
|
||
var k=document.getElementById('k');
|
||
var bk=document.getElementById('bk');
|
||
var be=document.getElementById('be');
|
||
var b = document.getElementById("b");
|
||
|
||
b.addEventListener("click", function(){
|
||
if(bk.checked){
|
||
k.value = Math.round( parseFloat(e.value.replace(/,/g, '.')) / ( 1 + parseFloat(u.value.replace(/,/g, '.')) / 100 ) * ( 1 - parseFloat(z.value.replace(/,/g, '.')) / 100 ) * 100 ) / 100;
|
||
}else// if(be.checked)
|
||
{
|
||
e.value = Math.round( parseFloat(k.value.replace(/,/g, '.')) * ( 1 + parseFloat(u.value.replace(/,/g, '.')) / 100 ) / ( 1 - parseFloat(z.value.replace(/,/g, '.')) / 100 ) * 100 ) / 100;
|
||
}
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|