Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 92044939

Von Jan Büren vor fast 2 Jahren hinzugefügt

  • ID 92044939404ebf0d2b4f04e68ebff45835f33c75
  • Vorgänger 8b1787aa
  • Nachfolger 5ef28dc4

Rückgabewert für invoice_amount auch wirklich aufaddieren. Ferner ...

... Wechselkursgewinne auch im Nebenbuch erfassen.
OFFEN: erneuter manueller Test

Unterschiede anzeigen:

SL/DB/Helper/Payment.pm
93 93
  # currency has to be passed and caller has to be sure to assign it for a forex invoice
94 94
  # dies if called for a invoice with the default currency (TODO: Params::Validate before)
95 95
  my ($exchangerate, $currency, $fx_gain_loss_amount, $return_bank_amount);
96
  $return_bank_amount = 0;
96 97
  if ($params{currency} || $params{currency_id} && $self->forex) { # currency was specified
97 98
    $currency = SL::DB::Manager::Currency->find_by(name => $params{currency}) || SL::DB::Manager::Currency->find_by(id => $params{currency_id});
98 99
    # set exchangerate - no fallback
......
183 184
                                                   taxkey     => 0,
184 185
                                                   tax_id     => SL::DB::Manager::Tax->find_by(taxkey => 0)->id);
185 186
      $new_acc_trans->save;
186
      $return_bank_amount = $amount;
187
      $return_bank_amount += $amount; # dont exclude fx_booking ;-)
187 188
      push @new_acc_ids, $new_acc_trans->acc_trans_id;
188 189
      # deal with fxtransaction ...
189 190
      # if invoice exchangerate differs from exchangerate of payment
......
194 195
        my $fxloss_chart = SL::DB::Manager::Chart->find_by(id => $::instance_conf->get_fxloss_accno_id) || die "Can't determine fxloss chart";
195 196
        $main::lxdebug->message(0, 'was sagt gain loss' . $fx_gain_loss_amount);
196 197
        my $gain_loss_chart  = $fx_gain_loss_amount > 0 ? $fxgain_chart : $fxloss_chart;
197
        $paid_amount += $fx_gain_loss_amount if $fx_gain_loss_amount < 0; # only add if we have fx_loss
198
        $paid_amount += abs($fx_gain_loss_amount); # if $fx_gain_loss_amount < 0; # only add if we have fx_loss
198 199
        $main::lxdebug->message(0, 'paid2 ' . $paid_amount);
199 200
        $main::lxdebug->message(0, 'paid2chart ' . $fx_gain_loss_amount);
200 201
        # $fx_gain_loss_amount = $gain_loss_amount;

Auch abrufbar als: Unified diff