Revision ad1f22ca
Von Jan Büren vor mehr als 8 Jahren hinzugefügt
SL/BackgroundJob/SelfTest/Transactions.pm | ||
---|---|---|
15 | 15 |
|
16 | 16 |
$self->_setup; |
17 | 17 |
|
18 |
$self->tester->plan(tests => 21);
|
|
18 |
$self->tester->plan(tests => 23);
|
|
19 | 19 |
|
20 | 20 |
$self->check_konten_mit_saldo_nicht_in_guv; |
21 | 21 |
$self->check_bilanzkonten_mit_pos_eur; |
... | ... | |
38 | 38 |
$self->calc_saldenvortraege; |
39 | 39 |
$self->check_missing_tax_bookings; |
40 | 40 |
$self->check_bank_transactions_overpayments; |
41 |
$self->check_ar_paid_acc_trans; |
|
42 |
$self->check_ap_paid_acc_trans; |
|
41 | 43 |
} |
42 | 44 |
|
43 | 45 |
sub _setup { |
... | ... | |
541 | 543 |
} |
542 | 544 |
} |
543 | 545 |
|
546 |
sub check_ar_paid_acc_trans { |
|
547 |
my ($self) = @_; |
|
548 |
|
|
549 |
my $query = qq| |
|
550 |
select sum(ac.amount) as paid_amount, ar.invnumber,ar.paid |
|
551 |
from acc_trans ac left join ar on (ac.trans_id = ar.id) |
|
552 |
WHERE ac.chart_link like '%AR_paid%' |
|
553 |
AND ac.transdate >= ? AND ac.transdate <= ? |
|
554 |
group by invnumber, paid having sum(ac.amount) <> ar.paid*-1|; |
|
555 |
|
|
556 |
my $ar_amount_not_ac_amount = selectall_hashref_query($::form, $self->dbh, $query, $self->fromdate, $self->todate); |
|
557 |
|
|
558 |
if ( scalar @{ $ar_amount_not_ac_amount } > 0 ) { |
|
559 |
$self->tester->ok(0, "Folgende Ausgangsrechnungen haben einen falschen Bezahl-Wert im Nebenbuch:"); |
|
560 |
|
|
561 |
for my $ar_ac_amount_nok (@{ $ar_amount_not_ac_amount } ) { |
|
562 |
$self->tester->diag("Rechnungsnummer: $ar_ac_amount_nok->{invnumber} Hauptbuch-Wert: $ar_ac_amount_nok->{paid_amount} |
|
563 |
Nebenbuch-Wert: $ar_ac_amount_nok->{paid}"); |
|
564 |
} |
|
565 |
} else { |
|
566 |
$self->tester->ok(1, "Hauptbuch-Bezahlwert und Debitoren-Nebenbuch-Bezahlwert stimmen überein."); |
|
567 |
} |
|
568 |
} |
|
569 |
|
|
570 |
sub check_ap_paid_acc_trans { |
|
571 |
my ($self) = @_; |
|
572 |
|
|
573 |
my $query = qq| |
|
574 |
select sum(ac.amount) as paid_amount, ap.invnumber,ap.paid |
|
575 |
from acc_trans ac left join ap on (ac.trans_id = ap.id) |
|
576 |
WHERE ac.chart_link like '%AP_paid%' |
|
577 |
AND ac.transdate >= ? AND ac.transdate <= ? |
|
578 |
group by trans_id,invnumber,paid having sum(ac.amount) <> ap.paid|; |
|
579 |
|
|
580 |
my $ap_amount_not_ac_amount = selectall_hashref_query($::form, $self->dbh, $query, $self->fromdate, $self->todate); |
|
581 |
|
|
582 |
if ( scalar @{ $ap_amount_not_ac_amount } > 0 ) { |
|
583 |
$self->tester->ok(0, "Folgende Eingangsrechnungen haben einen falschen Bezahl-Wert im Nebenbuch:"); |
|
584 |
|
|
585 |
for my $ap_ac_amount_nok (@{ $ap_amount_not_ac_amount } ) { |
|
586 |
$self->tester->diag("Rechnungsnummer: $ap_ac_amount_nok->{invnumber} Hauptbuch-Wert: $ap_ac_amount_nok->{paid_amount} |
|
587 |
Nebenbuch-Wert: $ap_ac_amount_nok->{paid}"); |
|
588 |
} |
|
589 |
} else { |
|
590 |
$self->tester->ok(1, "Hauptbuch Bezahl-Wert und Kreditoren-Nebenbuch-Bezahlwert stimmen überein."); |
|
591 |
} |
|
592 |
} |
|
593 |
|
|
544 | 594 |
|
545 | 595 |
1; |
546 | 596 |
|
Auch abrufbar als: Unified diff
SelfTests erweitert: arap.paid mit acc_trans.paid vergleichen
Der Bezahl-Wert in den Nebenbücher muss auch immer mit dem Bezahl-Wert
in der acc_trans(chart_link= '%ARAP_paid%' übereinstimmen.