Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6ab3da45

Von Udo Spallek vor fast 18 Jahren hinzugefügt

  • ID 6ab3da458ff5a2be533e0ae1fdde6a6dbd9ef93f
  • Vorgänger aa1102e9
  • Nachfolger 5ebbc846

- Bugfix: 499, 502, 442
- Zahlenformatierung wird nun getrennt nach Ausgabeformat durchgefuehrt
- Verbesserter bei Taxbirdexport

Unterschiede anzeigen:

bin/mozilla/ustva.pl
77 77
  $form->{title} = $locale->text('UStVA');
78 78
  $form->{kz10}  = '';                       #Berichtigte Anmeldung? Ja =1 Nein=0
79 79

  
80
  my $year = substr(
81
                    $form->datetonum($form->current_date(\%myconfig),
82
                                     \%myconfig
83
                    ),
84
                    0, 4);
80
  my $year = substr($form->datetonum($form->current_date(\%myconfig), \%myconfig ),
81
             0, 4);
85 82

  
86 83
  my $department = '';
87 84
  local $hide = '';
88 85
  $form->header;
89 86

  
90 87
  print qq|
91
<body>
92
<form method=post action=$form->{script}>
88
 <body>
89
 <form method=post action=$form->{script}>
93 90

  
94
<input type=hidden name=title value="$form->{title}">
91
 <input type=hidden name=title value="$form->{title}">
95 92

  
96
<table width=100%>
93
 <table width=100%>
97 94
  <tr>
98 95
    <th class=listtop>$form->{title}</th>
99 96
  </tr>
......
102 99
    <td>
103 100
      <table>
104 101
      $department
105
|;
102
 |;
106 103

  
107 104
  # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
108 105
  # Einlesen der Finanzamtdaten
......
656 653
  SWITCH: {
657 654
      $yymmdd <= ($yy + 110 + $dfv) && do {
658 655
        $form->{year} = $form->{year} - 1;
659
        $sel = 'D';
656
        $sel = '44';
660 657
        last SWITCH;
661 658
      };
662 659
      $yymmdd <= ($yy + 410 + $dfv) && do {
663
        $sel = 'A';
660
        $sel = '41';
664 661
        last SWITCH;
665 662
      };
666 663
      $yymmdd <= ($yy + 710 + $dfv) && do {
667
        $sel = 'B';
664
        $sel = '42';
668 665
        last SWITCH;
669 666
      };
670 667
      $yymmdd <= ($yy + 1010 + $dfv) && do {
671
        $sel = 'C';
668
        $sel = '43';
672 669
        last SWITCH;
673 670
      };
674 671
      $yymmdd <= ($yy + 1231) && do {
675
        $sel = 'D';
672
        $sel = '44';
676 673
      };
677 674
    }
678 675

  
......
794 791

  
795 792
  get_config($userspath, 'finanzamt.ini');
796 793

  
797
  # form vars initialisieren
794
  # init some form vars
798 795
  my @anmeldungszeitraum =
799 796
    qw('0401' '0402' '0403' '0404' '0405' '0405' '0406' '0407' '0408' '0409' '0410' '0411' '0412' '0441' '0442' '0443' '0444');
800 797
  foreach my $item (@anmeldungszeitraum) {
......
812 809
                        qq|Actual year from Database: $form->{year}\n|);
813 810
    }
814 811

  
812
    #
813
    # using dates in ISO-8601 format: yyyymmmdd  for Postgres...
814
    #
815
    
815 816
    #yearly report
816 817
    if ($form->{period} eq "13") {
817 818
      $form->{fromdate} = "$form->{year}0101";
......
919 920
      };
920 921
    }
921 922

  
922
  # using dates in ISO-8601 format: yyyymmmdd  for Postgres...
923

  
924

  
925

  
926
  # Get the USTVA
923 927
  USTVA->ustva(\%myconfig, \%$form);
924 928

  
925 929
  # reformat Dates to dateformat
926 930
  $form->{fromdate} = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
927 931

  
928
  $form->{todate} = $form->current_date($myconfig) unless $form->{todate};
932
  $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
929 933
  $form->{todate} = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0);
930 934

  
931 935
  $form->{longperiod} =
......
972 976
    $locale->date(\%myconfig, $form->current_date(\%myconfig), 0, 0, 0);
973 977

  
974 978
  # setup variables for the form
975
  # steuernummer f?r prerelease entfernt
976 979
  my @a = qw(company businessnumber tel fax email
977 980
    co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
978 981
    co_name1 co_name2  co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2
......
989 992
    $form->{co_city} =~ s/\\n//g;
990 993
  }
991 994

  
995
  #
996
  # Outputformat specific customisation's
997
  #
998

  
999
  my @category_cent = qw(511 861 36 80 971 931 98 96 53 74
1000
    85 65 66 61 62 67 63 64 59 69 39 83
1001
    Z43 Z45 Z53 Z62 Z65 Z67);
1002

  
1003
  my @category_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93
1004
    95 94 42 60 45 52 73 84);
1005

  
992 1006
  if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript') {
993 1007

  
994 1008
    $form->{IN} = "$form->{type}-$form->{year}.tex";
995

  
996 1009
    $form->{padding} = "~~";
997 1010
    $form->{bold}    = "\textbf{";
998 1011
    $form->{endbold} = "}";
999 1012
    $form->{br}      = '\\\\';
1000 1013

  
1001
    my @numbers = qw(511 861 36 80 971 931 98 96 53 74
1002
      85 65 66 61 62 Z67 63 64 59 69 39 83
1003
      Z43 Z45 Z53 Z62 Z65);
1004

  
1005
    my $number = '';
1006

  
1007 1014
    # Zahlenformatierung f?r Latex USTVA Formulare
1008
    if (   $myconfig{numberformat} eq '1.000,00'
1009
           or $myconfig{numberformat} eq '1000,00') {
1010
      foreach $number (@numbers) {
1011
        $form->{$number} =~ s/,/~~/g;
1012
      }
1013
    }
1014
    if (   $myconfig{numberformat} eq '1000.00'
1015
        or $myconfig{numberformat} eq '1,000.00') {
1016
      foreach $number (@numbers) {
1017
        $form->{$number} =~ s/\./~~/g;
1018
      }
1015

  
1016
    foreach my $number (@category_euro) {
1017
      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '');
1019 1018
    }
1020
    if ( $form->{period} eq '13'){ #Catch yearly USTE for now, not yet implemented.
1021
      $form->header;
1022
      USTVA::error(
1023
        $locale->text(
1024
        'Impossible to create yearly Tax Report as PDF or Postscript<br \> Not yet implemented!'
1025
        )
1026
      );
1019

  
1020
    my ${decimal_comma} = ( $myconfig{numberformat} eq '1.000,00'
1021
         or $myconfig{numberformat} eq '1000,00' ) ? ',':'.';
1022

  
1023
    foreach my $number (@category_cent) {
1024
      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '');
1025
      $form->{$number} =~ s/${decimal_comma}/~~/g;
1027 1026
    }
1028
      
1027

  
1029 1028
  } elsif ( $form->{format} eq 'html') { # Formatierungen f?r HTML Ausgabe
1030 1029

  
1031 1030
    $form->{IN} = $form->{type} . '.html';
......
1035 1034
    $form->{br}      = "<br>";
1036 1035
    $form->{address} =~ s/\\n/\n/g;
1037 1036

  
1038
  } elsif ($form->{format} =~ /^elster/) {
1039

  
1040
    if ( $form->{period} eq '13' ) {
1041
      $form->header;
1042
      USTVA::info(
1043
        $locale->text(
1044
        'Impossible to create yearly Tax Report via Winston or Taxbird.<br \> Not yet implemented!'
1045
      ));
1037
    foreach $number (@category_cent) {
1038
      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
1046 1039
    }
1040
    
1041
    foreach $number (@category_euro) {
1042
      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
1043
    }
1044

  
1045
  } elsif ( $form->{format} eq 'elsterwinston' ) {
1046

  
1047
    $form->{IN} = 'winston.xml';
1048
    
1049
    #
1050
    # Build Winston filename
1051
    #
1052
    
1053
    my $file = 'U';     # 1. char 'U' = USTVA
1054
    $file .= $form->{period};
1055
    #4. and 5. char = year modulo 100
1056
    $file .= sprintf("%02d", $form->{year} % 100);
1057
    #6. to 18. char = Elstersteuernummer
1058
    #Beispiel: Steuernummer in Bayern
1059
    #111/222/33334 ergibt f?r UStVA Jan 2004: U01049111022233334
1060
    $file .= $form->{elsterFFFF};
1061
    $file .= $form->{elstersteuernummer};
1062
    #file suffix
1063
    $file .= '.xml';
1064
    $form->{tmpfile} = "$userspath/$file";
1065

  
1066
    $form->{attachment_filename} = "$file";
1067
 
1068
    # Zahlenformatierung f?r Winston
1069

  
1070
    my $temp_numberformat = $myconfig{numberformat};
1047 1071

  
1048
    if ( $form->{format} eq 'elsterwinston' ) {
1049

  
1050
      $form->{IN} = 'winston.xml';
1051
     
1052
      # Build Winston filename
1053
      my $file = 'U';     # 1. char 'U' = USTVA
1054
      $file .= $form->{period};
1055
      #4. and 5. char = year modulo 100
1056
      $file .= sprintf("%02d", $form->{year} % 100);
1057
      #6. to 18. char = Elstersteuernummer
1058
      #Beispiel: Steuernummer in Bayern
1059
      #111/222/33334 ergibt f?r UStVA Jan 2004: U01049111022233334
1060
      $file .= $form->{elsterFFFF};
1061
      $file .= $form->{elstersteuernummer};
1062
      #file suffix
1063
      $file .= '.xml';
1064
      $form->{tmpfile} = "$userspath/$file";
1072
    # Numberformat must be '1000.00' for Winston
1073

  
1074
    $myconfig{numberformat} = '1000.00';
1075

  
1076
    foreach my $number (@category_cent) {
1077
      $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
1078
    }
1079
    
1080
    foreach my $number (@category_euro) {
1081
      $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
1065 1082
    }
1083
    # Re-set Numberformat
1084
    $myconfig{numberformat} = $temp_numberformat;
1066 1085

  
1067
    if ( $form->{format} eq 'elstertaxbird' ) {
1086
  }
1087

  
1088
  elsif ( $form->{format} eq 'elstertaxbird' ) {
1068 1089

  
1069
      $form->{IN} = 'taxbird.txb';
1070
     
1071
      $form->{tmpfile} = "$userspath/USTVA-" . $form->{period} 
1072
      . sprintf("%02d", $form->{year} % 100) . ".txb";
1090
    $form->{IN} = 'taxbird.txb';
1073 1091

  
1074
      if ($form->{period} =~ /^[4]\d$/ ){
1075
        my %periods = ( # Lx => taxbird
1076
                     '41' => '12',
1077
                     '42' => '13',
1078
                     '43' => '14',
1079
                     '44' => '15',
1080
                   );
1092
    $form->{attachment_filename} = "USTVA-" . $form->{period} 
1093
    . sprintf("%02d", $form->{year} % 100) . ".txb";
1094
    
1095
    $form->{tmpfile} = "$userspath/" . $form->{attachment_filename};
1096

  
1097
    if ($form->{period} =~ /^[4]\d$/ ){
1098
      my %periods = ( # Lx => taxbird
1099
                   '41' => '12',
1100
                   '42' => '13',
1101
                   '43' => '14',
1102
                   '44' => '15',
1103
                 );
1104
    
1105
      foreach my $quarter ( keys %periods ) {
1106
        $form->{taxbird_period} = $periods{$quarter} if ( $form->{period} eq $quarter);
1107
      }
1108
      
1109
      my %lands = ( # Lx => taxbird # TODO: besser als array...
1110
                  'Baden W?rtemberg'       => '0',
1111
                  'Bayern'                 => '1',
1112
                  'Berlin'                 => '2',
1113
                  'Brandenburg'            => '3',
1114
                  'Bremen'                 => '4',
1115
                  'Hamburg'                => '5',
1116
                  'Hessen'                 => '6',
1117
                  'Mecklenburg Vorpommern' => '7',
1118
                  'Niedersachsen'          => '8',
1119
                  'Nordrhein Westfalen'    => '9',
1120
                  'Rheinland Pfalz'        => '10',
1121
                  'Saarland'               => '11',
1122
                  'Sachsen'                => '12',
1123
                  'Sachsen Anhalt'         => '13',
1124
                  'Schleswig Holstein'     => '14',
1125
                  'Th?ringen'              => '15',
1126
            );
1127

  
1128
      foreach my $land ( keys %lands ){
1129
        $form->{taxbird_land_nr} = $lands{$land} if ($form->{elsterland} eq $land );
1130
      }
1081 1131
      
1082
        foreach my $quarter ( keys %periods ) {
1083
          $form->{period} = $periods{$quarter} if ( $form->{period} eq $quarter);
1084
        }
1085
        
1086
        my %lands = ( # Lx => taxbird # TODO: besser als array...
1087
                    'Baden W?rtemberg'       => '0',
1088
                    'Bayern'                 => '1',
1089
                    'Berlin'                 => '2',
1090
                    'Brandenburg'            => '3',
1091
                    'Bremen'                 => '4',
1092
                    'Hamburg'                => '5',
1093
                    'Hessen'                 => '6',
1094
                    'Mecklenburg Vorpommern' => '7',
1095
                    'Niedersachsen'          => '8',
1096
                    'Nordrhein Westfalen'    => '9',
1097
                    'Rheinland Pfalz'        => '10',
1098
                    'Saarland'               => '11',
1099
                    'Sachsen'                => '12',
1100
                    'Sachsen Anhalt'         => '13',
1101
                    'Schleswig Holstein'     => '14',
1102
                    'Th?ringen'              => '15',
1103
              );
1104

  
1105

  
1106
        foreach my $land ( keys %lands ){
1107
          $form->{elsterland} = $lands{$land} if ($form->{elsterland} eq $land );
1108
        }
1109
      } elsif ($form->{period} =~ /^\d+$/ ) {
1110
        $form->{period} =~ s/^0//g;
1111
        my $period = $form->{period};
1112
        $period * 1;
1113
        $period--;
1114
        $form->{period} = $period;
1115
       } else {
1116
         $form->header;
1117
         USTVA::error( $locale->text('Wrong Period' ));
1118
         exit(0);
1119
                
1120
       }
1132
      $form->{taxbird_steuernummer} = $form->{steuernummer};
1133
      $form->{taxbird_steuernummer} =~ s/\D//g;
1121 1134
      
1135
      $form->{co_zip} = $form->{co_city};
1136
      $form->{co_zip} =~ s/\D//g;
1137
      $form->{co_city} =~ s/\d//g;
1138
      $form->{co_city} =~ s/^\s//g;
1139
      
1140
      ($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel});
1141
      
1142
      # Numberformatting for Taxbird
1143

  
1144
      my $temp_numberformat = $myconfig{numberformat};
1145
      # Numberformat must be '1000.00' for Taxbird ?!
1146

  
1147
      $myconfig{numberformat} = '1000.00';
1148

  
1149
      foreach my $number (@category_cent) {
1150
        $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
1151
      }
1152
      
1153
      foreach my $number (@category_euro) {
1154
        $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
1155
      }
1156
      # Re-set Numberformat
1157
      $myconfig{numberformat} = $temp_numberformat;
1158
      
1159
    } elsif ($form->{period} =~ /^\d+$/ ) {
1160
      $form->{period} =~ s/^0//g;
1161
      my $period = $form->{period};
1162
      $period * 1;
1163
      $period--;
1164
      $form->{period} = $period;
1165
    } else {
1166
      $form->header;
1167
      USTVA::error( $locale->text('Wrong Period' ));
1168
      exit(0);
1122 1169
    }
1123
    # Other Elster formats follow here...
1124 1170
    
1125 1171
  } elsif ( $form->{format} eq '' ){ # No format error.
1126 1172
    $form->header;
......
1132 1178
    USTVA::error( $locale->text('Application Error. Wrong Format: ') . $form->{format} );
1133 1179
    exit(0);
1134 1180
  }
1181

  
1182
  if ( $form->{period} eq '13' and $form->{format} ne 'html') {
1183
    $form->header;
1184
    USTVA::info(
1185
      $locale->text(
1186
      'Yearly taxreport not yet implemented')
1187
      . '!');
1188
  }
1135 1189
    
1136
  
1137 1190
  $form->{templates} = $myconfig{templates};
1138 1191
  $form->{templates} = "doc" if ( $form->{type} eq 'help' );
1139 1192

  
1140
  $form->parse_template($myconfig, $userspath);
1193
  $form->parse_template(\%myconfig, $userspath);
1141 1194

  
1142 1195
  $lxdebug->leave_sub();
1143 1196
}

Auch abrufbar als: Unified diff