Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 18942bd7

Von Udo Spallek vor fast 18 Jahren hinzugefügt

  • ID 18942bd70d66bd2348c6550887bc2994dfcaf358
  • Vorgänger 7643cf44
  • Nachfolger 635dd08d

USTVA: Patch zur besseren Unterstuetzung der oesterreichischen Verhaeltnisse.

Unterschiede anzeigen:

bin/mozilla/ustva.pl
740 740
    $form->{co_city} =~ s/\\n//g;
741 741
  }
742 742

  
743
  ################################
743 744
  #
744
  # Outputformat specific customisation's
745
  # Nation specific customisations
745 746
  #
747
  ################################
748
  
749
  # Germany
750
  
751
  if ( $form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU') {
752
      
753
    #
754
    # Outputformat specific customisation's
755
    #
746 756

  
747
  my @category_cent = qw(
748
    511 861 36   80   971  931  98   96   53   74
749
    85  65  66   61   62   67   63   64   59   69 
750
    39  83  811  891  Z43  Z45  Z53  Z62  Z65  Z67
751
    
752
  );
757
    my @category_cent = qw(
758
      511 861 36   80   971  931  98   96   53   74
759
      85  65  66   61   62   67   63   64   59   69 
760
      39  83  811  891  Z43  Z45  Z53  Z62  Z65  Z67
761
      
762
    );
753 763

  
754
  my @category_euro = qw(
755
    41 44 49 43 48 51 86 35 77 76 91 89
756
    97 93 95 94 42 60 45 52 73 84 81 
757
  );
758
  
759
  $form->{id} = [];
760
  $form->{amount} = [];
764
    my @category_euro = qw(
765
      41 44 49 43 48 51 86 35 77 76 91 89
766
      97 93 95 94 42 60 45 52 73 84 81 
767
    );
768
    
769
    $form->{id} = [];
770
    $form->{amount} = [];
761 771

  
762
  if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript') {
772
    if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript') {
763 773

  
764
    $form->{IN} = "$form->{type}-$form->{year}.tex";
765
    $form->{padding} = "~~";
766
    $form->{bold}    = "\textbf{";
767
    $form->{endbold} = "}";
768
    $form->{br}      = '\\\\';
774
      $form->{IN} = "$form->{type}-$form->{year}.tex";
775
      $form->{padding} = "~~";
776
      $form->{bold}    = "\textbf{";
777
      $form->{endbold} = "}";
778
      $form->{br}      = '\\\\';
769 779

  
770
    # Zahlenformatierung f?r Latex USTVA Formulare
780
      # Zahlenformatierung f?r Latex USTVA Formulare
771 781

  
772
    foreach my $number (@category_euro) {
773
      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '');
774
    }
782
      foreach my $number (@category_euro) {
783
        $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '');
784
      }
775 785

  
776
    my ${decimal_comma} = ( $myconfig{numberformat} eq '1.000,00'
777
         or $myconfig{numberformat} eq '1000,00' ) ? ',':'.';
786
      my ${decimal_comma} = ( $myconfig{numberformat} eq '1.000,00'
787
           or $myconfig{numberformat} eq '1000,00' ) ? ',':'.';
778 788

  
779
    foreach my $number (@category_cent) {
780
      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '');
781
      $form->{$number} =~ s/${decimal_comma}/~~/g;
782
    }
789
      foreach my $number (@category_cent) {
790
        $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '');
791
        $form->{$number} =~ s/${decimal_comma}/~~/g;
792
      }
783 793

  
784
  } elsif ( $form->{format} eq 'html') { # Formatierungen f?r HTML Ausgabe
794
    } elsif ( $form->{format} eq 'html') { # Formatierungen f?r HTML Ausgabe
785 795

  
786
    $form->{IN} = $form->{type} . '.html';
787
    $form->{padding} = "  ";
788
    $form->{bold}    = "<b>";
789
    $form->{endbold} = "</b>";
790
    $form->{br}      = "<br>";
791
    $form->{address} =~ s/\\n/\n/g;
796
      $form->{IN} = $form->{type} . '.html';
797
      $form->{padding} = "&nbsp;&nbsp;";
798
      $form->{bold}    = "<b>";
799
      $form->{endbold} = "</b>";
800
      $form->{br}      = "<br>";
801
      $form->{address} =~ s/\\n/\n/g;
792 802

  
793
    foreach $number (@category_cent) {
794
      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
795
    }
796
    
797
    foreach $number (@category_euro) {
798
      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
799
    }
803
      foreach $number (@category_cent) {
804
        $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
805
      }
806
      
807
      foreach $number (@category_euro) {
808
        $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
809
      }
800 810

  
801
  } elsif ( $form->{format} eq 'elsterwinston' ) {
811
    } elsif ( $form->{format} eq 'elsterwinston' ) {
802 812

  
803
    $form->{IN} = 'winston.xml';
804
    
805
    #
806
    # Build Winston filename
807
    #
808
    
809
    my $file = 'U';     # 1. char 'U' = USTVA
810
    $file .= $form->{period};
811
    #4. and 5. char = year modulo 100
812
    $file .= sprintf("%02d", $form->{year} % 100);
813
    #6. to 18. char = Elstersteuernummer
814
    #Beispiel: Steuernummer in Bayern
815
    #111/222/33334 ergibt f?r UStVA Jan 2004: U01049111022233334
816
    $file .= $form->{elsterFFFF};
817
    $file .= $form->{elstersteuernummer};
818
    #file suffix
819
    $file .= '.xml';
820
    $form->{tmpfile} = "$userspath/$file";
821

  
822
    $form->{attachment_filename} = "$file";
823
 
824
    # Zahlenformatierung f?r Winston
813
      $form->{IN} = 'winston.xml';
814
      
815
      #
816
      # Build Winston filename
817
      #
818
      
819
      my $file = 'U';     # 1. char 'U' = USTVA
820
      $file .= $form->{period};
821
      #4. and 5. char = year modulo 100
822
      $file .= sprintf("%02d", $form->{year} % 100);
823
      #6. to 18. char = Elstersteuernummer
824
      #Beispiel: Steuernummer in Bayern
825
      #111/222/33334 ergibt f?r UStVA Jan 2004: U01049111022233334
826
      $file .= $form->{elsterFFFF};
827
      $file .= $form->{elstersteuernummer};
828
      #file suffix
829
      $file .= '.xml';
830
      $form->{tmpfile} = "$userspath/$file";
831

  
832
      $form->{attachment_filename} = "$file";
833
   
834
      # Zahlenformatierung f?r Winston
835

  
836
      my $temp_numberformat = $myconfig{numberformat};
837

  
838
      # Numberformat must be '1000.00' for Winston
839

  
840
      $myconfig{numberformat} = '1000.00';
841

  
842
      foreach my $number (@category_cent) {
843
        $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
844
      }
845
      
846
      foreach my $number (@category_euro) {
847
        $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
848
      }
849
      # Re-set Numberformat
850
      $myconfig{numberformat} = $temp_numberformat;
825 851

  
826
    my $temp_numberformat = $myconfig{numberformat};
827 852

  
828
    # Numberformat must be '1000.00' for Winston
853
      # push Kennziffern to <%foreach Array fo easyer
854
      # output in xml format. Thx to Moritz.
855
      my %winston_id_for = (
856
       # No Winston remap?!
857
      );
858
            
829 859

  
830
    $myconfig{numberformat} = '1000.00';
860
      foreach my $kennziffer (@category_cent, @category_euro) {
831 861

  
832
    foreach my $number (@category_cent) {
833
      $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
834
    }
835
    
836
    foreach my $number (@category_euro) {
837
      $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
838
    }
839
    # Re-set Numberformat
840
    $myconfig{numberformat} = $temp_numberformat;
862
        next if ( $kennziffer =~ m/Z\d\d/);
863
        next if (   $form->{$kennziffer} == 0 );
864
        
865
        if (defined $winston_id_for{$kennziffer} ) {
866
          push(@{ $form->{id}}, $winston_id_for{$kennziffer});
867
        } else {
868
          push(@{ $form->{id}}, "$kennziffer"); 
869
        }
870
        push(@{ $form->{amount}}, $form->{$kennziffer});
871
      }    
841 872

  
842 873

  
843
    # push Kennziffern to <%foreach Array fo easyer
844
    # output in xml format. Thx to Moritz.
845
    my %winston_id_for = (
846
     # No Winston remap?!
847
    );
848
          
874
    } elsif ( $form->{format} eq 'elstertaxbird' ) {
849 875

  
850
    foreach my $kennziffer (@category_cent, @category_euro) {
876
      # Define serveral filenames
877
      $form->{IN} = 'taxbird.txb';
851 878

  
852
      next if ( $kennziffer =~ m/Z\d\d/);
853
      next if (   $form->{$kennziffer} == 0 );
879
      $form->{attachment_filename} = "USTVA-" . $form->{period} 
880
      . sprintf("%02d", $form->{year} % 100) . ".txb";
881
      
882
      $form->{tmpfile} = "$userspath/" . $form->{attachment_filename};
883

  
884
      # TODO: set Output to UTF-8 or system Preference
885
      #$form->{"iconv"} = Text::Iconv->new($myconfig{dbcharset}, "UTF-8");
886
      #my $iconv = $self->{"iconv"};
887
      #$iconv->convert($variable);
888
      if ($form->{period} =~ /^[4]\d$/ ){
889
        my %periods = ( # Lx => taxbird
890
                     '41' => '12',
891
                     '42' => '13',
892
                     '43' => '14',
893
                     '44' => '15',
894
                   );
854 895
      
855
      if (defined $winston_id_for{$kennziffer} ) {
856
        push(@{ $form->{id}}, $winston_id_for{$kennziffer});
896
        foreach my $quarter ( keys %periods ) {
897
          $form->{taxbird_period} = $periods{$quarter} if ( $form->{period} eq $quarter);
898
        }
899
      } elsif ($form->{period} =~ /^\d+$/ ) {
900
        $form->{period} =~ s/^0//g;
901
        my $period = $form->{period};
902
        $period * 1;
903
        $period--;
904
        $form->{period} = $period;
857 905
      } else {
858
        push(@{ $form->{id}}, "$kennziffer"); 
906
        $form->header;
907
        USTVA::error( $locale->text('Wrong Period' ));
908
        exit(0);
859 909
      }
860
      push(@{ $form->{amount}}, $form->{$kennziffer});
861
    }    
862

  
863

  
864
  } elsif ( $form->{format} eq 'elstertaxbird' ) {
910
      
911
      my %lands = ( # Lx => taxbird # TODO: besser als array...
912
                  'Baden W?rtemberg'       => '0',
913
                  'Bayern'                 => '1',
914
                  'Berlin'                 => '2',
915
                  'Brandenburg'            => '3',
916
                  'Bremen'                 => '4',
917
                  'Hamburg'                => '5',
918
                  'Hessen'                 => '6',
919
                  'Mecklenburg Vorpommern' => '7',
920
                  'Niedersachsen'          => '8',
921
                  'Nordrhein Westfalen'    => '9',
922
                  'Rheinland Pfalz'        => '10',
923
                  'Saarland'               => '11',
924
                  'Sachsen'                => '12',
925
                  'Sachsen Anhalt'         => '13',
926
                  'Schleswig Holstein'     => '14',
927
                  'Th?ringen'              => '15',
928
            );
929
      foreach my $land ( keys %lands ){
930
        $form->{taxbird_land_nr} = $lands{$land} if ($form->{elsterland} eq $land );
931
      }
932
      
933
      $form->{co_zip} = $form->{co_city};
934
      $form->{co_zip} =~ s/\D//g;
935
      $form->{co_city} =~ s/\d//g;
936
      $form->{co_city} =~ s/^\s//g;
937
      
938
      ($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel});
939
      $form->{co_phone_prefix} =~ s/\s//g;
940
      $form->{co_phone} =~ s/\s//g;
941
      
942
       $form->{taxbird_steuernummer} = $form->{steuernummer};
943
      #      $form->{taxbird_steuernummer} =~ s/\D//g;
944
      $form->{taxbird_steuernummer} =~ s/\///; # ersten Querstrich ersetzen
945
      
946
      # Numberformatting for Taxbird
947
      my $temp_numberformat = $myconfig{numberformat};
948
      # Numberformat must be '1000,00' for Taxbird ?!
949
      $myconfig{numberformat} = '1000,00';
950
      foreach my $number (@category_cent) {
951
        $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
952
      }
953
      
954
      foreach my $number (@category_euro) {
955
        $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
956
      }
957
      # Re-set Numberformat
958
      $myconfig{numberformat} = $temp_numberformat;
959
      
960
      # push Kennziffern to <%foreach Array fo easyer
961
      # output in xml format. Thx to Moritz.
962
      my %taxbird_id_for = (
963
           
964
          '511'  =>  'Kz51-calc',
965
          '861'  =>  'Kz86-calc',
966
          '971'  =>  'Kz97-calc',
967
          '931'  =>  'Kz93-calc',
968
          '811'  =>  'Kz81-calc',
969
          '891'  =>  'Kz89-calc',
970
          'Z45'  =>  'uebertrag',
971
          'Z53'  =>  'ust-sum',
972
          'Z62'  =>  'ust-minus-vost',
973
          'Z65'  =>  'ust-sum+69',
974
          'Z67'  =>  'ust-vz',
975
      );
976
            
977
      
978
      for my $kennziffer (@category_cent, @category_euro) {
865 979

  
866
    # Define serveral filenames
867
    $form->{IN} = 'taxbird.txb';
980
        next if ($kennziffer eq 'Z43');
868 981

  
869
    $form->{attachment_filename} = "USTVA-" . $form->{period} 
870
    . sprintf("%02d", $form->{year} % 100) . ".txb";
871
    
872
    $form->{tmpfile} = "$userspath/" . $form->{attachment_filename};
873

  
874
    # TODO: set Output to UTF-8 or system Preference
875
    #$form->{"iconv"} = Text::Iconv->new($myconfig{dbcharset}, "UTF-8");
876
    #my $iconv = $self->{"iconv"};
877
    #$iconv->convert($variable);
878
    if ($form->{period} =~ /^[4]\d$/ ){
879
      my %periods = ( # Lx => taxbird
880
                   '41' => '12',
881
                   '42' => '13',
882
                   '43' => '14',
883
                   '44' => '15',
884
                 );
885
    
886
      foreach my $quarter ( keys %periods ) {
887
        $form->{taxbird_period} = $periods{$quarter} if ( $form->{period} eq $quarter);
888
      }
889
    } elsif ($form->{period} =~ /^\d+$/ ) {
890
      $form->{period} =~ s/^0//g;
891
      my $period = $form->{period};
892
      $period * 1;
893
      $period--;
894
      $form->{period} = $period;
895
    } else {
982
        if ($form->{$kennziffer} != 0){
983
          if (defined $taxbird_id_for{$kennziffer}) {
984
            push(@{ $form->{id}}, $taxbird_id_for{$kennziffer});
985
          } else {
986
            push(@{ $form->{id}}, "Kz$kennziffer"); 
987
          }
988
          push(@{ $form->{amount}}, $form->{$kennziffer});
989
        }
990
      }    
991
      
992
    } elsif ( $form->{format} eq '' ){ # No format error.
896 993
      $form->header;
897
      USTVA::error( $locale->text('Wrong Period' ));
994
      USTVA::error( $locale->text('Application Error. No Format given' ) . "!");
995
      exit(0);
996
   
997
    } else { # All other Formats are wrong
998
      $form->header;
999
      USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} );
898 1000
      exit(0);
899 1001
    }
900
    
901
    my %lands = ( # Lx => taxbird # TODO: besser als array...
902
                'Baden W?rtemberg'       => '0',
903
                'Bayern'                 => '1',
904
                'Berlin'                 => '2',
905
                'Brandenburg'            => '3',
906
                'Bremen'                 => '4',
907
                'Hamburg'                => '5',
908
                'Hessen'                 => '6',
909
                'Mecklenburg Vorpommern' => '7',
910
                'Niedersachsen'          => '8',
911
                'Nordrhein Westfalen'    => '9',
912
                'Rheinland Pfalz'        => '10',
913
                'Saarland'               => '11',
914
                'Sachsen'                => '12',
915
                'Sachsen Anhalt'         => '13',
916
                'Schleswig Holstein'     => '14',
917
                'Th?ringen'              => '15',
918
          );
919
    foreach my $land ( keys %lands ){
920
      $form->{taxbird_land_nr} = $lands{$land} if ($form->{elsterland} eq $land );
921
    }
922
    
923
    $form->{co_zip} = $form->{co_city};
924
    $form->{co_zip} =~ s/\D//g;
925
    $form->{co_city} =~ s/\d//g;
926
    $form->{co_city} =~ s/^\s//g;
927
    
928
    ($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel});
929
    $form->{co_phone_prefix} =~ s/\s//g;
930
    $form->{co_phone} =~ s/\s//g;
931
    
932
     $form->{taxbird_steuernummer} = $form->{steuernummer};
933
    #      $form->{taxbird_steuernummer} =~ s/\D//g;
934
    $form->{taxbird_steuernummer} =~ s/\///; # ersten Querstrich ersetzen
935
    
936
    # Numberformatting for Taxbird
937
    my $temp_numberformat = $myconfig{numberformat};
938
    # Numberformat must be '1000,00' for Taxbird ?!
939
    $myconfig{numberformat} = '1000,00';
940
    foreach my $number (@category_cent) {
941
      $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
942
    }
943
    
944
    foreach my $number (@category_euro) {
945
      $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
946
    }
947
    # Re-set Numberformat
948
    $myconfig{numberformat} = $temp_numberformat;
949
    
950
    # push Kennziffern to <%foreach Array fo easyer
951
    # output in xml format. Thx to Moritz.
952
    my %taxbird_id_for = (
953
         
954
        '511'  =>  'Kz51-calc',
955
        '861'  =>  'Kz86-calc',
956
        '971'  =>  'Kz97-calc',
957
        '931'  =>  'Kz93-calc',
958
        '811'  =>  'Kz81-calc',
959
        '891'  =>  'Kz89-calc',
960
        'Z45'  =>  'uebertrag',
961
        'Z53'  =>  'ust-sum',
962
        'Z62'  =>  'ust-minus-vost',
963
        'Z65'  =>  'ust-sum+69',
964
        'Z67'  =>  'ust-vz',
1002

  
1003
  # Austria
1004
  } elsif ($form->{coa} eq 'Austria') {
1005

  
1006
    #
1007
    # Outputformat specific customisation's
1008
    #
1009

  
1010
    my @category_euro = qw(
1011
      511 861 36   80   971  931  98   96   53   74
1012
      85  65  66   61   62   67   63   64   59   69 
1013
      39  83  811  891  Z43  Z45  Z53  Z62  Z65  Z67
1014
      41 44 49 43 48 51 86 35 77 76 91 89
1015
      97 93 95 94 42 60 45 52 73 84 81 
965 1016
    );
966
          
967 1017
    
968
    for my $kennziffer (@category_cent, @category_euro) {
969 1018

  
970
      next if ($kennziffer eq 'Z43');
1019
    if ( $form->{format} eq 'html') { # Formatierungen f?r HTML Ausgabe
971 1020

  
972
      if ($form->{$kennziffer} != 0){
973
        if (defined $taxbird_id_for{$kennziffer}) {
974
          push(@{ $form->{id}}, $taxbird_id_for{$kennziffer});
975
        } else {
976
          push(@{ $form->{id}}, "Kz$kennziffer"); 
977
        }
978
        push(@{ $form->{amount}}, $form->{$kennziffer});
1021
      $form->{IN} = $form->{type} . '.html';
1022
      $form->{padding} = "&nbsp;&nbsp;";
1023
      $form->{bold}    = "<b>";
1024
      $form->{endbold} = "</b>";
1025
      $form->{br}      = "<br>";
1026
      $form->{address} =~ s/\\n/\n/g;
1027

  
1028
      foreach $number (@category_euro) {
1029
        $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
979 1030
      }
980
    }    
1031
    }
981 1032
    
982
  } elsif ( $form->{format} eq '' ){ # No format error.
983
    $form->header;
984
    USTVA::error( $locale->text('Application Error. No Format given' ) . "!");
985
    exit(0);
986
 
987
  } else { # All other Formats are wrong
988
    $form->header;
989
    USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} );
990
    exit(0);
991 1033
  }
992 1034

  
1035
  # end nation specific customisations
993 1036
  
994 1037
  if ( $form->{period} eq '13' and $form->{format} ne 'html') {
995 1038
    $form->header;

Auch abrufbar als: Unified diff