Revision d74edabe
Von Jan Büren vor etwa 2 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
120 | 120 |
memo => $params{memo}, |
121 | 121 |
source => $params{source}, |
122 | 122 |
transdate_obj => $transdate_obj ); |
123 |
# invoice_amount with gl booking
|
|
124 |
$return_bank_amount = _round($params{amount});
|
|
123 |
# invoice_amount add gl booking
|
|
124 |
$return_bank_amount += _round($params{amount} - $new_open_amount);
|
|
125 | 125 |
} else { |
126 | 126 |
# invoice_amount without gl booking |
127 |
$return_bank_amount = $new_open_amount; |
|
127 |
# $return_bank_amount = $new_open_amount;
|
|
128 | 128 |
} |
129 | 129 |
# with or without fees simply assign the new open amount for bank (fx_gain follows later) |
130 | 130 |
$params{amount} = $new_open_amount; |
131 | 131 |
} |
132 |
$main::lxdebug->message(0, 'return0 ' . $return_bank_amount);
|
|
132 |
$main::lxdebug->message(0, 'return 1gl booking ' . $return_bank_amount); # stimmt f
|
|
133 | 133 |
# $paid_amount = $new_open_amount; |
134 | 134 |
} elsif (!$self->forex) { # invoices uses default currency. no exchangerate |
135 | 135 |
$exchangerate = 1; |
136 |
# $return_bank_amount = _round($params{amount}); # no forex |
|
136 | 137 |
} else { |
137 | 138 |
die "Cannot calculate exchange rate, if invoices uses the default currency"; |
138 | 139 |
} |
... | ... | |
192 | 193 |
taxkey => 0, |
193 | 194 |
tax_id => SL::DB::Manager::Tax->find_by(taxkey => 0)->id); |
194 | 195 |
$new_acc_trans->save; |
195 |
$return_bank_amount += $amount; # dont exclude fx_booking ;-) |
|
196 |
$return_bank_amount += abs($amount); # add sign |
|
197 |
$main::lxdebug->message(0, 'return 5 ' . $return_bank_amount); |
|
196 | 198 |
push @new_acc_ids, $new_acc_trans->acc_trans_id; |
197 | 199 |
# deal with fxtransaction ... |
198 | 200 |
# if invoice exchangerate differs from exchangerate of payment |
... | ... | |
204 | 206 |
$main::lxdebug->message(0, 'was sagt gain loss' . $fx_gain_loss_amount); |
205 | 207 |
my $gain_loss_chart = $fx_gain_loss_amount > 0 ? $fxgain_chart : $fxloss_chart; |
206 | 208 |
# $paid_amount += abs($fx_gain_loss_amount); # if $fx_gain_loss_amount < 0; # only add if we have fx_loss |
207 |
$paid_amount += $fx_gain_loss_amount if $fx_gain_loss_amount < 0; # only add if we have fx_loss |
|
209 |
$paid_amount += abs($fx_gain_loss_amount) if $fx_gain_loss_amount < 0; # only add if we have fx_loss |
|
210 |
$paid_amount -= abs($fx_gain_loss_amount) if $fx_gain_loss_amount > 0; # but extract if we have gain to match original invoice amount (ar) |
|
211 |
$main::lxdebug->message(0, 'return 1 ' . $return_bank_amount); |
|
212 |
$main::lxdebug->message(0, 'paid amount hier 2 ' . $paid_amount); |
|
213 |
# $return_bank_amount += $fx_gain_loss_amount if $fx_gain_loss_amount < 0; # only add if we have fx_loss |
|
208 | 214 |
|
209 |
$main::lxdebug->message(0, 'paid2 ' . $paid_amount); |
|
210 | 215 |
$main::lxdebug->message(0, 'paid2chart ' . $fx_gain_loss_amount); |
216 |
$main::lxdebug->message(0, 'return 2 ' . $return_bank_amount); |
|
211 | 217 |
# $fx_gain_loss_amount = $gain_loss_amount; |
212 | 218 |
|
213 | 219 |
$new_acc_trans = SL::DB::AccTransaction->new(trans_id => $self->id, |
Auch abrufbar als: Unified diff
Testfälle Verkaufsrechnung Nebenbuch und Bankzuweisung i.O. Debugs drin
Bei Wechselkursverlusten entsprechend im Nebenbuch abziehen und bei
Gewinnen addieren. Rückgabewert an Bankzuweisung auch summieren