X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FDATEV.pm;h=c83112feac8a46affab33e50b53a193f8132b648;hb=15d5b55d84399cc17b24c7800a5faeeb02a665bf;hp=36fe80dbaaf178075a734d126720b59c7a75f92c;hpb=8d19aa002666b22761822ba2fdc8be4ee204c5f1;p=kivitendo-erp.git diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 36fe80dba..c83112fea 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -83,17 +83,17 @@ sub kne_export { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; - my $rc; + my @rc; if ($form->{exporttype} == 0) { - $rc = &kne_buchungsexport($myconfig, $form); + @rc = &kne_buchungsexport($myconfig, $form); } else { - $rc = &kne_stammdatenexport($myconfig, $form); + @rc = &kne_stammdatenexport($myconfig, $form); } $main::lxdebug->leave_sub(); - return $rc; + return @rc; } sub obe_export { @@ -329,7 +329,7 @@ sub get_transactions { } } if (abs($absumsatz) > 0.01) { - $form->error("Datev-Export fehlgeschlagen!"); + $form->error("Datev-Export fehlgeschlagen! Bei Transaktion $i->[0]->{trans_id}\n"); } } else { push @{ $form->{DATEV} }, \@{$i}; @@ -391,7 +391,7 @@ sub make_kne_data_header { $to =~ s/ //g; if ($from ne "") { - my ($fday, $fmonth, $fyear) = split /\./, $from; + my ($fday, $fmonth, $fyear) = split(/\./, $from); if (length($fmonth) < 2) { $fmonth = "0" . $fmonth; } @@ -406,7 +406,7 @@ sub make_kne_data_header { $header .= $from; if ($to ne "") { - my ($tday, $tmonth, $tyear) = split /\./, $to; + my ($tday, $tmonth, $tyear) = split(/\./, $to); if (length($tmonth) < 2) { $tmonth = "0" . $tmonth; } @@ -470,7 +470,7 @@ sub datetofour { my ($date, $six) = @_; - ($day, $month, $year) = split /\./, $date; + ($day, $month, $year) = split(/\./, $date); if ($day =~ /^0/) { $day = substr($day, 1, 1); @@ -499,7 +499,7 @@ sub formatumsatz { my ($umsatz, $stellen) = @_; $umsatz =~ s/-//; - ($vorkomma, $nachkomma) = split /\./, $umsatz; + ($vorkomma, $nachkomma) = split(/\./, $umsatz); $umsatz = ""; if ($stellen > 0) { for ($i = $stellen; $i >= $stellen + 2 - length($vorkomma); $i--) { @@ -583,12 +583,14 @@ sub kne_buchungsexport { my ($myconfig, $form) = @_; - my $export_path = "datev/"; + my @filenames; + + my $export_path = $main::userspath . "/"; my $filename = "ED00000"; my $evfile = "EV01"; my @ed_versionsets; my $fileno = 0; - + $form->header; print qq| @@ -611,13 +613,14 @@ sub kne_buchungsexport { my $buchungssatz = ""; $filename++; my $ed_filename = $export_path . $filename; + push(@filenames, $filename); open(ED, "> $ed_filename") or die "can't open outputfile: $!\n"; $header = &make_kne_data_header($myconfig, $form, $fromto); $remaining_bytes -= length($header); while (scalar(@{ $form->{DATEV} }) > 0) { - $transaction = shift @{ $form->{DATEV} }; - $trans_lines = scalar(@{$transaction}); + $transaction = shift @{ $form->{DATEV} }; + $trans_lines = scalar(@{$transaction}); $counter++; if (($counter % 500) == 0) { print("$counter "); @@ -822,6 +825,7 @@ sub kne_buchungsexport { #Make EV Verwaltungsdatei $ev_header = &make_ev_header($form, $fileno); $ev_filename = $export_path . $evfile; + push(@filenames, $evfile); open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n"; print(EV $ev_header); @@ -829,11 +833,12 @@ sub kne_buchungsexport { print(EV $ed_versionset[$file]); } close(EV); -print qq|
Done.
- + print qq|
Done.
|; ### $main::lxdebug->leave_sub(); + + return @filenames; } sub kne_stammdatenexport { @@ -842,7 +847,15 @@ sub kne_stammdatenexport { my ($myconfig, $form) = @_; $form->{abrechnungsnr} = "99"; - my $export_path = "datev/"; + $form->header; + print qq| + + Export in Bearbeitung
+|; + + my @filenames; + + my $export_path = $main::userspath . "/"; my $filename = "ED00000"; my $evfile = "EV01"; my @ed_versionsets; @@ -854,6 +867,7 @@ sub kne_stammdatenexport { my $buchungssatz = ""; $filename++; my $ed_filename = $export_path . $filename; + push(@filenames, $filename); open(ED, "> $ed_filename") or die "can't open outputfile: $!\n"; $header = &make_kne_data_header($myconfig, $form, ""); $remaining_bytes -= length($header); @@ -865,8 +879,7 @@ sub kne_stammdatenexport { qq|SELECT c.accno, c.description FROM chart c WHERE c.accno >=| . $dbh->quote($form->{accnofrom}) . qq| AND c.accno <= | - . $dbh->quote($form->{accnoto}) - . qq| ORDER BY c.accno|; + . $dbh->quote($form->{accnoto}) . qq| ORDER BY c.accno|; $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); @@ -912,6 +925,7 @@ sub kne_stammdatenexport { $ev_header = &make_ev_header($form, $fileno); $ev_filename = $export_path . $evfile; + push(@filenames, $evfile); open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n"; print(EV $ev_header); @@ -923,7 +937,12 @@ sub kne_stammdatenexport { $dbh->disconnect; ### + print qq|
Done.
+|; + $main::lxdebug->leave_sub(); + + return @filenames; } 1;