X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fdatev%2Fdatev_format_2018.t;h=d97c329982f46b2df89fc05c3e94c666e48ab00f;hb=16d5a584a54b10a4a8cbd85d4bfb09836abb78d7;hp=4e43b3c0b7fa393ec942a59c800e807997e3f2fc;hpb=d0b6af4dcb0e4b0ff1c34fa6e07e6a8a926ec366;p=kivitendo-erp.git diff --git a/t/datev/datev_format_2018.t b/t/datev/datev_format_2018.t index 4e43b3c0b..d97c32998 100644 --- a/t/datev/datev_format_2018.t +++ b/t/datev/datev_format_2018.t @@ -19,6 +19,10 @@ Support::TestSetup::login(); my $dbh = SL::DB->client->dbh; clear_up(); + +my $d = SL::DB::Default->get; +$d->update_attributes(datev_export_format => 'cp1252'); + my $buchungsgruppe7 = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 7%') || die "No accounting group for 7\%"; my $date = DateTime->new(year => 2017, month => 7, day => 19); my $department = create_department(description => 'Kästchenweiße heiße Preise'); @@ -126,6 +130,7 @@ $datev4->from($startdate); $datev4->to($enddate); $datev4->generate_datev_data; $datev4->generate_datev_lines; + my ($datev_csv4, $die_message3, $lines_aref); eval { $datev_csv4 = SL::DATEV::CSV->new(datev_lines => $datev4->generate_datev_lines, @@ -145,7 +150,7 @@ ok(scalar @{ $datev_csv4->warnings } == 0, 'no warnings'); my @sorted = sort { $a->[0] cmp $b->[0] } @{ $lines_aref }; cmp_deeply $sorted[0], [ '1963,5', 'S', 'EUR', '', '', '', '1400', '8400', '', '1907', 'meine muh', - '', '', '', '', '', '', '', '', '', + '', '', 'Test customer', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', "K\x{e4}stchen", '299', '','DE12345678', '', '', '', @@ -156,12 +161,12 @@ cmp_deeply $sorted[0], [ '1963,5', 'S', 'EUR', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', - '', '', '', '', '', '', '', '', '', - '', + '', '', '', '', '', '', '', '1', '', + '', '', '', '', '', ]; cmp_deeply $sorted[1], [ '535', 'S', 'EUR', '', '', '', '1400', '8300', '', '1907','meine muh', - '', '', '', '', '', '', '', '', '', + '', '', 'Test customer', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', "K\x{e4}stchen", '299', '','DE12345678', '', '', '', @@ -172,61 +177,34 @@ cmp_deeply $sorted[1], [ '535', 'S', 'EUR', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', - '', '', '', '', '', '', '', '', '', - '', + '', '', '', '', '', '', '', '1', '', + '', '', '', '', '', ]; # create one haben buchung with GLTransaction today my $expense_chart = SL::DB::Manager::Chart->find_by(accno => '4660'); # Reisekosten my $cash_chart = SL::DB::Manager::Chart->find_by(accno => '1000'); # Kasse -my $tax_chart = SL::DB::Manager::Chart->find_by(accno => '1576'); # Vorsteuer -my $tax_9 = SL::DB::Manager::Tax->find_by(taxkey => 9, rate => 0.19) || die "No tax"; - -my @acc_trans; -push(@acc_trans, SL::DB::AccTransaction->new( - chart_id => $expense_chart->id, - chart_link => $expense_chart->link, - amount => -84.03, - transdate => $today, - source => '', - taxkey => 9, - tax_id => $tax_9->id, - project_id => $project->id, -)); -push(@acc_trans, SL::DB::AccTransaction->new( - chart_id => $tax_chart->id, - chart_link => $tax_chart->link, - amount => -15.97, - transdate => $today, - source => '', - taxkey => 9, - tax_id => $tax_9->id, - project_id => $project->id, -)); -push(@acc_trans, SL::DB::AccTransaction->new( - chart_id => $cash_chart->id, - chart_link => $cash_chart->link, - amount => 100, - transdate => $today, - source => '', - taxkey => 0, - tax_id => 0, -)); - -my $gl_transaction = SL::DB::GLTransaction->new( + +my $gl_transaction = create_gl_transaction( reference => "Reise März 2018", description => "Reisekonsten März 2018 / Ma Schmidt", transdate => $today, - gldate => $today, - employee_id => SL::DB::Manager::Employee->current->id, taxincluded => 1, type => undef, - ob_transaction => 0, - cb_transaction => 0, - storno => 0, - storno_id => undef, - transactions => \@acc_trans, -)->save; + bookings => [ + { + chart => $expense_chart, + taxkey => 9, + debit => 100, # net 84.03 + }, + { + chart => $cash_chart, + taxkey => 0, + credit => 100, + }, + ], +); + my $datev2 = SL::DATEV->new( dbh => $dbh, trans_id => $gl_transaction->id, @@ -235,7 +213,6 @@ my $datev2 = SL::DATEV->new( $datev2->from($startdate); $datev2->to($enddate); $datev2->generate_datev_data; -$datev2->generate_datev_lines; my $datev_csv3 = SL::DATEV::CSV->new(datev_lines => $datev2->generate_datev_lines, from => $startdate, @@ -244,8 +221,8 @@ my $datev_csv3 = SL::DATEV::CSV->new(datev_lines => $datev2->generate_datev_li ); my @data_csv = sort { $a->[0] cmp $b->[0] } @{ $datev_csv3->lines }; -cmp_deeply($data_csv[0], [ 100, 'H', 'EUR', '', '', '', '4660', '1000', 9, '1703', 'Reise März 2', - '', '', '', '', '', '', '', '', '', '', '', +cmp_deeply($data_csv[0], [ '100', 'S', 'EUR', '', '', '', '4660', '1000', 9, '1703', 'Reise März 2', + '', '', 'Reisekonsten März 2018 / Ma Schmidt', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', @@ -253,7 +230,7 @@ cmp_deeply($data_csv[0], [ 100, 'H', 'EUR', '', '', '', '4660', '1000', 9, '1703 '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', - '', '', '', '', '' ] + '', '', '1', '', '', '', '', '', '', ] ); # TODO warnings are not yet tested