Projekt

Allgemein

Profil

Fehler #244 » Payment.pm.patch

Jan Büren, 15.05.2017 16:51

Unterschiede anzeigen:

SL/DB/Helper/Payment.pm
# deal with fxtransaction
if ( $self->currency_id != $::instance_conf->get_currency_id ) {
my $fxamount = _round($amount - ($amount * $exchangerate));
$new_acc_trans = SL::DB::AccTransaction->new(trans_id => $self->id,
chart_id => $account_bank->id,
chart_link => $account_bank->link,
amount => $fxamount * -1,
transdate => $transdate_obj,
source => $source,
memo => $memo,
taxkey => 0,
fx_transaction => 1,
tax_id => SL::DB::Manager::Tax->find_by(taxkey => 0)->id);
$new_acc_trans->save;
# if invoice exchangerate differs from exchangerate of payment
# if invoice exchangerate differs from exchangerate of payment
# deal with fxloss and fxamount
if ($self->exchangerate and $self->exchangerate != 1 and $self->exchangerate != $exchangerate) {
my $fxgain_chart = SL::DB::Manager::Chart->find_by(id => $::instance_conf->get_fxgain_accno_id) || die "Can't determine fxgain chart";
......
fx_transaction => 0,
tax_id => SL::DB::Manager::Tax->find_by(taxkey => 0)->id);
$new_acc_trans->save;
my $fxamount = _round($amount - ($amount * $exchangerate));
$new_acc_trans = SL::DB::AccTransaction->new(trans_id => $self->id,
chart_id => $account_bank->id,
chart_link => $account_bank->link,
amount => $fxamount * -1,
transdate => $transdate_obj,
source => $source,
memo => $memo,
taxkey => 0,
fx_transaction => 1,
tax_id => SL::DB::Manager::Tax->find_by(taxkey => 0)->id);
$new_acc_trans->save;
};
};
};
......
my $arap_booking= SL::DB::AccTransaction->new(trans_id => $self->id,
chart_id => $reference_account->id,
chart_link => $reference_account->link,
amount => _round($arap_amount * $mult * $exchangerate - $fx_gain_loss_amount),
amount => _round($arap_amount * $mult),
transdate => $transdate_obj,
source => '', #$params{source},
taxkey => 0,
    (1-1/1)