Revision 653af2fb
Von Jan Büren vor etwa 4 Jahren hinzugefügt
t/gl/gl.t | ||
---|---|---|
1 | 1 |
use strict; |
2 |
use Test::More tests => 4;
|
|
2 |
use Test::More tests => 8;
|
|
3 | 3 |
|
4 | 4 |
use lib 't'; |
5 | 5 |
use Support::TestSetup; |
... | ... | |
257 | 257 |
"chart balances ok" |
258 | 258 |
); |
259 | 259 |
|
260 |
note "testing automatic tax 19%"; |
|
261 |
|
|
262 |
my $gl_transaction_7 = SL::DB::GLTransaction->new( |
|
263 |
reference => 'betriebsbedarf tax not included', |
|
264 |
description => 'bar', |
|
265 |
taxincluded => 0, |
|
266 |
transdate => DateTime->new(year => 2019, month => 12, day => 30), |
|
267 |
); |
|
268 |
|
|
269 |
$gl_transaction_7->add_chart_booking(%{$_}) foreach ( |
|
270 |
{ |
|
271 |
chart => $betriebsbedarf, |
|
272 |
debit => 100, |
|
273 |
}, |
|
274 |
{ |
|
275 |
chart => $betriebsbedarf, |
|
276 |
debit => 100, |
|
277 |
}, |
|
278 |
{ |
|
279 |
chart => $betriebsbedarf, |
|
280 |
debit => 100, |
|
281 |
tax_id => $tax_0->id, |
|
282 |
}, |
|
283 |
{ |
|
284 |
chart => $cash, |
|
285 |
credit => 338, |
|
286 |
}, |
|
287 |
); |
|
288 |
$gl_transaction_7->post; |
|
289 |
|
|
290 |
is(SL::DB::Manager::GLTransaction->get_all_count(), 9, "gl transactions created ok"); |
|
291 |
is_deeply(&get_account_balances, |
|
292 |
[ |
|
293 |
{ |
|
294 |
'accno' => '1000', |
|
295 |
'sum' => '1328.14000' |
|
296 |
}, |
|
297 |
{ |
|
298 |
'accno' => '1200', |
|
299 |
'sum' => '-100.00000' |
|
300 |
}, |
|
301 |
{ |
|
302 |
'accno' => '1571', |
|
303 |
'sum' => '-14.00000' |
|
304 |
}, |
|
305 |
{ |
|
306 |
'accno' => '1576', |
|
307 |
'sum' => '-114.02000' |
|
308 |
}, |
|
309 |
{ |
|
310 |
'accno' => '4980', |
|
311 |
'sum' => '-1100.12000' |
|
312 |
} |
|
313 |
], |
|
314 |
"chart balances ok" |
|
315 |
); |
|
316 |
|
|
317 |
note "testing automatic tax 16%"; |
|
318 |
|
|
319 |
my $gl_transaction_8 = SL::DB::GLTransaction->new( |
|
320 |
reference => 'betriebsbedarf tax not included', |
|
321 |
description => 'bar', |
|
322 |
taxincluded => 0, |
|
323 |
transdate => DateTime->new(year => 2020, month => 12, day => 31), |
|
324 |
); |
|
325 |
|
|
326 |
$gl_transaction_8->add_chart_booking(%{$_}) foreach ( |
|
327 |
{ |
|
328 |
chart => $betriebsbedarf, |
|
329 |
debit => 100, |
|
330 |
}, |
|
331 |
{ |
|
332 |
chart => $betriebsbedarf, |
|
333 |
debit => 100, |
|
334 |
}, |
|
335 |
{ |
|
336 |
chart => $betriebsbedarf, |
|
337 |
debit => 100, |
|
338 |
tax_id => $tax_0->id, |
|
339 |
}, |
|
340 |
{ |
|
341 |
chart => $cash, |
|
342 |
credit => 332, |
|
343 |
}, |
|
344 |
); |
|
345 |
$gl_transaction_8->post; |
|
346 |
|
|
347 |
is(SL::DB::Manager::GLTransaction->get_all_count(), 10, "gl transactions created ok"); |
|
348 |
is_deeply(&get_account_balances, |
|
349 |
[ |
|
350 |
{ |
|
351 |
'accno' => '1000', |
|
352 |
'sum' => '1660.14000' |
|
353 |
}, |
|
354 |
{ |
|
355 |
'accno' => '1200', |
|
356 |
'sum' => '-100.00000' |
|
357 |
}, |
|
358 |
{ |
|
359 |
'accno' => '1571', |
|
360 |
'sum' => '-14.00000' |
|
361 |
}, |
|
362 |
{ |
|
363 |
'accno' => '1575', |
|
364 |
'sum' => '-32.00000' |
|
365 |
}, |
|
366 |
{ |
|
367 |
'accno' => '1576', |
|
368 |
'sum' => '-114.02000' |
|
369 |
}, |
|
370 |
{ |
|
371 |
'accno' => '4980', |
|
372 |
'sum' => '-1400.12000' |
|
373 |
} |
|
374 |
], |
|
375 |
"chart balances ok" |
|
376 |
); |
|
377 |
|
|
260 | 378 |
done_testing; |
261 | 379 |
clear_up(); |
262 | 380 |
|
Auch abrufbar als: Unified diff
GLTransaction:: add_chart_booking um get_active_taxkey erweitert
Der Aufruf von add_chart_booking muss sich nicht mehr
darum kümmern welcher Steuerschlüssel gesetzt sein muss, wenn
er einfach nur den vorkonfigurierten Steuerschlüssel setzen will.
Dementsprechend ist param{tax_id} kein Pflichtparameter mehr.
POD ergänzt und mit Testfällen abgesichert (19% / 16% Fall).