Revision 127b0df3
Von Jan Büren vor fast 11 Jahren hinzugefügt
bin/mozilla/ustva.pl | ||
---|---|---|
21 | 21 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
22 | 22 |
#====================================================================== |
23 | 23 |
# German Tax authority Module and later ELSTER Interface |
24 |
# 08.01.14 ELSTER Interface software (taxbird/winston) removed |
|
24 | 25 |
#====================================================================== |
25 | 26 |
|
26 | 27 |
use strict; |
... | ... | |
502 | 503 |
my $media = qq| <input type=hidden name="media" value="screen">|; |
503 | 504 |
my $format = |
504 | 505 |
qq| <option value=html selected>| |
505 |
. $::locale->text('Preview')
|
|
506 |
. $::locale->text('HTML')
|
|
506 | 507 |
. qq|</option>|; |
507 |
if ($::lx_office_conf{print_templates}{latex}) { |
|
508 |
$format .= |
|
509 |
qq| <option value=pdf>| |
|
510 |
. $::locale->text('UStVA (PDF-Dokument)') |
|
511 |
. qq|</option>|; |
|
512 |
} |
|
513 |
|
|
514 |
#my $disabled= qq|disabled="disabled"|; |
|
515 |
#$disabled='' if ($form->{elster} eq '1' ); |
|
516 |
if ($::form->{elster} eq '1') { |
|
517 |
$format .= |
|
518 |
qq|<option value=elsterwinston>| |
|
519 |
. $::locale->text('ELSTER Export (Winston)') |
|
520 |
. qq|</option>| |
|
521 |
. qq|<option value=elstertaxbird>| |
|
522 |
. $::locale->text('ELSTER Export (Taxbird)') |
|
523 |
. qq|</option>|; |
|
524 |
} |
|
525 | 508 |
|
526 |
#$format .= qq|<option value=elster>|.$locale->text('ELSTER Export nach Winston').qq|</option>|; |
|
527 | 509 |
my $show_options = qq| |
528 | 510 |
$type |
529 | 511 |
$media |
... | ... | |
833 | 815 |
foreach my $number (@category_euro) { |
834 | 816 |
$form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0'); |
835 | 817 |
} |
836 |
|
|
837 |
} elsif ( $form->{format} eq 'elsterwinston' ) { |
|
838 |
|
|
839 |
$form->{IN} = 'winston.xml'; |
|
840 |
|
|
841 |
# |
|
842 |
# Build Winston filename |
|
843 |
# |
|
844 |
|
|
845 |
my $file = 'U'; # 1. char 'U' = USTVA |
|
846 |
$file .= $form->{period}; |
|
847 |
#4. and 5. char = year modulo 100 |
|
848 |
$file .= sprintf("%02d", $form->{year} % 100); |
|
849 |
#6. to 18. char = Elstersteuernummer |
|
850 |
#Beispiel: Steuernummer in Bayern |
|
851 |
#111/222/33334 ergibt für UStVA Jan 2004: U01049111022233334 |
|
852 |
$file .= $form->{elsterFFFF}; |
|
853 |
$file .= $form->{elstersteuernummer}; |
|
854 |
#file suffix |
|
855 |
$file .= '.xml'; |
|
856 |
$file =~ s|.*/||; |
|
857 |
|
|
858 |
$form->{attachment_filename} = $file; |
|
859 |
|
|
860 |
# Zahlenformatierung für Winston |
|
861 |
|
|
862 |
my $temp_numberformat = $myconfig{numberformat}; |
|
863 |
|
|
864 |
# Numberformat must be '1000,00' for Winston |
|
865 |
|
|
866 |
$myconfig{numberformat} = '1000,00'; |
|
867 |
|
|
868 |
foreach my $number (@category_cent) { |
|
869 |
$form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : ''; |
|
870 |
} |
|
871 |
|
|
872 |
foreach my $number (@category_euro) { |
|
873 |
$form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : ''; |
|
874 |
} |
|
875 |
# Re-set Numberformat |
|
876 |
$myconfig{numberformat} = $temp_numberformat; |
|
877 |
|
|
878 |
# push Kennziffern to <%foreach Array fo easyer |
|
879 |
# output in xml format. Thx to Moritz. |
|
880 |
my %winston_id_for = ( |
|
881 |
# No Winston remap?! |
|
882 |
); |
|
883 |
|
|
884 |
foreach my $kennziffer (@category_cent, @category_euro) { |
|
885 |
|
|
886 |
next if ( $kennziffer =~ m/Z\d\d/); |
|
887 |
next if ( $form->{$kennziffer} == 0 ); |
|
888 |
|
|
889 |
if (defined $winston_id_for{$kennziffer} ) { |
|
890 |
push(@{ $form->{id}}, $winston_id_for{$kennziffer}); |
|
891 |
} else { |
|
892 |
push(@{ $form->{id}}, "Kz$kennziffer"); |
|
893 |
} |
|
894 |
push(@{ $form->{amount}}, $form->{$kennziffer}); |
|
895 |
} |
|
896 |
|
|
897 |
} elsif ( $form->{format} eq 'elstertaxbird' ) { |
|
898 |
|
|
899 |
# Define serveral filenames |
|
900 |
$form->{IN} = 'taxbird.txb'; |
|
901 |
|
|
902 |
$form->{attachment_filename} = "USTVA-" . ($form->{period} * 1) . sprintf("%02d", $form->{year} % 100) . ".txb"; |
|
903 |
|
|
904 |
$form->{attachment_filename} =~ s|.*/||; |
|
905 |
|
|
906 |
if ($form->{period} =~ /^[4]\d$/ ){ |
|
907 |
my %periods = ( # Lx => taxbird |
|
908 |
'41' => '12', |
|
909 |
'42' => '13', |
|
910 |
'43' => '14', |
|
911 |
'44' => '15', |
|
912 |
); |
|
913 |
|
|
914 |
foreach my $quarter ( keys %periods ) { |
|
915 |
$form->{taxbird_period} = $periods{$quarter} if ( $form->{period} eq $quarter); |
|
916 |
} |
|
917 |
} elsif ($form->{period} =~ /^\d+$/ ) { |
|
918 |
$form->{period} =~ s/^0//g; |
|
919 |
my $period = $form->{period}; |
|
920 |
$period *= 1; |
|
921 |
$period--; |
|
922 |
$form->{taxbird_period} = $period; |
|
923 |
} else { |
|
924 |
$form->header; |
|
925 |
USTVA::error( $locale->text('Wrong Period' )); |
|
926 |
::end_of_request(); |
|
927 |
} |
|
928 |
|
|
929 |
# heuristics for address splitting |
|
930 |
# lx-office holds the entire address in a single field. |
|
931 |
# taxbird expects it to be splitted into street, zipcode and city |
|
932 |
if ($form->{co_street} =~ /\n/) { |
|
933 |
my $new_co_street; |
|
934 |
for (split /\n/, $form->{co_street}) { |
|
935 |
if (/(\d{3,5})\s+(\w+)/) { |
|
936 |
$form->{co_zip} = $1; |
|
937 |
$form->{co_city} = $2; |
|
938 |
} else { |
|
939 |
$new_co_street .= $_; |
|
940 |
} |
|
941 |
} |
|
942 |
$form->{co_street} = $new_co_street; |
|
943 |
} else { |
|
944 |
$form->{co_zip} = $form->{co_city}; |
|
945 |
$form->{co_zip} =~ s/\D//g; |
|
946 |
$form->{co_city} =~ s/\d//g; |
|
947 |
$form->{co_city} =~ s/^\s//g; |
|
948 |
} |
|
949 |
|
|
950 |
my $tax_office = first { $_->{name} eq $form->{elsterland} } @{ $ustva->{tax_office_information} }; |
|
951 |
$form->{taxbird_land_nr} = $tax_office->{taxbird_nr} if $tax_office; |
|
952 |
|
|
953 |
($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel}); |
|
954 |
$form->{co_phone_prefix} =~ s/\s//g; |
|
955 |
$form->{co_phone} =~ s/\s//g; |
|
956 |
|
|
957 |
$form->{taxbird_steuernummer} = $form->{steuernummer}; |
|
958 |
# $form->{taxbird_steuernummer} =~ s/\D//g; |
|
959 |
# $form->{taxbird_steuernummer} =~ s/\///; # ersten Querstrich ersetzen |
|
960 |
|
|
961 |
# Numberformatting for Taxbird |
|
962 |
my $temp_numberformat = $myconfig{numberformat}; |
|
963 |
# Numberformat must be '1000,00' for Taxbird ?! |
|
964 |
$myconfig{numberformat} = '1000,00'; |
|
965 |
foreach my $number (@category_cent) { |
|
966 |
$form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : ''; |
|
967 |
} |
|
968 |
|
|
969 |
foreach my $number (@category_euro) { |
|
970 |
$form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : ''; |
|
971 |
} |
|
972 |
# Re-set Numberformat |
|
973 |
$myconfig{numberformat} = $temp_numberformat; |
|
974 |
|
|
975 |
# push Kennziffern to <%foreach Array fo easyer |
|
976 |
# output in xml format. Thx to Moritz. |
|
977 |
my %taxbird_id_for = ( |
|
978 |
|
|
979 |
'511' => 'Kz51-calc', |
|
980 |
'861' => 'Kz86-calc', |
|
981 |
'971' => 'Kz97-calc', |
|
982 |
'931' => 'Kz93-calc', |
|
983 |
'811' => 'Kz81-calc', |
|
984 |
'891' => 'Kz89-calc', |
|
985 |
'Z45' => 'uebertrag', |
|
986 |
'Z53' => 'ust-sum', |
|
987 |
'Z62' => 'ust-minus-vost', |
|
988 |
'Z65' => 'ust-sum+69', |
|
989 |
'Z67' => 'ust-vz', |
|
990 |
); |
|
991 |
|
|
992 |
|
|
993 |
for my $kennziffer (@category_cent, @category_euro) { |
|
994 |
|
|
995 |
next if ($kennziffer eq 'Z43'); |
|
996 |
|
|
997 |
if ($form->{$kennziffer} != 0){ |
|
998 |
if (defined $taxbird_id_for{$kennziffer}) { |
|
999 |
push(@{ $form->{id}}, $taxbird_id_for{$kennziffer}); |
|
1000 |
} else { |
|
1001 |
push(@{ $form->{id}}, "Kz$kennziffer"); |
|
1002 |
} |
|
1003 |
push(@{ $form->{amount}}, $form->{$kennziffer}); |
|
1004 |
} |
|
1005 |
} |
|
1006 |
|
|
1007 | 818 |
} elsif ( $form->{format} eq '' ){ # No format error. |
1008 | 819 |
$form->header; |
1009 | 820 |
USTVA::error( $locale->text('Application Error. No Format given' ) . "!"); |
Auch abrufbar als: Unified diff
2. Teil zu: Winston-Export, Taxbird-Export und Latex-Export für UstVA entfernt