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