Revision a493c210
Von G. Richardson vor mehr als 4 Jahren hinzugefügt
t/year_end/year_end.t | ||
---|---|---|
30 | 30 |
# * also the default test client has the accounting method "cash" rather than "accrual" |
31 | 31 |
# (Ist-versteuerung, rather than Soll-versteuerung) |
32 | 32 |
|
33 |
my $year = DateTime->today->year; |
|
33 |
# hardcode for 2019, as this will break in 2020 due to change in tax (19/16 and 7/5) because we check for account sums |
|
34 |
# can be changed back to current year in 2021 |
|
35 |
my $year = 2019; # DateTime->today->year; |
|
36 |
my $start_of_year = DateTime->new(year => $year, month => 01, day => 01); |
|
37 |
my $booking_date = DateTime->new(year => $year, month => 12, day => 22); |
|
34 | 38 |
|
35 | 39 |
note('configuring accounts'); |
36 | 40 |
my $bank_account = SL::DB::BankAccount->new( |
... | ... | |
81 | 85 |
note('creating transactions'); |
82 | 86 |
my $ar_transaction = create_ar_transaction( |
83 | 87 |
taxincluded => 0, |
88 |
transdate => $booking_date, |
|
84 | 89 |
bookings => [ |
85 | 90 |
{ |
86 | 91 |
chart => $income_chart, # income 19%, taxkey 3 |
... | ... | |
91 | 96 |
|
92 | 97 |
$ar_transaction->pay_invoice( |
93 | 98 |
chart_id => $bank_account->chart_id, |
94 |
transdate => DateTime->today_local->to_kivitendo, |
|
95 | 99 |
amount => $ar_transaction->amount, |
100 |
transdate => $booking_date->to_kivitendo, |
|
96 | 101 |
payment_type => 'without_skonto', |
97 | 102 |
); |
98 | 103 |
|
99 | 104 |
my $ar_transaction2 = create_ar_transaction( |
100 | 105 |
taxincluded => 1, |
106 |
transdate => $booking_date, |
|
101 | 107 |
bookings => [ |
102 | 108 |
{ |
103 | 109 |
chart => $income_chart, # income 19%, taxkey 3 |
... | ... | |
108 | 114 |
|
109 | 115 |
my $ap_transaction = create_ap_transaction( |
110 | 116 |
taxincluded => 0, |
117 |
transdate => $booking_date, |
|
111 | 118 |
bookings => [ |
112 | 119 |
{ |
113 | 120 |
chart => SL::DB::Manager::Chart->find_by( accno => '3400' ), # Wareneingang 19%, taxkey 9 |
... | ... | |
116 | 123 |
], |
117 | 124 |
); |
118 | 125 |
|
119 |
|
|
120 |
gl_booking(40, "01.01.$year", 'foo', 'bar', $bank, $privateinlagen, 1, 0); |
|
126 |
gl_booking(40, $start_of_year, 'foo', 'bar', $bank, $privateinlagen, 1, 0); |
|
121 | 127 |
|
122 | 128 |
is(SL::DB::Manager::AccTransaction->get_all_count( ), 13, 'acc_trans transactions created ok'); |
123 | 129 |
is(SL::DB::Manager::AccTransaction->get_all_count(where => [ ob_transaction => 1 ]), 2, 'acc_trans ob_transactions created ok'); |
... | ... | |
392 | 398 |
# adjust that profit-loss-carry-over # chart, rather than creating a new entry |
393 | 399 |
# for the loss. |
394 | 400 |
|
395 |
gl_booking(10, "22.12.$year", 'foo', 'bar', $cash, $bank, 0, 0);
|
|
396 |
gl_booking(5, "22.12.$year", 'foo', 'bar', $betriebsbedarf, $cash, 0, 0);
|
|
401 |
gl_booking(10, $booking_date, 'foo', 'bar', $cash, $bank, 0, 0);
|
|
402 |
gl_booking(5, $booking_date, 'foo', 'bar', $betriebsbedarf, $cash, 0, 0);
|
|
397 | 403 |
|
398 | 404 |
SL::Controller::YearEndTransactions::_year_end_bookings( start_date => $start_date, |
399 | 405 |
cb_date => $cb_date, |
... | ... | |
620 | 626 |
# wrapper around SL::Dev::Record::create_gl_transaction for quickly creating transactions |
621 | 627 |
my ($amount, $date, $reference, $description, $gegenkonto, $konto, $ob, $cb) = @_; |
622 | 628 |
|
623 |
my $transdate = $::locale->parse_date_to_object($date); |
|
629 |
# my $transdate = $::locale->parse_date_to_object($date);
|
|
624 | 630 |
|
625 | 631 |
return create_gl_transaction( |
626 | 632 |
ob_transaction => $ob, |
627 | 633 |
cb_transaction => $cb, |
628 |
transdate => $transdate,
|
|
634 |
transdate => $date, |
|
629 | 635 |
reference => $reference, |
630 | 636 |
description => $description, |
631 | 637 |
bookings => [ |
Auch abrufbar als: Unified diff
year_end.t - Testjahr hartkodiert
da ansonsten in 2020 durch die Umsatzsteuerumstellung die Kontensalden
des Tests nicht stimmen.