X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDATEV.pm;h=f53e9fcc92554d4a3c37591b72dab896710f85a3;hb=9475cae8f0ea21e5f69d28ee71f835cd4ac8a64d;hp=c202e05e28ac1fd7fb9bfea05f77edaf1fc1f0c3;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/SL/DATEV.pm b/SL/DATEV.pm index c202e05e2..f53e9fcc9 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -256,10 +256,16 @@ sub get_transactions { $sth->execute || $form->dberror($query); $i = 0; $g = 0; + my $counter = 0; @splits; while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { $count = 0; $firstrun = 1; + $counter++; + if (($counter % 500) == 0) { + print("$counter "); + } + $count += $ref->{amount}; push @{$i}, $ref; while (abs($count) > 0.01 || $firstrun) { @@ -587,13 +593,21 @@ sub kne_buchungsexport { my $evfile = "EV01"; my @ed_versionsets; my $fileno = 0; + + $form->header; + print qq| + + Export in Bearbeitung
+ Buchungssätze verarbeitet: +|; $fromto = &get_dates($form->{zeitraum}, $form->{monat}, $form->{quartal}, $form->{transdatefrom}, $form->{transdateto}); &get_transactions($myconfig, $form, $fromto); - + my $counter = 0; + print qq|
2. Durchlauf:|; while (scalar(@{ $form->{DATEV} })) { my $blockcount = 1; my $remaining_bytes = 256; @@ -609,6 +623,11 @@ sub kne_buchungsexport { while (scalar(@{ $form->{DATEV} }) > 0) { $transaction = shift @{ $form->{DATEV} }; $trans_lines = scalar(@{$transaction}); + $counter++; + if (($counter % 500) == 0) { + print("$counter "); + } + $umsatz = 0; $gegenkonto = ""; $konto = ""; @@ -629,8 +648,14 @@ sub kne_buchungsexport { 'ß' => 'sz'); for (my $i = 0; $i < $trans_lines; $i++) { - if (abs($transaction->[$i]->{'umsatz'}) > abs($umsatz)) { - $umsatz = $transaction->[$i]->{'umsatz'}; + if ($trans_lines == 2) { + if (abs($transaction->[$i]->{'amount'}) > abs($umsatz)) { + $umsatz = $transaction->[$i]->{'amount'}; + } + } else { + if (abs($transaction->[$i]->{'umsatz'}) > abs($umsatz)) { + $umsatz = $transaction->[$i]->{'umsatz'}; + } } if ($transaction->[$i]->{'datevautomatik'}) { $datevautomatik = 1; @@ -651,7 +676,7 @@ sub kne_buchungsexport { } } - $umsatzsumme += $umsatz; + $umsatzsumme += abs($umsatz); # Umwandlung von Umlauten und Sonderzeichen in erlaubte Zeichen bei Textfeldern foreach $umlaut (keys(%umlaute)) { @@ -696,6 +721,7 @@ sub kne_buchungsexport { $blockcount++; $total_bytes = ($blockcount) * 256; } + $umsatz = abs($umsatz); $vorzeichen = ($umsatz > 0) ? "+" : "-"; $buchungssatz .= $vorzeichen . &formatumsatz($umsatz, 0); $remaining_bytes = $total_bytes - length($buchungssatz . $header); @@ -808,6 +834,9 @@ sub kne_buchungsexport { print(EV $ed_versionset[$file]); } close(EV); +print qq|
Done.
+ +|; ### $main::lxdebug->leave_sub(); }