Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 17d23bd0

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

  • ID 17d23bd0b1f7ee320c077022adc184a46fd46eb1
  • Vorgänger 3a6b2c3a
  • Nachfolger 28c774bc

Wechselkurse für Belege oder Zahlungen für ar und ap holen und berechnen

Unterschiede anzeigen:

bin/mozilla/ar.pl
476 476

  
477 477
  my @payments;
478 478
  for my $i (1 .. $form->{paidaccounts}) {
479
    # hook for calc of of fx_paid and check if banktransaction has a record exchangerate
480
    if ($form->{"exchangerate_$i"}) {
481
      my $bt_acc_trans;
482
      my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"});
483
        if ($bt_acc_trans) {
484
          if ($bt_acc_trans->bank_transaction->exchangerate > 0) {
485
            $form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate;
486
            $form->{"forex_$i"}        = $form->{"exchangerate_$i"};
487
            $form->{"record_forex_$i"} = 1;
488
          }
489
        }
490
      $form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"};
491
      $form->{"fx_totalpaid"} +=  $form->{"fx_paid_$i"};
492
    } # end hook fx_paid
479 493
    my $payment = {
480 494
      paid             => $form->{"paid_$i"},
481 495
      exchangerate     => $form->{"exchangerate_$i"} || '',
......
485 499
      memo             => $form->{"memo_$i"},
486 500
      AR_paid          => $form->{"AR_paid_$i"},
487 501
      forex            => $form->{"forex_$i"},
502
      record_forex     => $form->{"record_forex_$i"},
488 503
      datepaid         => $form->{"datepaid_$i"},
489 504
      paid_project_id  => $form->{"paid_project_id_$i"},
490 505
      gldate           => $form->{"gldate_$i"},
506
      fx_paid          => $form->{"fx_paid_$i"},
507
      fx_totalpaid     => $form->{"fx_totalpaid_$i"},
491 508
    };
492 509

  
493 510
    # default account for current assets (i.e. 1801 - SKR04) if no account is selected
......
534 551
  );
535 552

  
536 553
  setup_ar_form_header_action_bar();
554
  $::form->{paid_missing} =  $form->{is_linked_bank_transaction} && $form->{invoice_obj}->forex ?
555
                           $form->{invoice_obj}->open_amount
556
                        :  $::form->{invtotal} - $::form->{totalpaid};
537 557

  
538 558
  $form->header;
539 559
  print $::form->parse_html_template('ar/form_header', {
540
    paid_missing         => $::form->{invtotal} - $::form->{totalpaid},
560
    paid_missing         => $::form->{paidmissing},
541 561
    show_exch            => ($::form->{defaultcurrency} && ($::form->{currency} ne $::form->{defaultcurrency})),
542 562
    payments             => \@payments,
543 563
    transactions         => \@transactions,
......
1372 1392

  
1373 1393
  my $is_linked_bank_transaction;
1374 1394
  if ($::form->{id}
1375
      && SL::DB::Default->get->payments_changeable != 0
1376 1395
      && SL::DB::Manager::BankTransactionAccTrans->find_by(ar_id => $::form->{id})) {
1377 1396

  
1378 1397
    $is_linked_bank_transaction = 1;
......
1386 1405
                      : ($::form->{id} && $change_on_same_day_only) ? 1
1387 1406
                      : $is_linked_bank_transaction                 ? 1
1388 1407
                      : 0;
1408
  # and is_linked_bank_transaction
1409
  $::form->{is_linked_bank_transaction} = $is_linked_bank_transaction;
1389 1410
  for my $bar ($::request->layout->get('actionbar')) {
1390 1411
    $bar->add(
1391 1412
      action => [

Auch abrufbar als: Unified diff