Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c97d4a0a

Von Jan Büren vor fast 8 Jahren hinzugefügt

  • ID c97d4a0aaaaced4399a04a93f2c19d477439a92e
  • Vorgänger d301d97a
  • Nachfolger 64bfffde

Testfall Verbuchen Kontoauszug zu Kreditorenbeleg ergänzt

Sehr viele Tests für ar, nur einen speziellen für ap.

Unterschiede anzeigen:

t/bank/bank_transactions.t
1
use Test::More tests => 75;
1
use Test::More tests => 82;
2 2

  
3 3
use strict;
4 4

  
......
73 73
test_partial_payment();
74 74
test_credit_note();
75 75
test_neg_ap_transaction();
76

  
76
test_ap_payment_transaction();
77 77
# remove all created data at end of test
78 78
clear_up();
79 79

  
......
487 487
  return $invoice;
488 488
};
489 489

  
490
sub test_ap_payment_transaction {
491
  my (%params) = @_;
492
  my $testname = 'test_ap_two_transaction';
493
  my $netamount = 115;
494
  my $amount    = $::form->round_amount($netamount * 1.19,2);
495
  my $invoice   = SL::DB::PurchaseInvoice->new(
496
    invoice      => 0,
497
    invnumber    => $params{invnumber} || 'test_ap_two_transaction',
498
    amount       => $amount,
499
    netamount    => $netamount,
500
    transdate    => $transdate1,
501
    taxincluded  => 0,
502
    vendor_id    => $vendor->id,
503
    taxzone_id   => $vendor->taxzone_id,
504
    currency_id  => $currency_id,
505
    transactions => [],
506
    notes        => 'test_ap_transaction',
507
  );
508
  $invoice->add_ap_amount_row(
509
    amount     => $invoice->netamount,
510
    chart      => $ap_amount_chart,
511
    tax_id     => $tax_9->id,
512
  );
513

  
514
  $invoice->create_ap_row(chart => $ap_chart);
515
  $invoice->save;
516

  
517
  is($invoice->netamount, 115  , "$testname: netamount ok");
518
  is($invoice->amount   , 136.85, "$testname: amount ok");
519

  
520
  my $bt            = SL::Dev::Payment::create_bank_transaction(record        => $invoice,
521
                                                                amount        => $invoice->amount,
522
                                                                bank_chart_id => $bank->id,
523
                                                                transdate     => DateTime->today->add(days => 10),
524
                                                               );
525
  $::form->{invoice_ids} = {
526
    $bt->id => [ $invoice->id ]
527
  };
528

  
529
  save_btcontroller_to_string();
530

  
531
  $invoice->load;
532
  $bt->load;
533

  
534
  is($invoice->amount   , '136.85000', "$testname: amount ok");
535
  is($invoice->netamount, '115.00000', "$testname: netamount ok");
536
  is($bt->amount, '-136.85000', "$testname: bt amount ok");
537
  is($invoice->paid     , '136.85000', "$testname: paid ok");
538
  is($bt->invoice_amount, '-136.85000', "$testname: bt invoice amount for ap was assigned");
539

  
540
  return $invoice;
541
};
490 542
1;

Auch abrufbar als: Unified diff