Revision 794dda68
Von Jan Büren vor etwa 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 | ||
---|---|---|
136 | 136 |
my $rounded_params_amount = _round( $params{amount} ); # / $exchangerate); |
137 | 137 |
my $fx_gain_loss_amount = 0; # for fx_gain and fx_loss |
138 | 138 |
|
139 |
my $return_bank_amount; # will be returned for invoice_amount |
|
139 | 140 |
my $db = $self->db; |
140 | 141 |
$db->with_transaction(sub { |
141 | 142 |
my $new_acc_trans; |
... | ... | |
161 | 162 |
|
162 | 163 |
|
163 | 164 |
# total amount against bank, do we already know this by now? |
165 |
# Yes, method requires this |
|
164 | 166 |
$new_acc_trans = SL::DB::AccTransaction->new(trans_id => $self->id, |
165 | 167 |
chart_id => $account_bank->id, |
166 | 168 |
chart_link => $account_bank->link, |
... | ... | |
381 | 383 |
1; |
382 | 384 |
|
383 | 385 |
}) || die t8('error while paying invoice #1 : ', $self->invnumber) . $db->error . "\n"; |
384 |
return wantarray ? @new_acc_ids : 1;
|
|
386 |
return wantarray ? (abs($return_bank_amount), @new_acc_ids) : 1;
|
|
385 | 387 |
} |
386 | 388 |
|
387 | 389 |
sub skonto_date { |
Auch abrufbar als: Unified diff
pay_invoice git als ersten Wert den verbuchten Betrag der Bankbuchung zurück