From 11e6f144c6af375d7b061bde6484266884d6f636 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Sat, 10 Feb 2007 19:46:58 +0000 Subject: [PATCH] Bug 528 solved. Better Taxbird export for USTVA. --- bin/mozilla/ustva.pl | 136 +++++++++++++++++++++-------------- templates/German-taxbird.txb | 51 +------------ 2 files changed, 85 insertions(+), 102 deletions(-) diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index 2368545f1..7afd2c175 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -852,7 +852,6 @@ sub generate_ustva { #$form->{"iconv"} = Text::Iconv->new($myconfig{dbcharset}, "UTF-8"); #my $iconv = $self->{"iconv"}; #$iconv->convert($variable); - if ($form->{period} =~ /^[4]\d$/ ){ my %periods = ( # Lx => taxbird '41' => '12', @@ -864,59 +863,6 @@ sub generate_ustva { 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 ); - } - - $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}); - $form->{co_phone_prefix} =~ s/\s//g; - $form->{co_phone} =~ s/\s//g; - - $form->{taxbird_steuernummer} = $form->{steuernummer}; -# $form->{taxbird_steuernummer} =~ s/\D//g; - $form->{taxbird_steuernummer} =~ s/\///; # ersten Querstrich ersetzen - - # 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}; @@ -929,6 +875,87 @@ sub generate_ustva { exit(0); } + 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 ); + } + + $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}); + $form->{co_phone_prefix} =~ s/\s//g; + $form->{co_phone} =~ s/\s//g; + + $form->{taxbird_steuernummer} = $form->{steuernummer}; + # $form->{taxbird_steuernummer} =~ s/\D//g; + $form->{taxbird_steuernummer} =~ s/\///; # ersten Querstrich ersetzen + + # 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; + + # push Kennziffern to <%foreach Array fo easyer + # output in xml format. Thx to Moritz. + my %taxbird_id_for = ( + + '511' => 'Kz51-calc', + '861' => 'Kz86-calc', + '971' => 'Kz97-calc', + '931' => 'Kz93-calc', + '811' => 'Kz81-calc', + '891' => 'Kz89-calc', + 'Z45' => 'uebertrag', + 'Z53' => 'ust-sum', + 'Z62' => 'ust-minus-vost', + 'Z65' => 'ust-sum+69', + 'Z67' => 'ust-vz', + ); + + + for my $kennziffer (@category_cent, @category_euro) { + + next if ($kennziffer eq 'Z43'); + + if ($form->{$kennziffer} != 0){ + if (defined $taxbird_id_for{$kennziffer}) { + push(@{ $form->{id}}, $taxbird_id_for{$kennziffer}); + } else { + push(@{ $form->{id}}, "Kz$kennziffer"); + } + push(@{ $form->{amount}}, $form->{$kennziffer}); + } + } + } elsif ( $form->{format} eq '' ){ # No format error. $form->header; USTVA::error( $locale->text('Application Error. No Format given' ) . "!"); @@ -940,6 +967,7 @@ sub generate_ustva { exit(0); } + if ( $form->{period} eq '13' and $form->{format} ne 'html') { $form->header; USTVA::info( diff --git a/templates/German-taxbird.txb b/templates/German-taxbird.txb index 6cbc69eb6..c1a8a39cc 100644 --- a/templates/German-taxbird.txb +++ b/templates/German-taxbird.txb @@ -1,4 +1,4 @@ -;; This file was produced using lx-office +;; This file was produced by lx-office ;; for using in taxbird. ;; You probably don't want to touch this ;; file. In case you do want it anyway, @@ -18,51 +18,6 @@ ("zeitraum" . "<%taxbird_period%>") ("stnr" . "<%taxbird_steuernummer%>") -<%if 10%>("Kz10" . "<%10%>")<%end 10%> -<%if 22%>("Kz22" . "<%22%>")<%end 22%> -<%if 26%>("Kz26" . "<%26%>")<%end 26%> -<%if 29%>("Kz29" . "<%29%>")<%end 29%> -<%if 35%>("Kz35" . "<%35%>")<%end 35%> -<%if 36%>("Kz36" . "<%36%>")<%end 36%> -<%if 39%>("Kz39" . "<%39%>")<%end 39%> -<%if 41%>("Kz41" . "<%41%>")<%end 41%> -<%if 42%>("Kz42" . "<%42%>")<%end 42%> -<%if 43%>("Kz43" . "<%43%>")<%end 43%> -<%if 44%>("Kz44" . "<%44%>")<%end 44%> -<%if 45%>("Kz45" . "<%45%>")<%end 45%> -<%if 48%>("Kz48" . "<%48%>")<%end 48%> -<%if 49%>("Kz49" . "<%49%>")<%end 49%> -<%if 51%>("Kz51" . "<%51%>")<%end 51%> -<%if 511%>("Kz51-calc" . "<%511%>")<%end 511%> -<%if 52%>("Kz52" . "<%52%>")<%end 52%> -<%if 53%>("Kz53" . "<%53%>")<%end 53%> -<%if 59%>("Kz59" . "<%59%>")<%end 59%> -<%if 60%>("Kz60" . "<%60%>")<%end 60%> -<%if 61%>("Kz61" . "<%61%>")<%end 61%> -<%if 62%>("Kz62" . "<%62%>")<%end 62%> -<%if 63%>("Kz63" . "<%63%>")<%end 63%> -<%if 64%>("Kz64" . "<%64%>")<%end 64%> -<%if 65%>("Kz65" . "<%65%>")<%end 65%> -<%if 66%>("Kz66" . "<%66%>")<%end 66%> -<%if 67%>("Kz67" . "<%67%>")<%end 67%> -<%if 69%>("Kz69" . "<%69%>")<%end 69%> -<%if 73%>("Kz73" . "<%73%>")<%end 73%> -<%if 74%>("Kz74" . "<%74%>")<%end 74%> -<%if 76%>("Kz76" . "<%76%>")<%end 76%> -<%if 77%>("Kz77" . "<%77%>")<%end 77%> -<%if 80%>("Kz80" . "<%80%>")<%end 80%> -<%if 83%>("Kz83" . "<%83%>")<%end 83%> -<%if 84%>("Kz84" . "<%84%>")<%end 84%> -<%if 85%>("Kz85" . "<%85%>")<%end 85%> -<%if 86%>("Kz86" . "<%86%>")<%end 86%> -<%if 861%>("Kz86-calc" . "<%861%>")<%end 861%> -<%if 91%>("Kz91" . "<%91%>")<%end 91%> -<%if 93%>("Kz93" . "<%93%>")<%end 93%> -<%if 931%>("Kz93-calc" . "<%931%>")<%end 931%> -<%if 94%>("Kz94" . "<%94%>")<%end 94%> -<%if 95%>("Kz95" . "<%95%>")<%end 95%> -<%if 96%>("Kz96" . "<%96%>")<%end 96%> -<%if 97%>("Kz97" . "<%97%>")<%end 97%> -<%if 971%>("Kz97-calc" . "<%971%>")<%end 971%> -<%if 98%>("Kz98" . "<%98%>")<%end 98%> +<%foreach id%> +("<%id%>" . "<%amount%>")<%end%> )) \ No newline at end of file -- 2.20.1