#!/bin/sh
# mwst.sh
#
# Benutzung z.B.: ./mwst.sh 10.23
if [ -z $1 ]
then
echo 'Bitte geben Sie z.B. "./mwst.sh 10.23" ein.'
exit 1
fi
echo -e "\nNetto:\t\t\t\t$1 EUR"
echo -e "Mehrwertsteuer (19%):\t\t$(echo "scale=2; $1 * 0.19" | bc) EUR"
echo -e "Brutto:\t\t\t\t$(echo "scale=2; $1 * 1.19" | bc) EUR"
echo
echo -e "\nBrutto:\t\t\t\t$1 EUR"
echo -e "Mehrwertsteuer (19%):\t\t$(echo "scale=2; $1 * 19 / 119" | bc) EUR"
echo -e "Netto:\t\t\t\t$(echo "scale=2; $1 / 1.19" | bc) EUR\n"
#!/usr/bin/python
# -*- coding: latin2 -*-
import Tkinter
from Tkconstants import *
# mwst.py, by abgdf@gmx.net, 2007, Licence: LGPL
# Use at your own risk !
MWSTS = 19
LINELENGTH = 30
class TkApp:
    def __init__(self):
        self.mw = Tkinter.Tk()
        self.mw.title("Mehrwertsteuer")
        self.mw.geometry("+300+230")
        self.mw.option_add("*font", "{suse sans} 15 {normal}")
        self.tf= Tkinter.Text(self.mw, width = 40, height = 10, background = 'white', foreground = 'black', font = "{courier new} 15 {normal}")
        self.fr1 = Tkinter.Frame(self.mw)
        self.l1 = Tkinter.Label(self.fr1, text = "Betrag:")
        self.e1 = Tkinter.Entry(self.fr1, background = 'white')
        self.e1.focus()
        self.e1.bind('<Return>', self.calcdummy)
        self.l1.pack(side = LEFT, padx = 5)
        self.e1.pack()
        self.fr1.pack(pady = 10)
        self.tf.pack(fill = BOTH) 
        self.btn_exit = Tkinter.Button(self.mw, text = "Exit", command = self.mw.destroy)
        self.btn_exit.pack(side = RIGHT, anchor = "e", padx = 20, pady = 15)
        self.mw.mainloop()
    def calcdummy(self, a):
        self.calculate(self.e1.get())
    def calculate(self, a):
        a = a.replace(',','.')
        try:
            a = float(a)
        except:
            return
        a = round(a, 2)
        b = texts(float(a))
        self.tf.delete("1.0", END)
        self.tf.insert("1.0", "\n")
        for i in range(len(b)):
            self.tf.insert(END, b[i])
def z (a):
    d="%.2f" % a
    d=d.replace('.',',')
    return(d)
def calculateMwSt(a, mwsts = MWSTS):
    b = [a]
    b.append(round((a * mwsts / 100.), 2))
    b.append(round((a * (100. + mwsts) / 100.), 2))
    b.append(a)
    b.append(round((a * mwsts / (100. + mwsts)), 2))
    b.append(round(a * 100 / (100. + mwsts) ,2))
    return(b)
def texts(v):
    a = calculateMwSt(v, MWSTS)
    b = ["Netto:",
         "Mehrwertsteuer ("+ str(MWSTS)+"%)",
         "Brutto:",
         "Brutto:",
         "Mehrwertsteuer ("+ str(MWSTS)+"%)",
         "Netto:"]
         
    for i in range(len(b)):
        l = LINELENGTH - len(b[i]) - len(z(a[i]))
        for u in range(l + 1):
            b[i] += " "
        b[i] += z(a[i])
        b[i] += " EUR\n"
    b.insert(3,"\n")
    return b
tk = TkApp()
Ich glaube ich habe das Problem verstanden. Zufällig weiß ich z.B., dass Feuerholz mit 19% zu versteuern ist, außer man hat eine Ausnahmegenehmigung (das Papier heißt sicher anders) um z.B. Holz aus Sturmschäden billiger verkaufen zu können.konsole schrieb:Es gibt neben dem 19 %igen Umsatzsteuersatz einen ermäßigten von 7 %. Es gibt für bestimmte Umsätze auch diverse Durchschnittssteuersätze.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::ROText;
# mwst.pl, by abgdf@gmx.net, 2007, Licence: LGPL
# Use at your own risk !
my $MWSTS = 19;
my $LINELENGTH = 30;
my $mw = MainWindow -> new();
$mw -> title("Mehrwertsteuer");
$mw -> geometry("+300+230");
$mw -> optionAdd("*font", "{suse sans} 15 {normal}");
my $tf = $mw -> ROText (-background => 'white',
                        -foreground => 'black',
                        -width      => 40,
                        -height     => 10,
                        -font       => "{courier new} 15 {normal}");
my $fr1 = $mw -> Frame();
my $l1 = $fr1 -> Label(-text => "Betrag:");
my $e1 = $fr1 -> Entry(-background => 'white');
$e1 -> focus();
$e1 -> bind('<Return>', sub { &calculate($e1 -> get()) });
$l1 -> pack(-side => "left", -padx => 5);
$e1 -> pack();
$fr1 -> pack(-pady => 10);
$tf -> pack(-fill => "both");
my $btn_exit = $mw -> Button(-text => "Exit", -command => sub { $mw -> destroy() });
$btn_exit -> pack(-side => "right", -anchor => "e", -padx => 20, -pady => 15);
MainLoop();
sub calculate
{
    # Wenn nichts oder keine Zahl eingegeben:
    if ($#_ < 0 || $_[0] =~ m/[^0-9,\.]/)
    {
        return;
    }
    my $a = $_[0];
    $a =~ s/,/\./;
    $a = sprintf("%.2f", $a);
    my @b = &texts($a);
    $tf -> delete("1.0", "end");
    $tf -> insert("1.0", "\n");
    my $i;
    for($i = 0;$i <= $#b; $i++)
    {
        if ($i == 3)
        {
            $tf -> insert("end", "\n");
        }
        $tf -> insert("end", $b[$i]);
    }
}
sub texts
{
    my @a = &calculateMwSt($_[0]);
    my @b = ("Netto:",
             "Mehrwertsteuer ($MWSTS %)",
             "Brutto:",
             "Brutto:",
             "Mehrwertsteuer ($MWSTS %)",
             "Netto:");
    my $l;
    my $i;
    for($i = 0;$i <= $#b; $i++)
    {
        $l = $LINELENGTH - length($b[$i]) - length(&z($a[$i]));
        $b[$i] .= " " x $l;
        $b[$i] .= &z($a[$i]);
        $b[$i] .= " EUR\n";
    }
    return @b
}
sub calculateMwSt
{
    my @b = ($_[0],
             $_[0] * $MWSTS / 100,
             $_[0] * (100 + $MWSTS) / 100,
             $_[0],
             $_[0] * $MWSTS / (100 + $MWSTS),
             $_[0] * 100 / (100 + $MWSTS) );
    my $i;
    foreach $i (@b)
    {
        $i = sprintf("%.2f", $i);
    }
    return @b;
}
sub z
{
    my $a = $_[0];
    $a = sprintf("%.2f", $a);
    $a =~ s/\./,/;
    return $a;
}