Revision 14824095
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
109 | 109 |
# works for ap, but change sign for ar (todo credit notes and negative ap transactions |
110 | 110 |
$fx_gain_loss_amount *= -1 if $self->is_sales; |
111 | 111 |
$main::lxdebug->message(0, 'h 1 ' . $new_open_amount . ' h 3 ' . $params{amount} . ' und fx ' . $fx_gain_loss_amount ); |
112 |
if ($params{fx_book} && $new_open_amount < $params{amount}) { |
|
113 |
die "Bank Fees can only be added for AP transactions" if $self->is_sales; |
|
114 |
$self->_add_bank_fx_fees(fee => _round($params{amount} - $new_open_amount), |
|
115 |
bt_id => $params{bt_id}, |
|
116 |
bank_chart_id => $params{chart_id}, |
|
117 |
memo => $params{memo}, |
|
118 |
source => $params{source}, |
|
119 |
transdate_obj => $transdate_obj ); |
|
120 |
# invoice_amount |
|
121 |
$return_bank_amount += _round($params{amount} - $new_open_amount); |
|
122 |
} else { } |
|
123 |
# always use new open amount for payment booking and add this value to arap.paid |
|
124 |
$params{amount} = $new_open_amount; |
|
112 |
if ($new_open_amount < $params{amount}) { |
|
113 |
# if new open amount for payment booking is smaller than original amount use this |
|
114 |
# assume that the rest are fees, if the user selected this |
|
115 |
if($params{fx_book}) { |
|
116 |
die "Bank Fees can only be added for AP transactions" if $self->is_sales; |
|
117 |
$self->_add_bank_fx_fees(fee => _round($params{amount} - $new_open_amount), |
|
118 |
bt_id => $params{bt_id}, |
|
119 |
bank_chart_id => $params{chart_id}, |
|
120 |
memo => $params{memo}, |
|
121 |
source => $params{source}, |
|
122 |
transdate_obj => $transdate_obj ); |
|
123 |
# invoice_amount with gl booking |
|
124 |
$return_bank_amount = _round($params{amount}); |
|
125 |
} else { |
|
126 |
# invoice_amount without gl booking |
|
127 |
$return_bank_amount = $new_open_amount; |
|
128 |
} |
|
129 |
# with or without fees simply assign the new open amount for bank (fx_gain follows later) |
|
130 |
$params{amount} = $new_open_amount; |
|
131 |
} |
|
132 |
$main::lxdebug->message(0, 'return0 ' . $return_bank_amount); |
|
125 | 133 |
# $paid_amount = $new_open_amount; |
126 | 134 |
} elsif (!$self->forex) { # invoices uses default currency. no exchangerate |
127 | 135 |
$exchangerate = 1; |
Auch abrufbar als: Unified diff
Zu: Rückgabewert für invoice_amount auch wirklich aufaddieren. Fallunterschiede
Falls ein Dialogbuchung gemacht wird, diese berücksichtigen.
Falls der neu berechnete Betrag kleiner als vorher ist und die
Bank weniger bezahlt, entsprechend auch nur das ausbuchen.
Falls der neue Betrag größer ist, dann den vorherigen übergebenen Wert nutzen.