X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fbank%2Fbank_transactions.t;h=92f9362e64648ca9e67d3a6e2b907e0d2ff551ec;hb=549f187d3a2b1d15f96c4556714666ed954447bb;hp=ff3a001ed4fc6799a457dc42e0d840f923d49793;hpb=b6f8a6b0fe6dae88ce0189c4999d7c1aa96d32a2;p=kivitendo-erp.git diff --git a/t/bank/bank_transactions.t b/t/bank/bank_transactions.t index ff3a001ed..92f9362e6 100644 --- a/t/bank/bank_transactions.t +++ b/t/bank/bank_transactions.t @@ -1,4 +1,4 @@ -use Test::More tests => 289; +use Test::More tests => 293; use strict; @@ -177,7 +177,7 @@ sub reset_state { sub test_ar_transaction { my (%params) = @_; - my $netamount = $params{amount} || 100; + my $netamount = $::form->round_amount($params{amount}, 2) || 100; my $amount = $::form->round_amount($netamount * 1.19,2); my $invoice = SL::DB::Invoice->new( invoice => 0, @@ -335,7 +335,8 @@ sub test_bt_error { $::form->{invoice_skontos} = { $bt->id => [ 'with_skonto_pt' ] }; - + is($ar_transaction->netamount, $::form->round_amount(168.58/1.19, 2), "$testname: Net Amount assigned"); + is($ar_transaction->amount, 168.58, "$testname: Amount assigned"); is($ar_transaction->paid , '0' , "$testname: salesinv is not paid"); # generate an error for testing rollback mechanism @@ -541,6 +542,17 @@ sub test_partial_payment { is($ar_transaction->paid , '100.00000' , "$testname: 'salesinv partial payment' was partially paid"); is($bt->invoice_amount , '100.00000' , "$testname: bt invoice amount was assigned partially paid amount"); + # addon test partial payment full point match + my $bt2 = create_bank_transaction(record => $ar_transaction, + bank_chart_id => $bank->id, + transdate => $dt, + valutadate => $dt, + amount => 19 + ) or die "Couldn't create bank_transaction"; + + my ($agreement, $rule_matches) = $bt2->get_agreement_with_invoice($ar_transaction); + is($agreement, 15, "points for exact partial payment ok"); + is($rule_matches, 'remote_account_number(3) exact_open_amount(4) depositor_matches(2) remote_name(2) payment_within_30_days(1) datebonus0(3) ', "rules_matches for exact partial payment ok"); }; sub test_full_workflow_ar_multiple_inv_skonto_reconciliate_and_undo { @@ -615,7 +627,7 @@ sub test_full_workflow_ar_multiple_inv_skonto_reconciliate_and_undo { is($bt->invoice_amount , '299.29000' , "$testname: bt invoice amount was assigned partially paid amount"); is($bt->amount , '299.29000' , "$testname: bt amount is stil there"); is(scalar @{ SL::DB::Manager::BankTransactionAccTrans->get_all(where => [bank_transaction_id => $bt->id ] )}, - 7, "$testname 7 acc_trans entries created"); + 9, "$testname 9 acc_trans entries created"); # same loop as above, but only for the 3rd ar_id foreach my $acc_trans_id_entry (@{ SL::DB::Manager::BankTransactionAccTrans->get_all(where => [ar_id => $ar_transaction_skonto->id ] )}) { @@ -711,8 +723,8 @@ sub test_credit_note { transdate => $dt_10, ); my ($agreement, $rule_matches) = $bt->get_agreement_with_invoice($credit_note); - is($agreement, 13, "points for credit note ok"); - is($rule_matches, 'remote_account_number(3) exact_amount(4) wrong_sign(-1) depositor_matches(2) remote_name(2) payment_within_30_days(1) datebonus14(2) ', "rules_matches for credit note ok"); + is($agreement, 14, "points for credit note ok"); + is($rule_matches, 'remote_account_number(3) exact_amount(4) depositor_matches(2) remote_name(2) payment_within_30_days(1) datebonus14(2) ', "rules_matches for credit note ok"); $::form->{invoice_ids} = { $bt->id => [ $credit_note->id ]