Revision 913d1c30
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/Controller/BankTransaction.pm | ||
---|---|---|
681 | 681 |
$open_amount -= $free_skonto_amount if ($payment_type eq 'free_skonto'); |
682 | 682 |
my $not_assigned_amount = abs($bank_transaction->not_assigned_amount); |
683 | 683 |
my $amount_for_payment = ($open_amount < $not_assigned_amount) ? $open_amount : $not_assigned_amount; |
684 |
my $amount_for_booking = ($open_amount < $not_assigned_amount) ? $open_amount : $not_assigned_amount; |
|
684 | 685 |
|
685 | 686 |
# get the right direction for the payment bookings (all amounts < 0 are stornos, credit notes or negative ap) |
686 | 687 |
$amount_for_payment *= -1 if $invoice->amount < 0; |
687 | 688 |
$free_skonto_amount *= -1 if ($free_skonto_amount && $invoice->amount < 0); |
688 | 689 |
# get the right direction for the bank transaction |
689 | 690 |
# sign is simply the sign of amount in bank_transactions: positive for increase and negative for decrease |
690 |
# $amount_for_booking *= $sign;
|
|
691 |
$amount_for_booking *= $sign; |
|
691 | 692 |
|
692 | 693 |
# check exchangerate and if fx_loss calculate new booking_amount for this invoice |
693 | 694 |
if ($fx_rate > 0) { |
... | ... | |
739 | 740 |
transdate => $bank_transaction->valutadate->to_kivitendo); |
740 | 741 |
# First element is the booked amount for accno bank |
741 | 742 |
my $booked_amount = shift @acc_ids; |
742 |
$bank_transaction->invoice_amount($bank_transaction->invoice_amount + $booked_amount * $sign); |
|
743 |
if (!$invoice->forex) { |
|
744 |
die "Invalid state, calculated invoice_amount differs from expected invoice amount" unless abs(abs($booked_amount) - abs($amount_for_booking)) < 0.001; |
|
745 |
$bank_transaction->invoice_amount($bank_transaction->invoice_amount + $amount_for_booking); |
|
746 |
} else { |
|
747 |
$bank_transaction->invoice_amount($bank_transaction->invoice_amount + $booked_amount * $sign); |
|
748 |
} |
|
743 | 749 |
# ... and record the origin via BankTransactionAccTrans |
744 | 750 |
if (scalar(@acc_ids) < 2) { |
745 | 751 |
return { |
Auch abrufbar als: Unified diff
BankTransaction: amount_for_booking wieder aktiv und im Fall FX gegenprüfen