Revision 29ecf3e8
Von Jan Büren vor mehr als 8 Jahren hinzugefügt
SL/Controller/BankTransaction.pm | ||
---|---|---|
398 | 398 |
} |
399 | 399 |
# pay invoice or go to the next bank transaction if the amount is not sufficiently high |
400 | 400 |
if ($invoice->open_amount <= $amount_of_transaction) { |
401 |
$invoice->pay_invoice(chart_id => $bank_transaction->local_bank_account->chart_id, |
|
402 |
trans_id => $invoice->id, |
|
403 |
amount => $invoice->open_amount, |
|
404 |
payment_type => $payment_type, |
|
405 |
transdate => $bank_transaction->transdate->to_kivitendo); |
|
401 |
# first calculate new bank transaction amount ... |
|
406 | 402 |
if ($invoice->is_sales) { |
407 | 403 |
$amount_of_transaction -= $sign * $invoice->open_amount; |
408 | 404 |
$bank_transaction->invoice_amount($bank_transaction->invoice_amount + $invoice->open_amount); |
... | ... | |
410 | 406 |
$amount_of_transaction += $sign * $invoice->open_amount if (!$invoice->is_sales); |
411 | 407 |
$bank_transaction->invoice_amount($bank_transaction->invoice_amount - $invoice->open_amount); |
412 | 408 |
} |
409 |
# ... and then pay the invoice |
|
410 |
$invoice->pay_invoice(chart_id => $bank_transaction->local_bank_account->chart_id, |
|
411 |
trans_id => $invoice->id, |
|
412 |
amount => $invoice->open_amount, |
|
413 |
payment_type => $payment_type, |
|
414 |
transdate => $bank_transaction->transdate->to_kivitendo); |
|
413 | 415 |
} else { |
414 | 416 |
$invoice->pay_invoice(chart_id => $bank_transaction->local_bank_account->chart_id, |
415 | 417 |
trans_id => $invoice->id, |
Auch abrufbar als: Unified diff
Bankauszug verbuchen invoice_amount vor pay-invoice
Die Reihenfolge der Verarbeitung des Bankausszugs ist jetzt
wichtig. Vorher wurde einfach der Betrag der gesamten Rechnung
abgezogen, jetzt ist es nur noch der offene Betrag, der nach
der Zahlungsverbuchung dann auf 0 ist. Deshalb vorher ...