Revision 705d2fe1
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/Controller/BankTransaction.pm | ||
---|---|---|
670 | 670 |
} |
671 | 671 |
# pay invoice |
672 | 672 |
# TODO rewrite this: really booked amount should be a return value of Payment.pm |
673 |
# -> quick and dirty done -> really booked amount is the first element of return array |
|
673 | 674 |
# also this controller shouldnt care about how to calc skonto. we simply delegate the |
674 | 675 |
# payment_type to the helper and get the corresponding bank_transaction values back |
675 | 676 |
# hotfix to get the signs right - compare absolute values and later set the signs |
... | ... | |
703 | 704 |
currency_id => $currency_id, |
704 | 705 |
bt_id => $bt_id, |
705 | 706 |
transdate => $bank_transaction->valutadate->to_kivitendo); |
707 |
# First element is the booked amount for accno bank |
|
706 | 708 |
my $booked_amount = shift @acc_ids; |
707 |
use Data::Dumper; |
|
708 |
$main::lxdebug->message(0, 'hier1:' .Dumper $booked_amount); |
|
709 |
$main::lxdebug->message(0, 'hier2:' .Dumper @acc_ids); |
|
710 | 709 |
$bank_transaction->invoice_amount($bank_transaction->invoice_amount + $booked_amount * $sign); |
711 | 710 |
# ... and record the origin via BankTransactionAccTrans |
712 | 711 |
if (scalar(@acc_ids) < 2) { |
SL/DB/Helper/Payment.pm | ||
---|---|---|
137 | 137 |
my $rounded_params_amount = _round( $params{amount} ); # / $exchangerate); |
138 | 138 |
my $fx_gain_loss_amount = 0; # for fx_gain and fx_loss |
139 | 139 |
|
140 |
my $return_bank_amount; # will be returned for invoice_amount |
|
140 | 141 |
my $db = $self->db; |
141 | 142 |
$db->with_transaction(sub { |
142 | 143 |
my $new_acc_trans; |
... | ... | |
162 | 163 |
|
163 | 164 |
|
164 | 165 |
# total amount against bank, do we already know this by now? |
166 |
# Yes, method requires this |
|
165 | 167 |
$new_acc_trans = SL::DB::AccTransaction->new(trans_id => $self->id, |
166 | 168 |
chart_id => $account_bank->id, |
167 | 169 |
chart_link => $account_bank->link, |
... | ... | |
386 | 388 |
1; |
387 | 389 |
|
388 | 390 |
}) || die t8('error while paying invoice #1 : ', $self->invnumber) . $db->error . "\n"; |
389 |
|
|
390 |
$return_bank_amount *= -1; # negative booking is positive bank transaction |
|
391 |
# positive booking is negative bank transaction |
|
392 |
return wantarray ? ( { return_bank_amount => $return_bank_amount }, @new_acc_ids) : 1; |
|
391 |
return wantarray ? (abs($return_bank_amount), @new_acc_ids) : 1; |
|
393 | 392 |
} |
394 | 393 |
|
395 | 394 |
sub skonto_date { |
Auch abrufbar als: Unified diff
pay_invoice git als ersten Wert den verbuchten Betrag der Bankbuchung zurück