Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision aa8bfdd2

Von Jan Büren vor mehr als 5 Jahren hinzugefügt

  • ID aa8bfdd2331283841bb804a991b251ab5d72c0b8
  • Vorgänger f0541fe3
  • Nachfolger 822f5cf7

Bankverbuchungen: freies Skonto auch abziehen. Code-Vereinfachung (not_assigned)

Vergessen, den freien Skonto-Betrag von invoice_amount
abzuziehen. Not-Aus-Schalter in feeb3fc8352. Jetzt auch
im Controller saubere Fehlermeldung ausgeben.

Unterschiede anzeigen:

SL/Controller/BankTransaction.pm
570 570
  my $worker = sub {
571 571
    my $bt_id                 = $data{bank_transaction_id};
572 572
    my $sign                  = $bank_transaction->amount < 0 ? -1 : 1;
573
    my $not_assigned_amount   = $bank_transaction->not_assigned_amount;
574 573
    my $payment_received      = $bank_transaction->amount > 0;
575 574
    my $payment_sent          = $bank_transaction->amount < 0;
576 575

  
......
617 616
      my $memo   = ($data{memos}   // [])->[$n_invoices];
618 617

  
619 618
      $n_invoices++ ;
620

  
621

  
622
      if (!$not_assigned_amount && $invoice->open_amount) {
619
      if (   ($payment_sent     && $bank_transaction->not_assigned_amount >= 0)
620
          || ($payment_received && $bank_transaction->not_assigned_amount <= 0)) {
623 621
        return {
624 622
          %data,
625 623
          result  => 'error',
......
654 652
    # should be better done elsewhere - changing not_assigned_amount to abs feels seriously bogus
655 653

  
656 654
    my $open_amount = $payment_type eq 'with_skonto_pt' ? $invoice->amount_less_skonto : $invoice->open_amount;
657
    $open_amount         = abs($open_amount);
658
    $not_assigned_amount = abs($not_assigned_amount);
659
    my $amount_for_booking = ($open_amount < $not_assigned_amount) ? $open_amount : $not_assigned_amount;
660
    my $amount_for_payment = $amount_for_booking;
655
    $open_amount            = abs($open_amount);
656
    $open_amount           -= $free_skonto_amount if ($payment_type eq 'free_skonto');
657
    my $not_assigned_amount = abs($bank_transaction->not_assigned_amount);
658
    my $amount_for_booking  = ($open_amount < $not_assigned_amount) ? $open_amount : $not_assigned_amount;
659
    my $amount_for_payment  = $amount_for_booking;
661 660

  
662 661
    # get the right direction for the payment bookings (all amounts < 0 are stornos, credit notes or negative ap)
663 662
    $amount_for_payment *= -1 if $invoice->amount < 0;

Auch abrufbar als: Unified diff