my $last_period = 0;
my $category = "pos_ustva";
- my @categories_cent = qw(511 861 36 80 971 931 98 96 53 74
+ my @category_cent = qw(511 861 36 80 971 931 98 96 53 74
85 65 66 61 62 67 63 64 59 69 39 83
Z43 Z45 Z53 Z62 Z65 Z67);
- my @categories_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93
+ my @category_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93
95 94 42 60 45 52 73 84);
$form->{decimalplaces} *= 1;
- foreach $item (@categories_cent) {
+ foreach $item (@category_cent) {
$form->{"$item"} = 0;
}
- foreach $item (@categories_euro) {
+ foreach $item (@category_euro) {
$form->{"$item"} = 0;
}
#
# Berechnung der USTVA Formularfelder
#
+
$form->{"51r"} = $form->{"511"};
$form->{"86r"} = $form->{"861"};
$form->{"97r"} = $form->{"971"};
$form->{"93r"} = $form->{"931"};
$form->{"Z43"} =
- $form->{"511"} + $form->{"861"} + $form->{"36"} + $form->{"80"} +
- $form->{"971"} + $form->{"931"} + $form->{"96"} + $form->{"98"};
+ $form->{"511"} + $form->{"861"} + $form->{"36"} + $form->{"80"} +
+ $form->{"971"} + $form->{"931"} + $form->{"96"} + $form->{"98"};
$form->{"Z45"} = $form->{"Z43"};
$form->{"Z53"} = $form->{"Z43"};
$form->{"Z62"} =
- $form->{"Z43"} - $form->{"66"} - $form->{"61"} - $form->{"62"} -
- $form->{"63"} - $form->{"64"} - $form->{"59"};
+ $form->{"Z43"} - $form->{"66"} - $form->{"61"} - $form->{"62"} -
+ $form->{"63"} - $form->{"64"} - $form->{"59"};
$form->{"Z65"} = $form->{"Z62"} - $form->{"69"};
$form->{"83"} = $form->{"Z65"} - $form->{"39"};
-
- foreach $item (@categories_cent) {
- $form->{$item} =
- $form->format_amount($myconfig, $form->{$item}, '2', '0');
- }
-
- foreach $item (@categories_euro) {
- $form->{$item} =
- $form->format_amount($myconfig, $form->{$item}, '0', '0');
- }
-
+ # Hier fehlen moeglicherweise noch einige Berechnungen!
+
$dbh->disconnect;
$main::lxdebug->leave_sub();
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
# Bug 365 solved?!
-# if ($ref->{amount} < 0) {
- $ref->{amount} *= -1;
-# }
+ $ref->{amount} *= -1;
if ($category eq "pos_bwa") {
if ($last_period) {
$form->{ $ref->{$category} }{kumm} += $ref->{amount};
$form->{title} = $locale->text('UStVA');
$form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 Nein=0
- my $year = substr(
- $form->datetonum($form->current_date(\%myconfig),
- \%myconfig
- ),
- 0, 4);
+ my $year = substr($form->datetonum($form->current_date(\%myconfig), \%myconfig ),
+ 0, 4);
my $department = '';
local $hide = '';
$form->header;
print qq|
-<body>
-<form method=post action=$form->{script}>
+ <body>
+ <form method=post action=$form->{script}>
-<input type=hidden name=title value="$form->{title}">
+ <input type=hidden name=title value="$form->{title}">
-<table width=100%>
+ <table width=100%>
<tr>
<th class=listtop>$form->{title}</th>
</tr>
<td>
<table>
$department
-|;
+ |;
# Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
# Einlesen der Finanzamtdaten
SWITCH: {
$yymmdd <= ($yy + 110 + $dfv) && do {
$form->{year} = $form->{year} - 1;
- $sel = 'D';
+ $sel = '44';
last SWITCH;
};
$yymmdd <= ($yy + 410 + $dfv) && do {
- $sel = 'A';
+ $sel = '41';
last SWITCH;
};
$yymmdd <= ($yy + 710 + $dfv) && do {
- $sel = 'B';
+ $sel = '42';
last SWITCH;
};
$yymmdd <= ($yy + 1010 + $dfv) && do {
- $sel = 'C';
+ $sel = '43';
last SWITCH;
};
$yymmdd <= ($yy + 1231) && do {
- $sel = 'D';
+ $sel = '44';
};
}
get_config($userspath, 'finanzamt.ini');
- # form vars initialisieren
+ # init some form vars
my @anmeldungszeitraum =
qw('0401' '0402' '0403' '0404' '0405' '0405' '0406' '0407' '0408' '0409' '0410' '0411' '0412' '0441' '0442' '0443' '0444');
foreach my $item (@anmeldungszeitraum) {
qq|Actual year from Database: $form->{year}\n|);
}
+ #
+ # using dates in ISO-8601 format: yyyymmmdd for Postgres...
+ #
+
#yearly report
if ($form->{period} eq "13") {
$form->{fromdate} = "$form->{year}0101";
};
}
- # using dates in ISO-8601 format: yyyymmmdd for Postgres...
+
+
+
+ # Get the USTVA
USTVA->ustva(\%myconfig, \%$form);
# reformat Dates to dateformat
$form->{fromdate} = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
- $form->{todate} = $form->current_date($myconfig) unless $form->{todate};
+ $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
$form->{todate} = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0);
$form->{longperiod} =
$locale->date(\%myconfig, $form->current_date(\%myconfig), 0, 0, 0);
# setup variables for the form
- # steuernummer für prerelease entfernt
my @a = qw(company businessnumber tel fax email
co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
co_name1 co_name2 co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2
$form->{co_city} =~ s/\\n//g;
}
+ #
+ # Outputformat specific customisation's
+ #
+
+ my @category_cent = qw(511 861 36 80 971 931 98 96 53 74
+ 85 65 66 61 62 67 63 64 59 69 39 83
+ Z43 Z45 Z53 Z62 Z65 Z67);
+
+ my @category_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93
+ 95 94 42 60 45 52 73 84);
+
if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript') {
$form->{IN} = "$form->{type}-$form->{year}.tex";
-
$form->{padding} = "~~";
$form->{bold} = "\textbf{";
$form->{endbold} = "}";
$form->{br} = '\\\\';
- my @numbers = qw(511 861 36 80 971 931 98 96 53 74
- 85 65 66 61 62 Z67 63 64 59 69 39 83
- Z43 Z45 Z53 Z62 Z65);
-
- my $number = '';
-
# Zahlenformatierung für Latex USTVA Formulare
- if ( $myconfig{numberformat} eq '1.000,00'
- or $myconfig{numberformat} eq '1000,00') {
- foreach $number (@numbers) {
- $form->{$number} =~ s/,/~~/g;
- }
- }
- if ( $myconfig{numberformat} eq '1000.00'
- or $myconfig{numberformat} eq '1,000.00') {
- foreach $number (@numbers) {
- $form->{$number} =~ s/\./~~/g;
- }
+
+ foreach my $number (@category_euro) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '');
}
- if ( $form->{period} eq '13'){ #Catch yearly USTE for now, not yet implemented.
- $form->header;
- USTVA::error(
- $locale->text(
- 'Impossible to create yearly Tax Report as PDF or Postscript<br \> Not yet implemented!'
- )
- );
+
+ my ${decimal_comma} = ( $myconfig{numberformat} eq '1.000,00'
+ or $myconfig{numberformat} eq '1000,00' ) ? ',':'.';
+
+ foreach my $number (@category_cent) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '');
+ $form->{$number} =~ s/${decimal_comma}/~~/g;
}
-
+
} elsif ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe
$form->{IN} = $form->{type} . '.html';
$form->{br} = "<br>";
$form->{address} =~ s/\\n/\n/g;
- } elsif ($form->{format} =~ /^elster/) {
-
- if ( $form->{period} eq '13' ) {
- $form->header;
- USTVA::info(
- $locale->text(
- 'Impossible to create yearly Tax Report via Winston or Taxbird.<br \> Not yet implemented!'
- ));
+ foreach $number (@category_cent) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
}
+
+ foreach $number (@category_euro) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
+ }
+
+ } elsif ( $form->{format} eq 'elsterwinston' ) {
+
+ $form->{IN} = 'winston.xml';
+
+ #
+ # Build Winston filename
+ #
+
+ my $file = 'U'; # 1. char 'U' = USTVA
+ $file .= $form->{period};
+ #4. and 5. char = year modulo 100
+ $file .= sprintf("%02d", $form->{year} % 100);
+ #6. to 18. char = Elstersteuernummer
+ #Beispiel: Steuernummer in Bayern
+ #111/222/33334 ergibt für UStVA Jan 2004: U01049111022233334
+ $file .= $form->{elsterFFFF};
+ $file .= $form->{elstersteuernummer};
+ #file suffix
+ $file .= '.xml';
+ $form->{tmpfile} = "$userspath/$file";
+
+ $form->{attachment_filename} = "$file";
+
+ # Zahlenformatierung für Winston
+
+ my $temp_numberformat = $myconfig{numberformat};
- if ( $form->{format} eq 'elsterwinston' ) {
-
- $form->{IN} = 'winston.xml';
-
- # Build Winston filename
- my $file = 'U'; # 1. char 'U' = USTVA
- $file .= $form->{period};
- #4. and 5. char = year modulo 100
- $file .= sprintf("%02d", $form->{year} % 100);
- #6. to 18. char = Elstersteuernummer
- #Beispiel: Steuernummer in Bayern
- #111/222/33334 ergibt für UStVA Jan 2004: U01049111022233334
- $file .= $form->{elsterFFFF};
- $file .= $form->{elstersteuernummer};
- #file suffix
- $file .= '.xml';
- $form->{tmpfile} = "$userspath/$file";
+ # Numberformat must be '1000.00' for Winston
+
+ $myconfig{numberformat} = '1000.00';
+
+ foreach my $number (@category_cent) {
+ $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
+ }
+
+ foreach my $number (@category_euro) {
+ $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
}
+ # Re-set Numberformat
+ $myconfig{numberformat} = $temp_numberformat;
- if ( $form->{format} eq 'elstertaxbird' ) {
+ }
+
+ elsif ( $form->{format} eq 'elstertaxbird' ) {
- $form->{IN} = 'taxbird.txb';
-
- $form->{tmpfile} = "$userspath/USTVA-" . $form->{period}
- . sprintf("%02d", $form->{year} % 100) . ".txb";
+ $form->{IN} = 'taxbird.txb';
- if ($form->{period} =~ /^[4]\d$/ ){
- my %periods = ( # Lx => taxbird
- '41' => '12',
- '42' => '13',
- '43' => '14',
- '44' => '15',
- );
+ $form->{attachment_filename} = "USTVA-" . $form->{period}
+ . sprintf("%02d", $form->{year} % 100) . ".txb";
+
+ $form->{tmpfile} = "$userspath/" . $form->{attachment_filename};
+
+ if ($form->{period} =~ /^[4]\d$/ ){
+ my %periods = ( # Lx => taxbird
+ '41' => '12',
+ '42' => '13',
+ '43' => '14',
+ '44' => '15',
+ );
+
+ foreach my $quarter ( keys %periods ) {
+ $form->{taxbird_period} = $periods{$quarter} if ( $form->{period} eq $quarter);
+ }
+
+ my %lands = ( # Lx => taxbird # TODO: besser als array...
+ 'Baden Würtemberg' => '0',
+ 'Bayern' => '1',
+ 'Berlin' => '2',
+ 'Brandenburg' => '3',
+ 'Bremen' => '4',
+ 'Hamburg' => '5',
+ 'Hessen' => '6',
+ 'Mecklenburg Vorpommern' => '7',
+ 'Niedersachsen' => '8',
+ 'Nordrhein Westfalen' => '9',
+ 'Rheinland Pfalz' => '10',
+ 'Saarland' => '11',
+ 'Sachsen' => '12',
+ 'Sachsen Anhalt' => '13',
+ 'Schleswig Holstein' => '14',
+ 'Thüringen' => '15',
+ );
+
+ foreach my $land ( keys %lands ){
+ $form->{taxbird_land_nr} = $lands{$land} if ($form->{elsterland} eq $land );
+ }
- foreach my $quarter ( keys %periods ) {
- $form->{period} = $periods{$quarter} if ( $form->{period} eq $quarter);
- }
-
- my %lands = ( # Lx => taxbird # TODO: besser als array...
- 'Baden Würtemberg' => '0',
- 'Bayern' => '1',
- 'Berlin' => '2',
- 'Brandenburg' => '3',
- 'Bremen' => '4',
- 'Hamburg' => '5',
- 'Hessen' => '6',
- 'Mecklenburg Vorpommern' => '7',
- 'Niedersachsen' => '8',
- 'Nordrhein Westfalen' => '9',
- 'Rheinland Pfalz' => '10',
- 'Saarland' => '11',
- 'Sachsen' => '12',
- 'Sachsen Anhalt' => '13',
- 'Schleswig Holstein' => '14',
- 'Thüringen' => '15',
- );
-
-
- foreach my $land ( keys %lands ){
- $form->{elsterland} = $lands{$land} if ($form->{elsterland} eq $land );
- }
- } elsif ($form->{period} =~ /^\d+$/ ) {
- $form->{period} =~ s/^0//g;
- my $period = $form->{period};
- $period * 1;
- $period--;
- $form->{period} = $period;
- } else {
- $form->header;
- USTVA::error( $locale->text('Wrong Period' ));
- exit(0);
-
- }
+ $form->{taxbird_steuernummer} = $form->{steuernummer};
+ $form->{taxbird_steuernummer} =~ s/\D//g;
+ $form->{co_zip} = $form->{co_city};
+ $form->{co_zip} =~ s/\D//g;
+ $form->{co_city} =~ s/\d//g;
+ $form->{co_city} =~ s/^\s//g;
+
+ ($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel});
+
+ # Numberformatting for Taxbird
+
+ my $temp_numberformat = $myconfig{numberformat};
+ # Numberformat must be '1000.00' for Taxbird ?!
+
+ $myconfig{numberformat} = '1000.00';
+
+ foreach my $number (@category_cent) {
+ $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
+ }
+
+ foreach my $number (@category_euro) {
+ $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
+ }
+ # Re-set Numberformat
+ $myconfig{numberformat} = $temp_numberformat;
+
+ } elsif ($form->{period} =~ /^\d+$/ ) {
+ $form->{period} =~ s/^0//g;
+ my $period = $form->{period};
+ $period * 1;
+ $period--;
+ $form->{period} = $period;
+ } else {
+ $form->header;
+ USTVA::error( $locale->text('Wrong Period' ));
+ exit(0);
}
- # Other Elster formats follow here...
} elsif ( $form->{format} eq '' ){ # No format error.
$form->header;
USTVA::error( $locale->text('Application Error. Wrong Format: ') . $form->{format} );
exit(0);
}
+
+ if ( $form->{period} eq '13' and $form->{format} ne 'html') {
+ $form->header;
+ USTVA::info(
+ $locale->text(
+ 'Yearly taxreport not yet implemented')
+ . '!');
+ }
-
$form->{templates} = $myconfig{templates};
$form->{templates} = "doc" if ( $form->{type} eq 'help' );
- $form->parse_template($myconfig, $userspath);
+ $form->parse_template(\%myconfig, $userspath);
$lxdebug->leave_sub();
}
--- /dev/null
+% German USTVA template for taxreports
+%
+% Contributed by Jens Koerner, Peter Schorer, Udo Spallek
+%
+%
+\documentclass[twoside]{scrartcl}
+\usepackage{a4,german}
+\usepackage[frame]{xy}
+\usepackage[latin1]{inputenc}
+\usepackage[german]{babel}
+\usepackage{graphicx}
+\usepackage{tabularx}
+\usepackage{times, german}
+\usepackage{german}
+\setlength{\voffset}{-0.8cm} %hier wird die Höhenverschiebung getätigt
+\setlength{\hoffset}{-1cm} %und hier die Verschiebung seitwärts
+\setlength{\topmargin}{0cm}
+\setlength{\headheight}{0cm}
+\setlength{\headsep}{0cm}
+\setlength{\topskip}{0pt}
+\setlength{\oddsidemargin}{0cm}
+\setlength{\evensidemargin}{0cm}
+\setlength{\textwidth}{20.9cm}
+\setlength{\textheight}{29.6cm}
+\setlength{\footskip}{-0cm}
+\setlength{\parindent}{0pt}
+
+\begin{document}
+
+\fontfamily{cmss}\fontshape{n}\large\selectfont
+\pagestyle{myheadings}
+\markboth{\protect\scalebox{1.045}[1.045]{\protect\includegraphics[viewport = 54 783 700 790]{ustva-2007-2.pdf}}}
+{\protect\scalebox{1.045}[1.045]{\protect\includegraphics[viewport = 70 700 700 790]{ustva-2007-1.pdf}}}
+\hspace{1mm}
+\begin{tabular}[b]{p{7mm}p{5cm}p{22.5mm}p{24mm}p{7mm}p{28mm}p{3mm}}
+\multicolumn{7}{c}{}\\[-2mm]
+ & \multicolumn{6}{l}{<%steuernummer%>}\\
+\multicolumn{7}{c}{}\\[15mm]
+\multicolumn{2}{p{7.5cm}}{<%FA_Name%>} & & & & &\\[-4mm]
+\multicolumn{2}{p{7.5cm}}{} & & & & &\\[3mm]
+\multicolumn{2}{p{7.5cm}}{<%FA_Strasse%>} & &<%0401%>&<%0407%>&&<%0441%>\\[1.2mm]
+\multicolumn{2}{p{7.5cm}}{} & &<%0402%>&<%0408%>&&<%0442%>\\[1.25mm]
+\multicolumn{2}{p{7.5cm}}{<%FA_PLZ%> <%FA_Ort%>} & &<%0403%>&<%0409%>&&<%0443%>\\[3mm]
+\multicolumn{2}{p{7.5cm}}{} & &<%0404%>&<%0410%>&&<%0444%>\\[1.25mm]
+\multicolumn{2}{p{7.5cm}}{} & &<%0405%>&<%0411%>&&\\[1.25mm]
+\multicolumn{2}{p{7.5cm}}{\small{<%company%>}} & &<%0406%>&<%0412%>&&\\[-1mm]
+\multicolumn{2}{p{7.5cm}}{\small{<%co_street%>}}& & & & &\\[-1mm]
+\multicolumn{2}{p{7.5cm}}{\small{<%co_city%>}}& & & &<%FA_10%> &\\[1mm]
+\multicolumn{2}{p{7.5cm}}{
+<%if tel%>
+\small{Tel: <%tel%>}~--~
+<%end tel%>
+<%if fax%>
+\small{Fax: <%fax%>}
+<%end fax%>
+}& & & & &\\[-1mm]
+\multicolumn{2}{p{7.5cm}}{\small{<%email%>}}& & & & &\\[-1mm]
+\end{tabular}\\[29.5mm]
+\begin{tabular}[b]{p{99mm}p{26.5mm}p{4.55mm}p{4mm}p{35mm}}
+&&&&\\[20.5mm]
+\multicolumn{2}{r}{<%48%>} & & \multicolumn{2}{r}{}\\[7.5mm]
+\multicolumn{2}{r}{<%51%>} & & \multicolumn{2}{r}{<%511%>}\\[1.5mm]
+\multicolumn{2}{r}{<%86%>} & & \multicolumn{2}{r}{<%861%>}\\[42mm]
+\multicolumn{2}{r}{<%97%>} & & \multicolumn{2}{r}{<%971%>}\\[1.5mm]
+\multicolumn{2}{r}{<%93%>} & & \multicolumn{2}{r}{<%931%>}\\[8.5mm]
+\multicolumn{2}{r}{<%94%>} & & \multicolumn{2}{r}{<%96%>}\\[28mm]
+\multicolumn{2}{r}{} & & \multicolumn{2}{r}{<%Z43%>}\\
+\end{tabular}
+
+\newpage
+
+\vspace*{-9.5mm}\hspace{27mm}<%steuernummer%>\\[-2.7mm]
+\begin{tabular}[b]{p{99mm}p{25.2mm}p{2.55mm}p{10mm}p{32mm}}
+&&&&\\
+\multicolumn{2}{r}{} & & \multicolumn{2}{r}{<%Z45%>}\\[48mm]
+\multicolumn{2}{r}{} & & \multicolumn{2}{r}{<%Z53%>}\\[8.9mm]
+\multicolumn{2}{r}{} & & \multicolumn{2}{r}{<%66%>}\\[42mm]
+\multicolumn{2}{r}{} & & \multicolumn{2}{r}{<%Z62%>}\\[28mm]
+\multicolumn{2}{r}{} & & \multicolumn{2}{r}{\textbf{<%83%>}}\\[26mm]
+\end{tabular}\\[35mm]
+<%if FA_steuerberater%>
+\vspace{11mm}
+\begin{list}{}{
+\setlength{\leftmargin}{2mm}
+\setlength{\itemsep}{0mm}
+\setlength{\parsep}{0mm}
+%\setlength{\topsep}{0mm}
+%\setlength{\parskip}{0mm}
+%\setlength{\partopsep}{0mm}
+}
+\begin{small}
+\item <%FA_steuerberater_name%>
+\item <%FA_steuerberater_street%>
+\item <%FA_steuerberater_city%>
+\item Tel:~<%FA_steuerberater_tel%>
+\end{small}\\[15mm]
+\item <%Datum_heute%>,
+\end{list}
+<%end FA_steuerberater%>
+<%if not FA_steuerberater%>
+\begin{list}{}{
+\setlength{\leftmargin}{2mm}
+\setlength{\itemsep}{0mm}
+\setlength{\parsep}{0mm}
+%\setlength{\topsep}{0mm}
+%\setlength{\parskip}{0mm}
+%\setlength{\partopsep}{0mm}
+}
+\begin{small}
+\item ~
+\item ~
+\item ~
+\item ~
+\end{small}\\[26mm]
+\item <%Datum_heute%>,
+\end{list}
+<%end FA_steuerberater%>
+\end{document}
+
+
+
+
+
+
+
+
+
+