Revision ace13a46
Von Jan Büren vor mehr als 6 Jahren hinzugefügt
SL/Controller/BankTransaction.pm | ||
---|---|---|
memo => $memo,
|
||
transdate => $bank_transaction->transdate->to_kivitendo);
|
||
} else {
|
||
# use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary
|
||
|
||
# this catches credit_notes and negative sales invoices
|
||
if ( $invoice->is_sales && $invoice->amount < 0 ) {
|
||
# $invoice->open_amount is negative for credit_notes
|
||
# $bank_transaction->amount is negative for outgoing transactions
|
||
# so $amount_of_transaction is negative but needs positive
|
||
$amount_of_transaction *= -1;
|
||
|
||
} elsif (!$invoice->is_sales && $invoice->invoice_type =~ m/ap_transaction|purchase_invoice/) {
|
||
# $invoice->open_amount may be negative for ap_transaction but may be positiv for negativ ap_transaction
|
||
# if $invoice->open_amount is negative $bank_transaction->amount is positve
|
||
# if $invoice->open_amount is positive $bank_transaction->amount is negative
|
||
# but amount of transaction is for both positive
|
||
$amount_of_transaction *= -1 if $invoice->open_amount == - $amount_of_transaction;
|
||
}
|
||
# use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary
|
||
|
||
# $invoice->open_amount is negative for credit_notes
|
||
# $bank_transaction->amount is negative for outgoing transactions
|
||
# so $amount_of_transaction is negative but needs positive
|
||
# $invoice->open_amount may be negative for ap_transaction but may be positiv for negative ap_transaction
|
||
# if $invoice->open_amount is negative $bank_transaction->amount is positve
|
||
# if $invoice->open_amount is positive $bank_transaction->amount is negative
|
||
# but amount of transaction is for both positive
|
||
|
||
$amount_of_transaction *= -1 if ($invoice->amount < 0);
|
||
|
||
# if we have a skonto case - the last invoice needs skonto
|
||
$amount_of_transaction = $invoice->amount_less_skonto if ($payment_type eq 'with_skonto_pt');
|
||
|
||
|
||
my $overpaid_amount = $amount_of_transaction - $invoice->open_amount;
|
||
$invoice->pay_invoice(chart_id => $bank_transaction->local_bank_account->chart_id,
|
Auch abrufbar als: Unified diff
behebt #356 Bei Zuweisung von zwei Kreditorengutschrift per Kontoauszug verbuchen fehlerhaft
Programmkorrektur für Testfall #b75c6cbb82023b0d6