package DATEV;
-use List::Util qw(max);
+use utf8;
+use strict;
use SL::DBUtils;
use SL::DATEV::KNEFile;
use Data::Dumper;
use File::Path;
+use List::Util qw(max);
use Time::HiRes qw(gettimeofday);
-use strict;
-
sub _get_export_path {
$main::lxdebug->enter_sub();
my $path;
if ($token =~ m|^(\d+)-(\d+)-(\d+)$|) {
- $path = "${main::userspath}/datev-export-${1}-${2}-${3}";
+ $path = $::lx_office_conf{paths}->{userspath} . "/datev-export-${1}-${2}-${3}";
}
$main::lxdebug->leave_sub();
sub clean_temporary_directories {
$main::lxdebug->enter_sub();
- foreach my $path (glob "${main::userspath}/datev-export-*") {
+ foreach my $path (glob($::lx_office_conf{paths}->{userspath} . "/datev-export-*")) {
next unless (-d $path);
my $mtime = (stat($path))[9];
ORDER BY trans_id, acc_trans_id|;
my $sth = prepare_execute_query($form, $dbh, $query);
+ $form->{DATEV} = [];
my $counter = 0;
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
my $count = $ref->{amount};
my $firstrun = 1;
+ my $subcent = abs($count) < 0.02;
- while (abs($count) > 0.01 || $firstrun) {
+ while (abs($count) > 0.01 || $firstrun || ($subcent && abs($count) > 0.005)) {
my $ref2 = $sth->fetchrow_hashref("NAME_lc");
last unless ($ref2);
my $taxkey = 0;
my $charttax = 0;
my ($haben, $soll);
- my $iconv = $main::locale->{iconv_iso8859};
- my %umlaute = ($iconv->convert('ä') => 'ae',
- $iconv->convert('ö') => 'oe',
- $iconv->convert('ü') => 'ue',
- $iconv->convert('Ä') => 'Ae',
- $iconv->convert('Ö') => 'Oe',
- $iconv->convert('Ü') => 'Ue',
- $iconv->convert('ß') => 'sz');
+ my $iconv = $::locale->{iconv_utf8};
+ my %umlaute = ($iconv->convert('ä') => 'ae',
+ $iconv->convert('ö') => 'oe',
+ $iconv->convert('ü') => 'ue',
+ $iconv->convert('Ä') => 'Ae',
+ $iconv->convert('Ö') => 'Oe',
+ $iconv->convert('Ü') => 'Ue',
+ $iconv->convert('ß') => 'sz');
for (my $i = 0; $i < $trans_lines; $i++) {
if ($trans_lines == 2) {
if (abs($transaction->[$i]->{'amount'}) > abs($umsatz)) {
$kne_file->add_block($mandantenendsumme);
$kne_file->flush();
- open(ED, "> $ed_filename") or die "can't open outputfile: $!\n";
+ open(ED, ">", $ed_filename) or die "can't open outputfile: $!\n";
print(ED $kne_file->get_data());
close(ED);
my $ev_header = &make_ev_header($form, $fileno);
my $ev_filename = $export_path . $evfile;
push(@filenames, $evfile);
- open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n";
+ open(EV, ">", $ev_filename) or die "can't open outputfile: EV01\n";
print(EV $ev_header);
foreach my $file (@ed_versionset) {
$filename++;
my $ed_filename = $export_path . $filename;
push(@filenames, $filename);
- open(ED, "> $ed_filename") or die "can't open outputfile: $!\n";
+ open(ED, ">", $ed_filename) or die "can't open outputfile: $!\n";
my $header = &make_kne_data_header($myconfig, $form, "");
$remaining_bytes -= length($header);
push @values, $form->{accnoto};
}
- my $where_str = ' WHERE ' . join(' AND ', map { "($_)" } @where) if (scalar @where);
+ my $where_str = @where ? ' WHERE ' . join(' AND ', map { "($_)" } @where) : '';
my $query = qq|SELECT c.accno, c.description
FROM chart c
my $ev_header = &make_ev_header($form, $fileno);
my $ev_filename = $export_path . $evfile;
push(@filenames, $evfile);
- open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n";
+ open(EV, ">", $ev_filename) or die "can't open outputfile: EV01\n";
print(EV $ev_header);
foreach my $file (@ed_versionset) {