Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ace13a46

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

  • ID ace13a46b4c48674267d176c3c641930a444d48b
  • Vorgänger a3d195e8
  • Nachfolger 4acd2783

behebt #356 Bei Zuweisung von zwei Kreditorengutschrift per Kontoauszug verbuchen fehlerhaft

Programmkorrektur für Testfall #b75c6cbb82023b0d6

Unterschiede anzeigen:

SL/Controller/BankTransaction.pm
655 655
                              memo         => $memo,
656 656
                              transdate    => $bank_transaction->transdate->to_kivitendo);
657 657
      } else {
658
        # use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary
659

  
660
        # this catches credit_notes and negative sales invoices
661
        if ( $invoice->is_sales && $invoice->amount < 0 ) {
662
          # $invoice->open_amount     is negative for credit_notes
663
          # $bank_transaction->amount is negative for outgoing transactions
664
          # so $amount_of_transaction is negative but needs positive
665
          $amount_of_transaction *= -1;
666

  
667
        } elsif (!$invoice->is_sales && $invoice->invoice_type =~ m/ap_transaction|purchase_invoice/) {
668
          # $invoice->open_amount may be negative for ap_transaction but may be positiv for negativ ap_transaction
669
          # if $invoice->open_amount is negative $bank_transaction->amount is positve
670
          # if $invoice->open_amount is positive $bank_transaction->amount is negative
671
          # but amount of transaction is for both positive
672
          $amount_of_transaction *= -1 if $invoice->open_amount == - $amount_of_transaction;
673
        }
658
      # use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary
659

  
660
        # $invoice->open_amount     is negative for credit_notes
661
        # $bank_transaction->amount is negative for outgoing transactions
662
        # so $amount_of_transaction is negative but needs positive
663
        # $invoice->open_amount may be negative for ap_transaction but may be positiv for negative ap_transaction
664
        # if $invoice->open_amount is negative $bank_transaction->amount is positve
665
        # if $invoice->open_amount is positive $bank_transaction->amount is negative
666
        # but amount of transaction is for both positive
667

  
668
        $amount_of_transaction *= -1 if ($invoice->amount < 0);
669

  
670
        # if we have a skonto case - the last invoice needs skonto
671
        $amount_of_transaction = $invoice->amount_less_skonto if ($payment_type eq 'with_skonto_pt');
672

  
674 673

  
675 674
        my $overpaid_amount = $amount_of_transaction - $invoice->open_amount;
676 675
        $invoice->pay_invoice(chart_id     => $bank_transaction->local_bank_account->chart_id,

Auch abrufbar als: Unified diff