X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fustva.pl;h=6b25b7875a803f143f655604a6f7bad0dbe3f317;hb=3db7bbb21243d2f9de903b41f590f82dae64c161;hp=6fa1ed75ee2ba2c3459cfc90c48a8cb3fc091e87;hpb=981b670e29449b7ebffe6c910439a05e6613ec6b;p=kivitendo-erp.git diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index 6fa1ed75e..6b25b7875 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"; @@ -73,16 +73,15 @@ sub report { $lxdebug->enter_sub(); my $myconfig = \%myconfig; use CGI; + $form->{title} = $locale->text('UStVA'); - $form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 + $form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 Nein=0 - # $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 +108,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 +139,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 +148,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 +193,10 @@ sub report { Keine Steuernummer hinterlegt!|; } print qq| - + @@ -233,7 +233,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 +414,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 +421,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 +490,7 @@ sub report { sub help { $lxdebug->enter_sub(); + # parse help documents under doc my $tmp = $form->{templates}; $form->{templates} = 'doc'; @@ -529,6 +505,7 @@ sub help { sub show { $lxdebug->enter_sub(); + #&generate_ustva(); no strict 'refs'; $lxdebug->leave_sub(); @@ -538,14 +515,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 = ''; @@ -563,31 +546,29 @@ sub ustva_vorauswahl { if ($form->{FA_voranmeld} eq 'month') { # Vorauswahl bei monatlichem Voranmeldungszeitraum - print qq| - - |; - my %liste = ('01' => 'January', - '02' => 'February', - '03' => 'March', - '04' => 'April', - '05' => 'May', - '06' => 'June', - '07' => 'July', - '08' => 'August', - '09' => 'September', - '10' => 'October', - '11' => 'November', - '12' => 'December', - '13' => 'Yearly', + my %liste = ('01' => $locale->text('January'), + '02' => $locale->text('February'), + '03' => $locale->text('March'), + '04' => $locale->text('April'), + '05' => $locale->text('May'), + '06' => $locale->text('June'), + '07' => $locale->text('July'), + '08' => $locale->text('August'), + '09' => $locale->text('September'), + '10' => $locale->text('October'), + '11' => $locale->text('November'), + '12' => $locale->text('December'), + '13' => $locale->text('Yearly'), ); - + my $yy = $form->{year} * 10000; $yymmdd = "$form->{year}$form->{month}$form->{day}" * 1; $sel = ''; - my $dfv = '0'; # Offset für Dauerfristverlängerung - #$dfv = '100' if ($form->{FA_dauerfrist} eq '1'); + my $dfv = ''; + + # Offset für Dauerfristverlängerung + $dfv = '100' if ($form->{FA_dauerfrist} eq '1'); SWITCH: { $yymmdd <= ($yy + 110 + $dfv) && do { @@ -645,15 +626,15 @@ sub ustva_vorauswahl { }; } + print qq||; + my $key = ''; foreach $key (sort keys %liste) { my $selected = ''; $selected = 'selected' if ($sel eq $key); print qq| - | - . $locale->text("$liste{$key}") - . qq| - + $liste{$key} |; } print qq||; @@ -661,12 +642,11 @@ sub ustva_vorauswahl { } elsif ($form->{FA_voranmeld} eq 'quarter') { # Vorauswahl bei quartalsweisem Voranmeldungszeitraum - 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 %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; @@ -733,20 +713,20 @@ sub ustva_vorauswahl { '10' => 'October', '11' => 'November', '12' => 'December', - '13' => 'Yearly', - ); + '13' => 'Yearly',); my $key = ''; foreach $key (sort keys %listea) { print qq| - $listea{$key} - |; + | + . $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||; } @@ -778,7 +758,7 @@ sub show_options { qq| | . $locale->text('Vorschau') . qq||; - if ($latex) { + if ($latex_templates) { $format .= qq| | . $locale->text('UStVA als PDF-Dokument') @@ -799,8 +779,7 @@ sub show_options { $type $media $format + . $locale->text('Ausgabeformat auswählen...') . qq|">$format |; $lxdebug->leave_sub(); } @@ -824,130 +803,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} = "$form->{year}-01-01"; - $form->{todate} = "$form->{year}-12-31"; + $form->{fromdate} = "$form->{year}0101"; + $form->{todate} = "$form->{year}1231"; } #Quater reports if ($form->{duetyp} eq "A") { - $form->{fromdate} = "$form->{year}-01-01"; - $form->{todate} = "$form->{year}-03-31"; + $form->{fromdate} = "$form->{year}0101"; + $form->{todate} = "$form->{year}0331"; $form->{'0441'} = "X"; } if ($form->{duetyp} eq "B") { - $form->{fromdate} = "$form->{year}-04-01"; - $form->{todate} = "$form->{year}-06-30"; + $form->{fromdate} = "$form->{year}0401"; + $form->{todate} = "$form->{year}0630"; $form->{'0442'} = "X"; } if ($form->{duetyp} eq "C") { - $form->{fromdate} = "$form->{year}-07-01"; - $form->{todate} = "$form->{year}-09-30"; + $form->{fromdate} = "$form->{year}0701"; + $form->{todate} = "$form->{year}0930"; $form->{'0443'} = "X"; } if ($form->{duetyp} eq "D") { - $form->{fromdate} = "$form->{year}-10-01"; - $form->{todate} = "$form->{year}-12-31"; + $form->{fromdate} = "$form->{year}1001"; + $form->{todate} = "$form->{year}1231"; $form->{'0444'} = "X"; } #Monthly reports SWITCH: { $form->{duetyp} eq "01" && do { - $form->{fromdate} = "$form->{year}-01-01"; - $form->{todate} = "$form->{year}-01-31"; + $form->{fromdate} = "$form->{year}0101"; + $form->{todate} = "$form->{year}0131"; $form->{'0401'} = "X"; last SWITCH; }; $form->{duetyp} eq "02" && do { - $form->{fromdate} = "$form->{year}-02-01"; + $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} = "$form->{year}-02-$leap"; + $form->{todate} = "$form->{year}02$leap"; $form->{"0402"} = "X"; last SWITCH; }; $form->{duetyp} eq "03" && do { - $form->{fromdate} = "$form->{year}-03-01"; - $form->{todate} = "$form->{year}-03-31"; + $form->{fromdate} = "$form->{year}0301"; + $form->{todate} = "$form->{year}0331"; $form->{"0403"} = "X"; last SWITCH; }; $form->{duetyp} eq "04" && do { - $form->{fromdate} = "$form->{year}-04-01"; - $form->{todate} = "$form->{year}-04-30"; + $form->{fromdate} = "$form->{year}0401"; + $form->{todate} = "$form->{year}0430"; $form->{"0404"} = "X"; last SWITCH; }; $form->{duetyp} eq "05" && do { - $form->{fromdate} = "$form->{year}-05-01"; - $form->{todate} = "$form->{year}-05-31"; + $form->{fromdate} = "$form->{year}0501"; + $form->{todate} = "$form->{year}0531"; $form->{"0405"} = "X"; last SWITCH; }; $form->{duetyp} eq "06" && do { - $form->{fromdate} = "$form->{year}-06-01"; - $form->{todate} = "$form->{year}-06-30"; + $form->{fromdate} = "$form->{year}0601"; + $form->{todate} = "$form->{year}0630"; $form->{"0406"} = "X"; last SWITCH; }; $form->{duetyp} eq "07" && do { - $form->{fromdate} = "$form->{year}-07-01"; - $form->{todate} = "$form->{year}-07-31"; + $form->{fromdate} = "$form->{year}0701"; + $form->{todate} = "$form->{year}0731"; $form->{"0407"} = "X"; last SWITCH; }; $form->{duetyp} eq "08" && do { - $form->{fromdate} = "$form->{year}-08-01"; - $form->{todate} = "$form->{year}-08-31"; + $form->{fromdate} = "$form->{year}0801"; + $form->{todate} = "$form->{year}0831"; $form->{"0408"} = "X"; last SWITCH; }; $form->{duetyp} eq "09" && do { - $form->{fromdate} = "$form->{year}-09-01"; - $form->{todate} = "$form->{year}-09-30"; + $form->{fromdate} = "$form->{year}0901"; + $form->{todate} = "$form->{year}0930"; $form->{"0409"} = "X"; last SWITCH; }; $form->{duetyp} eq "10" && do { - $form->{fromdate} = "$form->{year}-10-01"; - $form->{todate} = "$form->{year}-10-31"; + $form->{fromdate} = "$form->{year}1001"; + $form->{todate} = "$form->{year}1031"; $form->{"0410"} = "X"; last SWITCH; }; $form->{duetyp} eq "11" && do { - $form->{fromdate} = "$form->{year}-11-01"; - $form->{todate} = "$form->{year}-11-30"; + $form->{fromdate} = "$form->{year}1101"; + $form->{todate} = "$form->{year}1130"; $form->{"0411"} = "X"; last SWITCH; }; $form->{duetyp} eq "12" && do { - $form->{fromdate} = "$form->{year}-12-01"; - $form->{todate} = "$form->{year}-12-31"; + $form->{fromdate} = "$form->{year}1201"; + $form->{todate} = "$form->{year}1231"; $form->{"0412"} = "X"; last SWITCH; }; } } - #$myconfig = \%myconfig; - #$myconfig->{dateformat} = 'yyyy-mm-dd'; - #$form->{fromdate}= $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0); - #$form->{todate}= $locale->date(\%myconfig, $form->{todate}, 0, 0, 0); + # 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}) { @@ -1006,6 +989,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' @@ -1015,39 +999,43 @@ sub generate_ustva { $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); - + 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') { + 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') { + } + 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') { + + # 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') { - if ($form->{duetyp} eq '13'){ + if ($form->{duetyp} eq '13') { $form->header; - USTVA::info($locale->text('Impossible to create yearly Tax Report via Winston. Not yet implemented!')); + USTVA::info( + $locale->text( + 'Impossible to create yearly Tax Report via Winston. Not yet implemented!' + )); } else { &create_winston(); } @@ -1057,14 +1045,18 @@ sub generate_ustva { $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->{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!')); + 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'); @@ -1084,6 +1076,7 @@ sub generate_ustva { sub edit { $lxdebug->enter_sub(); + # edit all taxauthority prefs $form->header; @@ -1106,16 +1099,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}|; @@ -1165,8 +1156,7 @@ sub edit { print qq| | - . $locale->text('Dauerfristverlängerung') - . qq| + . $locale->text('Dauerfristverlängerung') . qq| @@ -1219,8 +1209,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(); @@ -1369,8 +1351,7 @@ sub edit_form { | - . $locale->text('Finanzamt - Einstellungen') - . qq| + . $locale->text('Finanzamt - Einstellungen') . qq| @@ -1609,8 +1590,7 @@ sub show_fa_daten { | - . $locale->text('Finanzamt') - . qq| $form->{FA_Name} + . $locale->text('Finanzamt') . qq| $form->{FA_Name} |; @@ -1924,7 +1904,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 @@ -1934,7 +1914,7 @@ SWITCH: - $form->{elstersteuernummer} + $form->{elsterFFFF}$form->{elstersteuernummer} $form->{year} $azr |; @@ -1972,6 +1952,7 @@ Content-Disposition: attachment; filename="$elsterfile"\n\n|; sub continue { $lxdebug->enter_sub(); + # allow Symbolic references just here: no strict 'refs'; &{ $form->{nextsub} }; @@ -1979,9 +1960,9 @@ sub continue { $lxdebug->leave_sub(); } -sub back { +sub back { $lxdebug->enter_sub(); - &{ $form->{lastsub} }; + &{ $form->{lastsub} }; $lxdebug->leave_sub(); }