push @{ $self->problems }, $self->save_single_bank_transaction(
bank_transaction_id => $bank_transaction_id,
invoice_ids => $invoice_ids,
push @{ $self->problems }, $self->save_single_bank_transaction(
bank_transaction_id => $bank_transaction_id,
invoice_ids => $invoice_ids,
trans_id => $invoice->id,
amount => $open_amount,
payment_type => $payment_type,
trans_id => $invoice->id,
amount => $open_amount,
payment_type => $payment_type,
transdate => $bank_transaction->transdate->to_kivitendo);
} elsif ( $invoice->is_sales && $invoice->type eq 'credit_note' ) {
# no check for overpayment/multiple payments
transdate => $bank_transaction->transdate->to_kivitendo);
} elsif ( $invoice->is_sales && $invoice->type eq 'credit_note' ) {
# no check for overpayment/multiple payments
trans_id => $invoice->id,
amount => $invoice->open_amount,
payment_type => $payment_type,
trans_id => $invoice->id,
amount => $invoice->open_amount,
payment_type => $payment_type,
transdate => $bank_transaction->transdate->to_kivitendo);
} else { # use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary
my $overpaid_amount = $amount_of_transaction - $invoice->open_amount;
transdate => $bank_transaction->transdate->to_kivitendo);
} else { # use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary
my $overpaid_amount = $amount_of_transaction - $invoice->open_amount;
trans_id => $invoice->id,
amount => $amount_of_transaction,
payment_type => $payment_type,
trans_id => $invoice->id,
amount => $amount_of_transaction,
payment_type => $payment_type,
transdate => $bank_transaction->transdate->to_kivitendo);
$bank_transaction->invoice_amount($bank_transaction->amount);
$amount_of_transaction = 0;
transdate => $bank_transaction->transdate->to_kivitendo);
$bank_transaction->invoice_amount($bank_transaction->amount);
$amount_of_transaction = 0;