From 13b4fc7a4f14f36a98b15c9cfc1c075e28dfc67c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 23 Mar 2022 14:52:18 +0100 Subject: [PATCH] =?utf8?q?=C3=84nderungen=20Testfall=20tax.=20bt=5Fid=20is?= =?utf8?q?t=20jetzt=20zwingend=20erforderlich?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit pay_invoice mit Skonto erwartet die bank_transaction.id --- t/tax/tax.t | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/t/tax/tax.t b/t/tax/tax.t index e2861dace..88638bb0c 100644 --- a/t/tax/tax.t +++ b/t/tax/tax.t @@ -9,6 +9,8 @@ use utf8; use Support::TestSetup; use Test::Exception; +use SL::DB::BankTransaction; +use SL::DB::BankTransactionAccTrans; use SL::DB::Customer; use SL::DB::Vendor; use SL::DB::Invoice; @@ -32,6 +34,9 @@ clear_up(); # neue Konten für 5% anlegen # Leistungszeitraum vs. Datum Zuord. Steuerperiodest + + + note('checking if all tax entries exist for Konjunkturprogramm'); # create dates to test on @@ -40,6 +45,30 @@ my $date_2020_1 = DateTime->new(year => 2020, month => 6, day => 15); my $date_2020_2 = DateTime->new(year => 2020, month => 7, day => 15); my $date_2021 = DateTime->new(year => 2021, month => 1, day => 15); +# dummy bt_id +my $bank_account = SL::DB::BankAccount->new( + account_number => '123', + bank_code => '123', + iban => '123', + bic => '123', + bank => '123', + chart_id => SL::DB::Manager::Chart->find_by( description => 'Bank' )->id, + name => SL::DB::Manager::Chart->find_by( description => 'Bank' )->description, + )->save; + + +my $currency_id = $::instance_conf->get_currency_id; +my $bt = SL::DB::BankTransaction->new( + local_bank_account_id => $bank_account->id, + transdate => $date_2021, + valutadate => $date_2021, + amount => 27332.32, + purpose => 'dummy', + currency => $currency_id, + ); + $bt->save || die $@; + + # The only way to discern the pre-2007 16% tax from the 2020 16% tax is by # their configured automatic tax charts, so look them up here: @@ -403,6 +432,7 @@ note('testing payments with skonto'); my %params = ( chart_id => $chart_bank->id, payment_type => 'with_skonto_pt', + bt_id => $bt->id, ); $sales_invoice_2020_2->pay_invoice( %params, @@ -585,6 +615,9 @@ sub datev_test { } sub clear_up { + SL::DB::Manager::BankTransactionAccTrans->delete_all(all => 1); + SL::DB::Manager::BankTransaction->delete_all(all => 1); + SL::DB::Manager::BankAccount->delete_all(all => 1); SL::DB::Manager::OrderItem->delete_all(all => 1); SL::DB::Manager::Order->delete_all(all => 1); SL::DB::Manager::InvoiceItem->delete_all(all => 1); -- 2.20.1