From: Jan Büren Date: Thu, 23 Mar 2017 13:41:25 +0000 (+0100) Subject: Testfall Verbuchen Kontoauszug zu Kreditorenbeleg ergänzt X-Git-Tag: release-3.5.4~1181 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c97d4a0aaaaced4399a04a93f2c19d477439a92e;p=kivitendo-erp.git Testfall Verbuchen Kontoauszug zu Kreditorenbeleg ergänzt Sehr viele Tests für ar, nur einen speziellen für ap. --- diff --git a/t/bank/bank_transactions.t b/t/bank/bank_transactions.t index ebecb3d26..4658c5607 100644 --- a/t/bank/bank_transactions.t +++ b/t/bank/bank_transactions.t @@ -1,4 +1,4 @@ -use Test::More tests => 75; +use Test::More tests => 82; use strict; @@ -73,7 +73,7 @@ test_two_invoices(); test_partial_payment(); test_credit_note(); test_neg_ap_transaction(); - +test_ap_payment_transaction(); # remove all created data at end of test clear_up(); @@ -487,4 +487,56 @@ sub test_neg_ap_transaction { return $invoice; }; +sub test_ap_payment_transaction { + my (%params) = @_; + my $testname = 'test_ap_two_transaction'; + my $netamount = 115; + my $amount = $::form->round_amount($netamount * 1.19,2); + my $invoice = SL::DB::PurchaseInvoice->new( + invoice => 0, + invnumber => $params{invnumber} || 'test_ap_two_transaction', + amount => $amount, + netamount => $netamount, + transdate => $transdate1, + taxincluded => 0, + vendor_id => $vendor->id, + taxzone_id => $vendor->taxzone_id, + currency_id => $currency_id, + transactions => [], + notes => 'test_ap_transaction', + ); + $invoice->add_ap_amount_row( + amount => $invoice->netamount, + chart => $ap_amount_chart, + tax_id => $tax_9->id, + ); + + $invoice->create_ap_row(chart => $ap_chart); + $invoice->save; + + is($invoice->netamount, 115 , "$testname: netamount ok"); + is($invoice->amount , 136.85, "$testname: amount ok"); + + my $bt = SL::Dev::Payment::create_bank_transaction(record => $invoice, + amount => $invoice->amount, + bank_chart_id => $bank->id, + transdate => DateTime->today->add(days => 10), + ); + $::form->{invoice_ids} = { + $bt->id => [ $invoice->id ] + }; + + save_btcontroller_to_string(); + + $invoice->load; + $bt->load; + + is($invoice->amount , '136.85000', "$testname: amount ok"); + is($invoice->netamount, '115.00000', "$testname: netamount ok"); + is($bt->amount, '-136.85000', "$testname: bt amount ok"); + is($invoice->paid , '136.85000', "$testname: paid ok"); + is($bt->invoice_amount, '-136.85000', "$testname: bt invoice amount for ap was assigned"); + + return $invoice; +}; 1;