Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 853e4147

Von Kivitendo Admin vor 10 Monaten hinzugefügt

  • ID 853e414749386a731a9af4eb0ac583a5056016ce
  • Vorgänger 877a603b
  • Nachfolger a371de77

Debitorenbuchungen - fx_paid -> defaultcurrency_paid

siehe Ticket #563, Währung und Fremdwährung waren vertauscht.

Unterschiede anzeigen:

bin/mozilla/ar.pl
515 515
  my $now = $form->current_date(\%myconfig);
516 516

  
517 517
  my @payments;
518

  
519
  # reset form value of defaultcurrency_totalpaid, as it is currently a hidden and otherwise it gets accumulated after each update
520
  # is only used if there are exchange rates
521
  $form->{"defaultcurrency_totalpaid"} = 0;
522

  
518 523
  for my $i (1 .. $form->{paidaccounts}) {
519
    # hook for calc of of fx_paid and check if banktransaction has a record exchangerate
520
    if ($form->{"exchangerate_$i"}) {
524
    # hook for calc of of defaultcurrency_paid and check if banktransaction has a record exchangerate
525
    if ($form->{"exchangerate_$i"} && $form->{"acc_trans_id_$i"}) {
526
      # only check for bank transactions for payments that have already been saved
521 527
      my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"});
522
        if ($bt_acc_trans) {
523
          if ($bt_acc_trans->bank_transaction->exchangerate > 0) {
524
            $form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate;
525
            $form->{"forex_$i"}        = $form->{"exchangerate_$i"};
526
            $form->{"record_forex_$i"} = 1;
527
          }
528
      if ($bt_acc_trans) {
529
        if ($bt_acc_trans->bank_transaction->exchangerate > 0) {
530
          $form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate;
531
          $form->{"forex_$i"}        = $form->{"exchangerate_$i"};
532
          $form->{"record_forex_$i"} = 1;
528 533
        }
529
      $form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"};
530
      $form->{"fx_totalpaid"} +=  $form->{"fx_paid_$i"};
531
    } # end hook fx_paid
534
      }
535
      $form->{"defaultcurrency_paid_$i"} = $form->{"paid_$i"} * $form->{"exchangerate_$i"};
536
      $form->{"defaultcurrency_totalpaid"} += $form->{"defaultcurrency_paid_$i"};
537
    } # end hook defaultcurrency_paid
538

  
532 539
    my $payment = {
533 540
      paid             => $form->{"paid_$i"},
534 541
      exchangerate     => $form->{"exchangerate_$i"} || '',
......
542 549
      datepaid         => $form->{"datepaid_$i"},
543 550
      paid_project_id  => $form->{"paid_project_id_$i"},
544 551
      gldate           => $form->{"gldate_$i"},
545
      fx_paid          => $form->{"fx_paid_$i"},
546
      fx_totalpaid     => $form->{"fx_totalpaid_$i"},
552
      # only used if we have an fx currency
553
      defaultcurrency_paid      => $form->{"defaultcurrency_paid_$i"},
554
      defaultcurrency_totalpaid => $form->{"defaultcurrency_totalpaid_$i"},
547 555
    };
548 556

  
549 557
    # default account for current assets (i.e. 1801 - SKR04) if no account is selected

Auch abrufbar als: Unified diff