Revision 91fef42d
Von Jan Büren vor fast 3 Jahren hinzugefügt
t/db_helper/payment.t | ||
---|---|---|
14 | 14 |
use SL::Dev::Record qw(create_invoice_item create_sales_invoice create_credit_note create_ap_transaction); |
15 | 15 |
use SL::Dev::CustomerVendor qw(new_customer new_vendor); |
16 | 16 |
use SL::Dev::Part qw(new_part); |
17 |
use SL::DB::BankTransaction; |
|
18 |
use SL::DB::BankTransactionAccTrans; |
|
17 | 19 |
use SL::DB::Buchungsgruppe; |
18 | 20 |
use SL::DB::Currency; |
19 | 21 |
use SL::DB::Exchangerate; |
... | ... | |
29 | 31 |
use SL::DBUtils qw(selectfirst_array_query); |
30 | 32 |
use Data::Dumper; |
31 | 33 |
|
32 |
my ($customer, $vendor, $currency_id, @parts, $buchungsgruppe, $buchungsgruppe7, $unit, $employee, $tax, $tax7, $tax_9, $taxzone, $payment_terms, $bank_account); |
|
34 |
my ($customer, $vendor, $currency_id, @parts, $buchungsgruppe, $buchungsgruppe7, $unit, $employee, $tax, $tax7, $tax_9, $taxzone, $payment_terms, |
|
35 |
$bank_account, $bt); |
|
33 | 36 |
my ($transdate1, $transdate2, $transdate3, $transdate4, $currency, $exchangerate, $exchangerate2, $exchangerate3, $exchangerate4); |
34 | 37 |
my ($ar_chart,$bank,$ar_amount_chart, $ap_chart, $ap_amount_chart, $fxloss_chart, $fxgain_chart); |
35 | 38 |
|
... | ... | |
99 | 102 |
SL::DB::Manager::Part->delete_all(all => 1); |
100 | 103 |
SL::DB::Manager::Customer->delete_all(all => 1); |
101 | 104 |
SL::DB::Manager::Vendor->delete_all(all => 1); |
105 |
SL::DB::Manager::BankTransactionAccTrans->delete_all(all => 1); |
|
106 |
SL::DB::Manager::BankTransaction->delete_all(all => 1); |
|
102 | 107 |
SL::DB::Manager::BankAccount->delete_all(all => 1); |
103 | 108 |
SL::DB::Manager::PaymentTerm->delete_all(all => 1); |
104 | 109 |
SL::DB::Manager::Exchangerate->delete_all(all => 1); |
... | ... | |
237 | 242 |
$bank = SL::DB::Manager::Chart->find_by( accno => '1200' ); # Bank |
238 | 243 |
$ar_amount_chart = SL::DB::Manager::Chart->find_by( accno => '8400' ); # Erlöse |
239 | 244 |
$ap_amount_chart = SL::DB::Manager::Chart->find_by( accno => '3400' ); # Wareneingang 19% |
245 |
|
|
246 |
$bt = SL::DB::BankTransaction->new( |
|
247 |
local_bank_account_id => $bank_account->id, |
|
248 |
transdate => $transdate1, |
|
249 |
valutadate => $transdate1, |
|
250 |
amount => 27332.32, |
|
251 |
purpose => 'dummy', |
|
252 |
currency => $currency, |
|
253 |
); |
|
254 |
$bt->save || die $@; |
|
255 |
|
|
240 | 256 |
} |
241 | 257 |
|
242 | 258 |
sub new_ap_transaction { |
... | ... | |
378 | 394 |
); |
379 | 395 |
|
380 | 396 |
# default values |
381 |
my %params = ( chart_id => $bank_account->chart_id, |
|
397 |
my %params = ( chart_id => $bank_account->chart_id,
|
|
382 | 398 |
transdate => $transdate1, |
399 |
bt_id => $bt->id, |
|
383 | 400 |
); |
384 | 401 |
|
385 | 402 |
$params{payment_type} = 'with_skonto_pt'; |
... | ... | |
411 | 428 |
); |
412 | 429 |
|
413 | 430 |
# default values |
414 |
my %params = ( chart_id => $bank_account->chart_id, |
|
431 |
my %params = ( chart_id => $bank_account->chart_id,
|
|
415 | 432 |
transdate => $transdate1, |
433 |
bt_id => $bt->id, |
|
416 | 434 |
); |
417 | 435 |
|
418 | 436 |
$params{payment_type} = 'with_skonto_pt'; |
... | ... | |
561 | 579 |
payment_type => 'difference_as_skonto', |
562 | 580 |
chart_id => $bank_account->chart_id, |
563 | 581 |
transdate => $transdate1, |
582 |
bt_id => $bt->id, |
|
564 | 583 |
); |
565 | 584 |
|
566 | 585 |
my ($number_of_payments, $paid_amount) = number_of_payments($invoice); |
... | ... | |
601 | 620 |
payment_type => 'difference_as_skonto', |
602 | 621 |
chart_id => $bank_account->chart_id, |
603 | 622 |
transdate => $transdate1, |
623 |
bt_id => $bt->id, |
|
604 | 624 |
); |
605 | 625 |
|
606 | 626 |
my ($number_of_payments, $paid_amount) = number_of_payments($invoice); |
... | ... | |
637 | 657 |
payment_type => 'difference_as_skonto', |
638 | 658 |
chart_id => $bank_account->chart_id, |
639 | 659 |
transdate => $transdate1, |
660 |
bt_id => $bt->id, |
|
640 | 661 |
); |
641 | 662 |
|
642 | 663 |
my ($number_of_payments, $paid_amount) = number_of_payments($invoice); |
... | ... | |
665 | 686 |
# default values |
666 | 687 |
my %params = ( chart_id => $bank_account->chart_id, |
667 | 688 |
transdate => $transdate1, |
689 |
bt_id => $bt->id, |
|
668 | 690 |
); |
669 | 691 |
|
670 | 692 |
$params{amount} = '2.32'; |
... | ... | |
705 | 727 |
# default values |
706 | 728 |
my %params = ( chart_id => $bank_account->chart_id, |
707 | 729 |
transdate => $transdate1, |
730 |
bt_id => $bt->id, |
|
708 | 731 |
); |
709 | 732 |
|
710 | 733 |
$params{amount} = '6.95'; |
... | ... | |
756 | 779 |
|
757 | 780 |
my $ap_transaction = new_ap_transaction(); |
758 | 781 |
|
759 |
my %params = ( chart_id => $bank_account->chart_id, |
|
782 |
my %params = ( chart_id => $bank_account->chart_id,
|
|
760 | 783 |
transdate => $transdate1, |
784 |
bt_id => $bt->id, |
|
761 | 785 |
); |
762 | 786 |
|
763 | 787 |
# $params{amount} = '226'; # pass full amount |
... | ... | |
817 | 841 |
payment_type => 'difference_as_skonto', |
818 | 842 |
chart_id => $bank_account->chart_id, |
819 | 843 |
transdate => $transdate1, |
844 |
bt_id => $bt->id, |
|
820 | 845 |
); |
821 | 846 |
|
822 | 847 |
my ($number_of_payments, $paid_amount) = number_of_payments($ap_transaction); |
... | ... | |
844 | 869 |
# default values |
845 | 870 |
my %params = ( chart_id => $bank_account->chart_id, |
846 | 871 |
transdate => $transdate1, |
872 |
bt_id => $bt->id, |
|
847 | 873 |
); |
848 | 874 |
|
849 | 875 |
$params{amount} = $invoice->amount_less_skonto; |
... | ... | |
880 | 906 |
# default values |
881 | 907 |
my %params = ( chart_id => $bank_account->chart_id, |
882 | 908 |
transdate => $transdate1, |
909 |
bt_id => $bt->id, |
|
883 | 910 |
); |
884 | 911 |
|
885 | 912 |
$params{amount} = $invoice->amount_less_skonto; |
... | ... | |
915 | 942 |
# default values |
916 | 943 |
my %params = ( chart_id => $bank_account->chart_id, |
917 | 944 |
transdate => $transdate1, |
945 |
bt_id => $bt->id, |
|
918 | 946 |
); |
919 | 947 |
|
920 | 948 |
$params{amount} = $invoice->amount_less_skonto; |
... | ... | |
958 | 986 |
$invoice->pay_invoice( payment_type => 'difference_as_skonto', |
959 | 987 |
chart_id => $bank_account->chart_id, |
960 | 988 |
transdate => $transdate1, |
989 |
bt_id => $bt->id, |
|
961 | 990 |
); |
962 | 991 |
|
963 | 992 |
my ($number_of_payments, $paid_amount) = number_of_payments($invoice); |
Auch abrufbar als: Unified diff
Angepasster Testfall payment