Revision f6132ede
Von Jan Büren vor fast 9 Jahren hinzugefügt
SL/BackgroundJob/SelfTest/Transactions.pm | ||
---|---|---|
15 | 15 |
|
16 | 16 |
$self->_setup; |
17 | 17 |
|
18 |
$self->tester->plan(tests => 18);
|
|
18 |
$self->tester->plan(tests => 20);
|
|
19 | 19 |
|
20 | 20 |
$self->check_konten_mit_saldo_nicht_in_guv; |
21 | 21 |
$self->check_bilanzkonten_mit_pos_eur; |
... | ... | |
23 | 23 |
$self->check_verwaiste_acc_trans_eintraege; |
24 | 24 |
$self->check_verwaiste_invoice_eintraege; |
25 | 25 |
$self->check_ar_acc_trans_amount; |
26 |
$self->check_ap_acc_trans_amount; |
|
26 | 27 |
$self->check_netamount_laut_invoice_ar; |
27 | 28 |
$self->check_invnumbers_unique; |
28 | 29 |
$self->check_summe_stornobuchungen; |
... | ... | |
35 | 36 |
$self->check_overpayments; |
36 | 37 |
$self->check_every_account_with_taxkey; |
37 | 38 |
$self->calc_saldenvortraege; |
39 |
$self->check_missing_tax_bookings; |
|
38 | 40 |
} |
39 | 41 |
|
40 | 42 |
sub _setup { |
... | ... | |
446 | 448 |
Nebenbuch-Wert: $ar_ac_amount_nok->{netamount}"); |
447 | 449 |
} |
448 | 450 |
} else { |
449 |
$self->tester->ok(1, "Hauptbuch-Nettowert und Nebenbuch-Nettowert stimmen überein."); |
|
451 |
$self->tester->ok(1, "Hauptbuch-Nettowert und Debitoren-Nebenbuch-Nettowert stimmen überein."); |
|
452 |
} |
|
453 |
|
|
454 |
} |
|
455 |
|
|
456 |
sub check_ap_acc_trans_amount { |
|
457 |
my ($self) = @_; |
|
458 |
|
|
459 |
my $query = qq| |
|
460 |
select ap.invnumber, ap.netamount, ac.amount |
|
461 |
from ap left join acc_trans ac on (ac.trans_id = ap.id) where ac.chart_link like 'AP_amount%' AND ac.amount <> ap.netamount*-1|; |
|
462 |
|
|
463 |
my $ap_amount_not_ac_amount = selectall_hashref_query($::form, $self->dbh, $query); |
|
464 |
|
|
465 |
if ( scalar @{ $ap_amount_not_ac_amount } > 0 ) { |
|
466 |
$self->tester->ok(0, "Folgende Eingangsrechnungen haben einen falschen Netto-Wert im Nebenbuch:"); |
|
467 |
|
|
468 |
for my $ap_ac_amount_nok (@{ $ap_amount_not_ac_amount } ) { |
|
469 |
$self->tester->diag("Rechnungsnummer: $ap_ac_amount_nok->{invnumber} Hauptbuch-Wert: $ap_ac_amount_nok->{amount} |
|
470 |
Nebenbuch-Wert: $ap_ac_amount_nok->{netamount}"); |
|
471 |
} |
|
472 |
} else { |
|
473 |
$self->tester->ok(1, "Hauptbuch-Nettowert und Kreditoren-Nebenbuch-Nettowert stimmen überein."); |
|
450 | 474 |
} |
451 | 475 |
|
452 | 476 |
} |
453 | 477 |
|
478 |
|
|
479 |
sub check_missing_tax_bookings { |
|
480 |
|
|
481 |
my ($self) = @_; |
|
482 |
|
|
483 |
# check tax bookings. all taxkey <> 0 should have tax bookings in acc_trans |
|
484 |
|
|
485 |
my $query = qq| select trans_id, chart.accno,transdate from acc_trans left join chart on (chart.id = acc_trans.chart_id) |
|
486 |
WHERE taxkey <> 0 AND trans_id NOT IN |
|
487 |
(select trans_id from acc_trans where chart_link ilike '%tax%' and trans_id IN |
|
488 |
(SELECT trans_id from acc_trans where taxkey <> 0))|; |
|
489 |
|
|
490 |
my $missing_tax_bookings = selectall_hashref_query($::form, $self->dbh, $query); |
|
491 |
|
|
492 |
if ( scalar @{ $missing_tax_bookings } > 0 ) { |
|
493 |
$self->tester->ok(0, "Folgende Konten weisen Buchungen ohne Steuer auf:"); |
|
494 |
|
|
495 |
for my $acc_trans_nok (@{ $missing_tax_bookings } ) { |
|
496 |
$self->tester->diag("Kontonummer: $acc_trans_nok->{accno} Belegdatum: $acc_trans_nok->{transdate} Trans-ID: $acc_trans_nok->{trans_id}. |
|
497 |
Kann über System -> Korrekturen im Hauptbuch bereinigt werden."); |
|
498 |
} |
|
499 |
} else { |
|
500 |
$self->tester->ok(1, "Hauptbuch-Nettowert und Nebenbuch-Nettowert stimmen überein."); |
|
501 |
} |
|
502 |
} |
|
503 |
|
|
504 |
|
|
454 | 505 |
1; |
455 | 506 |
|
456 | 507 |
__END__ |
Auch abrufbar als: Unified diff
Weitere Selftests
- Kreditoren Haupt und Nebenbuch Netto-Prüfung (ap.netamount == acc_trans.amount)
- Für alle Taxkeys <> 0 muss auch eine Steuerbuchung in acc_trans vorhanden sein