X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fustva.pl;h=99210941cc879ed23e202e57bcaec1acd25625e5;hb=bb99760f9239bca52db6f4496bdb7aaa9055fbf7;hp=a40388a98efce767059896b4625add17c640af8f;hpb=7e2da79f4e22f5cf17f51b3a20b551533f9dc63d;p=kivitendo-erp.git diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index a40388a98..99210941c 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -29,7 +29,7 @@ require "$form->{path}/arap.pl"; #use strict; #no strict 'refs'; #use diagnostics; -#use warnings FATAL=> 'all'; +#use warnings; # FATAL=> 'all'; #use vars qw($locale $form %myconfig); #our ($myconfig); #use CGI::Carp "fatalsToBrowser"; @@ -76,13 +76,11 @@ sub report { $form->{title} = $locale->text('UStVA'); $form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 - # $accrual = ($eur) ? "" : "checked"; - # $cash = ($eur) ? "checked" : ""; - my $year = ''; - my $null = ''; - ($null, $null, $null, $null, $null, $year, $null, $null, $null) = - localtime(); - $year += 1900; + my $year = substr( + $form->datetonum($form->current_date(\%myconfig), + \%myconfig + ), + 0, 4); my $department = ''; local $hide = ''; @@ -109,7 +107,7 @@ sub report { # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum # Einlesen der Finanzamtdaten &get_config($userspath, 'finanzamt.ini'); - + # Hier Einlesen der user-config # steuernummer entfernt für prerelease my @a = qw(signature name company address businessnumber tel fax email @@ -140,7 +138,7 @@ sub report { | . $locale->text('Kein Firmenname hinterlegt!') . qq| |; } - + # Anpassungen der Variablennamen auf pre 2.1.1 Namen # klären, ob $form->{company_street|_address} gesetzt sind # @@ -149,26 +147,27 @@ sub report { my $temp = $form->{address}; $temp =~ s/\\n//; ($form->{co_street}, $form->{co_city}) = split("", $temp); + $form->{co_city} =~ s/\\n//g; } - if ( $form->{co_street} ne '' - and ($form->{co_zip} ne '' - or $form->{co_city} ne '') ) { + if ($form->{co_street} ne '' + and ( $form->{co_zip} ne '' + or $form->{co_city} ne '') + ) { print qq| $form->{co_street} $form->{co_street1} $form->{co_zip} $form->{co_city}|; - } else { + } else { print qq| {path}&action=config&level=Programm--Preferences&login=$form->{login}&password=$form->{password}> | . $locale->text('Keine Firmenadresse hinterlegt!') . qq|\n|; } - $form->{co_email}=$form->{email} unless $form->{co_email}=''; - $form->{co_tel}=$form->{tel} unless $form->{co_tel}=''; - $form->{co_fax}=$form->{fax} unless $form->{co_fax}=''; - $form->{co_url}=$form->{urlx} unless $form->{co_url}=''; - - + $form->{co_email} = $form->{email} unless $form->{co_email}; + $form->{co_tel} = $form->{tel} unless $form->{co_tel}; + $form->{co_fax} = $form->{fax} unless $form->{co_fax}; + $form->{co_url} = $form->{urlx} unless $form->{co_url}; + print qq| @@ -193,10 +192,10 @@ sub report { Keine Steuernummer hinterlegt!|; } print qq| - + @@ -233,7 +232,7 @@ sub report { # accounting years if SQL-Ledger Version < 2.4.1 # $year = $form->{year} * 1; - @years = sort { $b <=> $a } (2000 .. ($year+1)); + @years = sort { $b <=> $a } (2003 .. ($year + 1)); $form->{all_years} = \@years; } map { $form->{selectaccountingyear} .= qq|$_\n| } @@ -414,31 +413,6 @@ sub report { |; - # Stichtag der nächsten USTVA berechnen - # - # ($stichtag, $tage_bis, $ical) = FA->stichtag($today[dd.mm.yyyy], - # $FA_dauerfrist[1,0], - # $FA_voranmeld[month, quarter]) - #$tmpdateform= $myconfig{dateformat}; - # $myconfig{dateformat}= "dd.mm.yyyy"; - # $form->{today} = $form->datetonum($form->current_date(\%myconfig), \%myconfig); - # ($stichtag, $description, $tage_bis, $ical) = FA::stichtag($form->{today}, $form->{FA_dauerfrist},$form->{FA_voranmeld}); - # $form->{today} = $form->date($stichtag, \%myconfig ); - #$myconfig{dateformat}= $tmpdateform; - - #print qq| - # - # - # - # - # |.$locale->text('Anstehende Voranmeldungen').qq| - # - # $stichtag - # $description - # $form->{today} - # - # |; - } else { print qq| @@ -446,12 +420,12 @@ sub report { | . $locale->text('Hinweise') . qq| - Die Ausgabefunktionen sind wegen unzureichender Voreinstellungen deaktiviert. - Hilfe: + | + . $locale->text('Missing Preferences: Outputroutine disabled') + . qq| + | . $locale->text('Help:') . qq| - Wählen Sie im Administrationsmenü den momentanen Benutzer aus - (siehe Kopfzeile). Dort können Sie fehlende Firmenangaben bzw. - die Steuernummer ergänzen. + | . $locale->text('Hint-Missing-Preferences') . qq| |; @@ -515,6 +489,7 @@ sub report { sub help { $lxdebug->enter_sub(); + # parse help documents under doc my $tmp = $form->{templates}; $form->{templates} = 'doc'; @@ -529,6 +504,7 @@ sub help { sub show { $lxdebug->enter_sub(); + #&generate_ustva(); no strict 'refs'; $lxdebug->leave_sub(); @@ -538,14 +514,20 @@ sub show { sub ustva_vorauswahl { $lxdebug->enter_sub(); + #Aktuelles Datum zerlegen: - $locale->date(\%myconfig, $form->current_date(\%myconfig, '0', '0'), 0) =~ - /(\d\d).(\d\d).(\d\d\d\d)/; + my $date = $form->datetonum($form->current_date(\%myconfig), \%myconfig); #$locale->date($myconfig, $form->current_date($myconfig), 0)=~ /(\d\d).(\d\d).(\d\d\d\d)/; - $form->{day} = $1; - $form->{month} = $2; - $form->{year} = $3; + $form->{day} = substr($date, 6, 2); + $form->{month} = substr($date, 4, 2); + $form->{year} = substr($date, 0, 4); + $lxdebug->message(LXDebug::DEBUG1, qq| + Actual date from Database: $date\n + Actual year from Database: $form->{year}\n + Actual day from Database: $form->{day}\n + Actual month from Database: $form->{month}\n|); + my $sel = ''; my $yymmdd = ''; @@ -579,13 +561,17 @@ sub ustva_vorauswahl { '09' => 'September', '10' => 'October', '11' => 'November', - '12' => 'December'); + '12' => 'December', + '13' => 'Yearly',); my $yy = $form->{year} * 10000; $yymmdd = "$form->{year}$form->{month}$form->{day}" * 1; + $yymmdd = 20060121; $sel = ''; - my $dfv = '0'; # Offset für Dauerfristverlängerung - #$dfv = '100' if ($form->{FA_dauerfrist} eq '1'); + my $dfv = '0'; + + # Offset für Dauerfristverlängerung + $dfv = '100' if ($form->{FA_dauerfrist} eq '1'); SWITCH: { $yymmdd <= ($yy + 110 + $dfv) && do { @@ -649,8 +635,7 @@ sub ustva_vorauswahl { $selected = 'selected' if ($sel eq $key); print qq| | - . $locale->text("$liste{$key}") - . qq| + . $locale->text("$liste{$key}") . qq| |; } @@ -659,10 +644,11 @@ sub ustva_vorauswahl { } elsif ($form->{FA_voranmeld} eq 'quarter') { # Vorauswahl bei quartalsweisem Voranmeldungszeitraum - my %liste = ('A' => '1.', - 'B' => '2.', - 'C' => '3.', - 'D' => '4.',); + my %liste = ('A' => $locale->text('1. Quarter'), + 'B' => $locale->text('2. Quarter'), + 'C' => $locale->text('3. Quarter'), + 'D' => $locale->text('4. Quarter'), + '13' => $locale->text('Yearly'),); my $yy = $form->{year} * 10000; $yymmdd = "$form->{year}$form->{month}$form->{day}" * 1; @@ -700,9 +686,7 @@ sub ustva_vorauswahl { my $selected = ''; $selected = 'selected' if ($sel eq $key); print qq| - $liste{$key} | - . $locale->text('Quarter') - . qq| + $liste{$key} |; } print qq|\n @@ -714,10 +698,10 @@ sub ustva_vorauswahl { print qq||; - my %listea = ('A' => '1.', - 'B' => '2.', - 'C' => '3.', - 'D' => '4.',); + my %listea = ('A' => '1. Quarter', + 'B' => '2. Quarter', + 'C' => '3. Quarter', + 'D' => '4. Quarter',); my %listeb = ('01' => 'January', '02' => 'February', @@ -730,22 +714,21 @@ sub ustva_vorauswahl { '09' => 'September', '10' => 'October', '11' => 'November', - '12' => 'December',); + '12' => 'December', + '13' => 'Yearly',); my $key = ''; foreach $key (sort keys %listea) { print qq| - $listea{$key} | - . $locale->text('Quarter') - . qq| - - |; + | + . $locale->text("$listea{$key}") + . qq|\n|; } foreach $key (sort keys %listeb) { print qq| - | . $locale->text("$listeb{$key}") . qq| - - |; + | + . $locale->text("$listeb{$key}") + . qq|\n|; } print qq||; } @@ -777,7 +760,7 @@ sub show_options { qq| | . $locale->text('Vorschau') . qq||; - if ($latex) { + if ($latex_templates) { $format .= qq| | . $locale->text('UStVA als PDF-Dokument') @@ -798,8 +781,7 @@ sub show_options { $type $media $format + . $locale->text('Ausgabeformat auswählen...') . qq|">$format |; $lxdebug->leave_sub(); } @@ -823,127 +805,134 @@ sub generate_ustva { #forgotten the year --> thisyear if ($form->{year} !~ m/^\d\d\d\d$/) { - $locale->date(\$myconfig, $form->current_date(\$myconfig), 0) =~ - /(\d\d\d\d)/; - $form->{year} = $1; + $form->{year} = substr( + $form->datetonum( + $form->current_date(\%myconfig), \%myconfig + ), + 0, 4); + $lxdebug->message(LXDebug::DEBUG1, + qq|Actual year from Database: $form->{year}\n|); } #yearly report if ($form->{duetyp} eq "13") { - $form->{fromdate} = "1.1.$form->{year}"; - $form->{todate} = "31.12.$form->{year}"; + $form->{fromdate} = "$form->{year}0101"; + $form->{todate} = "$form->{year}1231"; } #Quater reports if ($form->{duetyp} eq "A") { - $form->{fromdate} = "1.1.$form->{year}"; - $form->{todate} = "31.3.$form->{year}"; + $form->{fromdate} = "$form->{year}0101"; + $form->{todate} = "$form->{year}0331"; $form->{'0441'} = "X"; } if ($form->{duetyp} eq "B") { - $form->{fromdate} = "1.4.$form->{year}"; - $form->{todate} = "30.6.$form->{year}"; + $form->{fromdate} = "$form->{year}0401"; + $form->{todate} = "$form->{year}0630"; $form->{'0442'} = "X"; } if ($form->{duetyp} eq "C") { - $form->{fromdate} = "1.7.$form->{year}"; - $form->{todate} = "30.9.$form->{year}"; + $form->{fromdate} = "$form->{year}0701"; + $form->{todate} = "$form->{year}0930"; $form->{'0443'} = "X"; } if ($form->{duetyp} eq "D") { - $form->{fromdate} = "1.10.$form->{year}"; - $form->{todate} = "31.12.$form->{year}"; + $form->{fromdate} = "$form->{year}1001"; + $form->{todate} = "$form->{year}1231"; $form->{'0444'} = "X"; } #Monthly reports SWITCH: { $form->{duetyp} eq "01" && do { - $form->{fromdate} = "1.1.$form->{year}"; - $form->{todate} = "31.1.$form->{year}"; + $form->{fromdate} = "$form->{year}0101"; + $form->{todate} = "$form->{year}0131"; $form->{'0401'} = "X"; last SWITCH; }; $form->{duetyp} eq "02" && do { - $form->{fromdate} = "1.2.$form->{year}"; + $form->{fromdate} = "$form->{year}0201"; #this works from 1901 to 2099, 1900 and 2100 fail. my $leap = ($form->{year} % 4 == 0) ? "29" : "28"; - $form->{todate} = "$leap.2.$form->{year}"; + $form->{todate} = "$form->{year}02$leap"; $form->{"0402"} = "X"; last SWITCH; }; $form->{duetyp} eq "03" && do { - $form->{fromdate} = "1.3.$form->{year}"; - $form->{todate} = "31.3.$form->{year}"; + $form->{fromdate} = "$form->{year}0301"; + $form->{todate} = "$form->{year}0331"; $form->{"0403"} = "X"; last SWITCH; }; $form->{duetyp} eq "04" && do { - $form->{fromdate} = "1.4.$form->{year}"; - $form->{todate} = "30.4.$form->{year}"; + $form->{fromdate} = "$form->{year}0401"; + $form->{todate} = "$form->{year}0430"; $form->{"0404"} = "X"; last SWITCH; }; $form->{duetyp} eq "05" && do { - $form->{fromdate} = "1.5.$form->{year}"; - $form->{todate} = "31.5.$form->{year}"; + $form->{fromdate} = "$form->{year}0501"; + $form->{todate} = "$form->{year}0531"; $form->{"0405"} = "X"; last SWITCH; }; $form->{duetyp} eq "06" && do { - $form->{fromdate} = "1.6.$form->{year}"; - $form->{todate} = "30.6.$form->{year}"; + $form->{fromdate} = "$form->{year}0601"; + $form->{todate} = "$form->{year}0630"; $form->{"0406"} = "X"; last SWITCH; }; $form->{duetyp} eq "07" && do { - $form->{fromdate} = "1.7.$form->{year}"; - $form->{todate} = "31.7.$form->{year}"; + $form->{fromdate} = "$form->{year}0701"; + $form->{todate} = "$form->{year}0731"; $form->{"0407"} = "X"; last SWITCH; }; $form->{duetyp} eq "08" && do { - $form->{fromdate} = "1.8.$form->{year}"; - $form->{todate} = "31.8.$form->{year}"; + $form->{fromdate} = "$form->{year}0801"; + $form->{todate} = "$form->{year}0831"; $form->{"0408"} = "X"; last SWITCH; }; $form->{duetyp} eq "09" && do { - $form->{fromdate} = "1.9.$form->{year}"; - $form->{todate} = "30.9.$form->{year}"; + $form->{fromdate} = "$form->{year}0901"; + $form->{todate} = "$form->{year}0930"; $form->{"0409"} = "X"; last SWITCH; }; $form->{duetyp} eq "10" && do { - $form->{fromdate} = "1.10.$form->{year}"; - $form->{todate} = "31.10.$form->{year}"; + $form->{fromdate} = "$form->{year}1001"; + $form->{todate} = "$form->{year}1031"; $form->{"0410"} = "X"; last SWITCH; }; $form->{duetyp} eq "11" && do { - $form->{fromdate} = "1.11.$form->{year}"; - $form->{todate} = "30.11.$form->{year}"; + $form->{fromdate} = "$form->{year}1101"; + $form->{todate} = "$form->{year}1130"; $form->{"0411"} = "X"; last SWITCH; }; $form->{duetyp} eq "12" && do { - $form->{fromdate} = "1.12.$form->{year}"; - $form->{todate} = "31.12.$form->{year}"; + $form->{fromdate} = "$form->{year}1201"; + $form->{todate} = "$form->{year}1231"; $form->{"0412"} = "X"; last SWITCH; }; } } - #$myconfig = \%myconfig; - RP->ustva(\%myconfig, \%$form); + # using dates in ISO-8601 format: yyyymmmdd for Postgres... + USTVA->ustva(\%myconfig, \%$form); - #??($form->{department}) = split /--/, $form->{department}; + # 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} = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0); $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1, 0, 0); - $form->{todate} = $form->current_date($myconfig) unless $form->{todate}; # if there are any dates construct a where if ($form->{fromdate} || $form->{todate}) { @@ -1002,6 +991,7 @@ sub generate_ustva { my $temp = $form->{address}; $temp =~ s/\\n//; ($form->{co_street}, $form->{co_city}) = split("", $temp); + $form->{co_city} =~ s/\\n//g; } if ( $form->{format} eq 'pdf' @@ -1011,29 +1001,64 @@ sub generate_ustva { $form->{endbold} = "}"; $form->{br} = '\\\\'; - my @numbers = qw(51r 86r 97r 93r 96 43 45 - 66 62 67); + 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 = ''; - foreach $number (@numbers) { - $form->{$number} =~ s/,/~~/g; + + # 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; + } } + + # Formatierungen für HTML Ausgabe } elsif ($form->{format} eq 'html') { $form->{padding} = " "; $form->{bold} = ""; $form->{endbold} = ""; $form->{br} = ""; - $form->{address} =~ s/\\n//; + $form->{address} =~ s/\\n//g; } if ($form->{format} eq 'elster') { - &create_winston(); + if ($form->{duetyp} eq '13') { + $form->header; + USTVA::info( + $locale->text( + 'Impossible to create yearly Tax Report via Winston. Not yet implemented!' + )); + } else { + &create_winston(); + } } else { $form->{templates} = $myconfig{templates}; $form->{templates} = "doc" if ($form->{type} eq 'help'); $form->{IN} = "$form->{type}"; $form->{IN} = "$form->{help}" if ($form->{type} eq 'help'); + $form->{IN} = 'USTE' + if ( $form->{duetyp} eq '13' + && $form->{format} ne 'html'); + + if ($form->{IN} eq 'USTE') { + $form->header; + USTVA::info( + $locale->text( + 'Impossible to create yearly Tax Report as PDF or PS. Not yet implemented!' + )); + } + $form->{IN} .= "-$form->{year}" if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript'); @@ -1053,6 +1078,7 @@ sub generate_ustva { sub edit { $lxdebug->enter_sub(); + # edit all taxauthority prefs $form->header; @@ -1075,16 +1101,14 @@ sub edit { | - . $locale->text('Finanzamt - Einstellungen') - . qq| + . $locale->text('Finanzamt - Einstellungen') . qq| | - . $locale->text('Angaben zum Finanzamt') - . qq| + . $locale->text('Angaben zum Finanzamt') . qq| |; #print qq|$form->{terminal}|; @@ -1134,8 +1158,7 @@ sub edit { print qq| | - . $locale->text('Dauerfristverlängerung') - . qq| + . $locale->text('Dauerfristverlängerung') . qq| @@ -1188,8 +1211,7 @@ sub edit { + . $locale->text('debug') . qq|">--> |; print qq| text('USTVA-Hint: Tax Authoritys')) if ( $form->{elsterFFFF_new} eq 'Auswahl' || $form->{elsterland_new} eq 'Auswahl'); - USTVA::info( - $locale->text( - 'Es fehlen Angaben zur Versteuerung. - Wenn Sie Ist Versteuert sind, wählen Sie die Einnahmen/Überschuß-Rechnung aus. - Sind Sie Soll-Versteuert und Bilanzverpflichtet, dann wählen Sie Bilanz aus.' - )) + USTVA::info( $locale->text('Missing Method!') . "\n" + . $locale->text('USTVA-Hint: Method')) if ($form->{method} eq ''); # Klären, ob Variablen bereits befüllt sind UND ob veräderungen auf # der vorherigen Maske stattfanden: $change = 1(in der edit sub, # mittels get_config) - my $change = - $form->{elsterland} eq $form->{elsterland_new} + my $change = $form->{elsterland} eq $form->{elsterland_new} && $form->{elsterFFFF} eq $form->{elsterFFFF_new} ? '0' : '1'; $change = '0' if ($form->{saved} eq $locale->text('saved')); my $elster_init = &elster_hash(); @@ -1338,8 +1353,7 @@ sub edit_form { | - . $locale->text('Finanzamt - Einstellungen') - . qq| + . $locale->text('Finanzamt - Einstellungen') . qq| @@ -1578,8 +1592,7 @@ sub show_fa_daten { | - . $locale->text('Finanzamt') - . qq| $form->{FA_Name} + . $locale->text('Finanzamt') . qq| $form->{FA_Name} |; @@ -1893,7 +1906,7 @@ SWITCH: $form->parse_amount(\%myconfig, $form->{"66"}) * 100; # Vorsteuer 7% plus 16% my $k83 = - $form->parse_amount(\%myconfig, $form->{"67"}) * 100; # Umsätze zu 7% USt + $form->parse_amount(\%myconfig, $form->{"83"}) * 100 ; # Endbetrag my $k96 = $form->parse_amount(\%myconfig, $form->{"96"}) * 100; # # # Now build the xml content @@ -1903,7 +1916,7 @@ SWITCH: - $form->{elstersteuernummer} + $form->{elsterFFFF}$form->{elstersteuernummer} $form->{year} $azr |; @@ -1941,6 +1954,7 @@ Content-Disposition: attachment; filename="$elsterfile"\n\n|; sub continue { $lxdebug->enter_sub(); + # allow Symbolic references just here: no strict 'refs'; &{ $form->{nextsub} }; @@ -1948,9 +1962,9 @@ sub continue { $lxdebug->leave_sub(); } -sub back { +sub back { $lxdebug->enter_sub(); - &{ $form->{lastsub} }; + &{ $form->{lastsub} }; $lxdebug->leave_sub(); }