Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 77b081a5

Von Jan Büren vor 11 Monaten hinzugefügt

  • ID 77b081a5565f0b5444eb5cfdc9208747d227a3d5
  • Vorgänger 1dd06079
  • Nachfolger ee75882d

DATEV: Belegexport -> Eine Buchung darf mehrere Belege haben und ...

Filter für nicht Buchungsdokumente (trans_id ist nur in ar, ap und gl
eindeutig).

Unterschiede anzeigen:

SL/DATEV.pm
895 895
    my $taxkey         = 0;
896 896
    my $charttax       = 0;
897 897
    my $ustid          ="";
898
    my $document_guid  ="";
899 898
    my ($haben, $soll);
900 899
    for (my $i = 0; $i < $trans_lines; $i++) {
901 900
      if ($trans_lines == 2) {
......
984 983
    # set lock for each transaction
985 984
    $datev_data{locked} = $self->locked;
986 985
    # add guids if datev export with documents is requested
987
    if ($self->documents) {
988
      # add exactly one document link for the latest created/uploaded document
989
      my $latest_document = SL::DB::Manager::File->get_first(query =>
986
    # no records for bank transactions with ar or ap
987
    # die Dumper($transaction->[$haben]->{link}) if $transaction->[$haben]->{link} =~ m/paid/;
988
    if (   $self->documents && ($transaction->[$haben]->{table} eq 'gl'
989
        || ($datev_data{konto} !~ m/(1810|1370)/ && $datev_data{gegenkonto} !~ m/(1810|1370)/ )) ) {
990
      # add all document links for the latest created/uploaded document
991
      my $latest_documents = SL::DB::Manager::File->get_all(query =>
990 992
                                [
991
                                  object_id => $transaction->[$haben]->{trans_id},
992
                                  file_type => 'document'
993
                                  object_id   => $transaction->[$haben]->{trans_id},
994
                                  file_type   => 'document',
995
                                  or          => [
996
                                                   object_type => 'gl_transaction',
997
                                                   object_type => 'purchase_invoice',
998
                                                   object_type => 'invoice',
999
                                                   object_type => 'credit_note',
1000
                                                 ],
993 1001
                                ],
994 1002
                                  sort_by   => 'itime DESC');
995
      if (ref $latest_document eq 'SL::DB::File') {
1003
      #if (ref $latest_document eq 'SL::DB::File') {
1004
      if (scalar @{ $latest_documents }) {
996 1005
        # if we have a booking document add guid from the latest version
997
        $datev_data{document_guid} = $latest_document->file_version->[-1]->guid;
998
        push @{ $self->{guids} }, $datev_data{document_guid};
1006
        # one record may be referenced to more transaction (credit booking with different accounts)
1007
        # therefore collect guids in hash
1008
        foreach my $latest_document (@{ $latest_documents }) {
1009
          die "No file datatype:" . ref $latest_document unless (ref $latest_document eq 'SL::DB::File');
1010
          my $latest_guid = $latest_document->file_version->[-1]->guid;
1011

  
1012
          $self->{guids}{$latest_guid} = 1;
1013
          $datev_data{document_guid}  .= $datev_data{document_guid} ?  ',' : '';
1014
          $datev_data{document_guid}  .= $latest_guid;
1015
        }
999 1016
      }
1000 1017
    }
1001 1018
    push(@datev_lines, \%datev_data) if $datev_data{umsatz};
SL/DATEV/CSV.pm
160 160
                                                      # "8DB85C02-4CC3-FF3E-06D7-7F87EEECCF3A".
161 161
                              type            => 'Text',
162 162
                              default         => '',
163
                              input_check     => sub { my ($check) = @_; return 1 unless $check; return ($check =~ m/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/) },
164
                              formatter       => sub { my ($input) = @_; return '' unless $input; return 'BEDI "' . $input . '"' },
163
                              input_check     => sub { my ($check) = @_; return 1 unless $check;
164
                                                       my @guids = split(/,/,$check);
165
                                                       foreach my $guid (@guids) {
166
                                                         return unless ($guid =~ m/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/);
167
                                                       }
168
                                                       return 1; },
169
                              formatter       => sub { my ($input) = @_; return '' unless $input;
170
                                                       my @guids = split (/,/,$input);
171
                                                       my $first = shift @guids;
172
                                                       my $bedi = 'BEDI "' . $first . '"';
173
                                                       foreach my $guid (@guids) {
174
                                                         $bedi .= ',"' . $guid . '"';
175
                                                       }
176
                                                       return $bedi; },
165 177

  
166 178
                            }, # pos 20
167 179
                            {

Auch abrufbar als: Unified diff