X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fyear_end%2Fyear_end.t;h=dc0be7c58abc411b8267902a34ce187a0d059b30;hb=08e48f66590f580cbe2c8e3df76883d88b4c0fef;hp=c6a2b77d08e8394417d9bc93630023f19a078752;hpb=e592e0bc4aaf7ce59e4d5eec9834cb430ab6a33f;p=kivitendo-erp.git diff --git a/t/year_end/year_end.t b/t/year_end/year_end.t index c6a2b77d0..dc0be7c58 100644 --- a/t/year_end/year_end.t +++ b/t/year_end/year_end.t @@ -30,7 +30,10 @@ clear_up(); # * also the default test client has the accounting method "cash" rather than "accrual" # (Ist-versteuerung, rather than Soll-versteuerung) +# use 2019 instead of 2020 because of tax changes in Germany (19/16 and 7/5) because we check for account sums my $year = 2019; +my $start_of_year = DateTime->new(year => $year, month => 01, day => 01); +my $booking_date = DateTime->new(year => $year, month => 12, day => 22); note('configuring accounts'); my $bank_account = SL::DB::BankAccount->new( @@ -81,6 +84,7 @@ $dbh->do('UPDATE defaults SET loss_carried_forward_chart_id = ' . $loss_accoun note('creating transactions'); my $ar_transaction = create_ar_transaction( taxincluded => 0, + transdate => $booking_date, bookings => [ { chart => $income_chart, # income 19%, taxkey 3 @@ -91,13 +95,14 @@ my $ar_transaction = create_ar_transaction( $ar_transaction->pay_invoice( chart_id => $bank_account->chart_id, - transdate => DateTime->today_local->to_kivitendo, amount => $ar_transaction->amount, + transdate => $booking_date, payment_type => 'without_skonto', ); my $ar_transaction2 = create_ar_transaction( taxincluded => 1, + transdate => $booking_date, bookings => [ { chart => $income_chart, # income 19%, taxkey 3 @@ -108,6 +113,7 @@ my $ar_transaction2 = create_ar_transaction( my $ap_transaction = create_ap_transaction( taxincluded => 0, + transdate => $booking_date, bookings => [ { chart => SL::DB::Manager::Chart->find_by( accno => '3400' ), # Wareneingang 19%, taxkey 9 @@ -116,8 +122,7 @@ my $ap_transaction = create_ap_transaction( ], ); - -gl_booking(40, "01.01.$year", 'foo', 'bar', $bank, $privateinlagen, 1, 0); +gl_booking(40, $start_of_year, 'foo', 'bar', $bank, $privateinlagen, 1, 0); is(SL::DB::Manager::AccTransaction->get_all_count( ), 13, 'acc_trans transactions created ok'); is(SL::DB::Manager::AccTransaction->get_all_count(where => [ ob_transaction => 1 ]), 2, 'acc_trans ob_transactions created ok'); @@ -392,8 +397,8 @@ is_deeply( &get_final_balances, # adjust that profit-loss-carry-over # chart, rather than creating a new entry # for the loss. -gl_booking(10, "22.12.$year", 'foo', 'bar', $cash, $bank, 0, 0); -gl_booking(5, "22.12.$year", 'foo', 'bar', $betriebsbedarf, $cash, 0, 0); +gl_booking(10, $booking_date, 'foo', 'bar', $cash, $bank, 0, 0); +gl_booking(5, $booking_date, 'foo', 'bar', $betriebsbedarf, $cash, 0, 0); SL::Controller::YearEndTransactions::_year_end_bookings( start_date => $start_date, cb_date => $cb_date, @@ -620,12 +625,12 @@ sub gl_booking { # wrapper around SL::Dev::Record::create_gl_transaction for quickly creating transactions my ($amount, $date, $reference, $description, $gegenkonto, $konto, $ob, $cb) = @_; - my $transdate = $::locale->parse_date_to_object($date); + # my $transdate = $::locale->parse_date_to_object($date); return create_gl_transaction( ob_transaction => $ob, cb_transaction => $cb, - transdate => $transdate, + transdate => $date, reference => $reference, description => $description, bookings => [