Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 607163f5

Von Jan Büren vor mehr als 1 Jahr hinzugefügt

  • ID 607163f518b31e6b0f5d2b9d752cc349f08c6828
  • Vorgänger f909691a
  • Nachfolger 7b349901

Wechselkurse für Zahlungen in Einkauf- und Verkaufsrechnung anzeigen

Unterschiede anzeigen:

bin/mozilla/is.pl
235 235
        $form->{"memo_$i"}         = $form->{acc_trans}{$key}->[$i - 1]->{memo};
236 236

  
237 237
        $form->{paidaccounts} = $i;
238
        # hook for calc of of fx_paid and check if banktransaction has a record exchangerate
239
        if ($form->{"exchangerate_$i"}) {
240
          my $bt_acc_trans;
241
          my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"});
242
          if ($bt_acc_trans) {
243
            if ($bt_acc_trans->bank_transaction->exchangerate > 0) {
244
              $form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate;
245
              $form->{"forex_$i"}        = $form->{"exchangerate_$i"};
246
              $form->{"record_forex_$i"} = 1;
247
            }
248
          }
249
          $form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"};
250
          $form->{"fx_totalpaid"} +=  $form->{"fx_paid_$i"};
251
        } # end hook fx_paid
238 252
      }
239 253
    } else {
240 254
      $form->{$key} = "$form->{acc_trans}{$key}->[0]->{accno}--$form->{acc_trans}{$key}->[0]->{description}";
......
863 877

  
864 878
  $form->{taxincluded} ||= $taxincluded;
865 879

  
866
  if (!$form->{forex}) {        # read exchangerate from input field (not hidden)
867
    $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call;
880
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
881
  if ($form->{defaultcurrency} ne $form->{currency}) {
882
    if ($form->{exchangerate}) { # user input OR first default ->  leave this value
883
      $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call;
884
      # does this differ from daily default?
885
      my $current_daily_rate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy');
886
      $form->{record_forex}  = $current_daily_rate > 0 && $current_daily_rate != $form->{exchangerate}
887
                           ?   1 : 0;
888
    } else {                     # no value, but get defaults -> maybe user changes invdate as well ...
889
      ($form->{exchangerate}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency},
890
                                                                                 $form->{invdate}, 'buy', $form->{id}, 'ar');
891
    }
868 892
  }
869
  ($form->{forex}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency},
870
                                                                      $form->{invdate}, 'buy', $form->{id}, 'ar');
871
  $form->{exchangerate} = $form->{forex} if $form->{forex};
872 893
  for my $i (1 .. $form->{paidaccounts}) {
873 894
    next unless $form->{"paid_$i"};
874 895
    map { $form->{"${_}_$i"}   = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate);

Auch abrufbar als: Unified diff