Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ae9cf413

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

  • ID ae9cf413f1b31fb47e21670d01623d6ddaedda11
  • Vorgänger 28b51413
  • Nachfolger debe22e0

Wechselkurs für Bankverbuchungen eingeben

Unterschiede anzeigen:

SL/Controller/BankTransaction.pm
513 513
      push @{ $self->problems }, $self->save_single_bank_transaction(
514 514
        bank_transaction_id => $bank_transaction_id,
515 515
        invoice_ids         => $invoice_ids,
516
        sources             => [  map { $::form->{"sources_${bank_transaction_id}_${_}"} } @{ $invoice_ids } ],
517
        memos               => [  map { $::form->{"memos_${bank_transaction_id}_${_}"}   } @{ $invoice_ids } ],
516
        sources             => [  map { $::form->{"sources_${bank_transaction_id}_${_}"}           } @{ $invoice_ids } ],
517
        memos               => [  map { $::form->{"memos_${bank_transaction_id}_${_}"}             } @{ $invoice_ids } ],
518
        book_fx_bank_fees   => [  map { $::form->{"book_fx_bank_fees_${bank_transaction_id}_${_}"} } @{ $invoice_ids } ],
519
        currency_ids        => [  map { $::form->{"currency_id_${bank_transaction_id}_${_}"}       } @{ $invoice_ids } ],
520
        exchangerates       => [  map { $::form->parse_amount(\%::myconfig, $::form->{"exchangerate_${bank_transaction_id}_${_}"}) } @{ $invoice_ids } ],
518 521
      );
519 522
      $count += scalar( @{$invoice_ids} );
520 523
    }
......
627 630
    my $n_invoices   = 0;
628 631

  
629 632
    foreach my $invoice (@{ $data{invoices} }) {
630
      my $source = ($data{sources} // [])->[$n_invoices];
631
      my $memo   = ($data{memos}   // [])->[$n_invoices];
633
      my $source  = ($data{sources} // [])->[$n_invoices];
634
      my $memo    = ($data{memos}   // [])->[$n_invoices];
635
      my $fx_rate = ($data{exchangerates} // [])->[$n_invoices];
636
      my $fx_book = ($data{book_fx_bank_fees}   // [])->[$n_invoices];
637
      my $currency_id = ($data{currency_ids}   // [])->[$n_invoices];
632 638

  
633 639
      $n_invoices++ ;
634 640
      # safety check invoice open
......
692 698
                          source        => $source,
693 699
                          memo          => $memo,
694 700
                          skonto_amount => $free_skonto_amount,
701
                          exchangerate  => $fx_rate,
702
                          fx_book       => $fx_book,
703
                          currency_id   => $currency_id,
695 704
                          bt_id         => $bt_id,
696 705
                          transdate     => $bank_transaction->valutadate->to_kivitendo);
697
    my $bank_amount = shift @acc_ids;
698
    die "Invalid state, calculated invoice_amount differs from expected invoice amount" unless (abs($bank_amount->{return_bank_amount}) - abs($amount_for_booking) < 0.001);
706
    my $booked_amount = shift @acc_ids;
707
    use Data::Dumper;
708
    $main::lxdebug->message(0, 'hier1:' .Dumper $booked_amount);
709
    $main::lxdebug->message(0, 'hier2:' .Dumper @acc_ids);
710
    $bank_transaction->invoice_amount($bank_transaction->invoice_amount + $booked_amount * $sign);
699 711
    # ... and record the origin via BankTransactionAccTrans
700 712
    if (scalar(@acc_ids) < 2) {
701 713
      return {
templates/webpages/bank_transactions/_payment_suggestion.html
12 12
 [% LxERP.t8("Open amount") %]: [% LxERP.format_amount(invoice.open_amount, 2) %]</br>
13 13
 [% P.select_tag("invoice_skontos." _ bt_id _ "[]", SELECT_OPTIONS, value_key="payment_type", title_key="display", onChange="kivi.BankTransaction.update_skonto(this, " _ bt_id _ ", " _ invoice.id _ ", '$formatted_skonto_amount')"  ) %]</br>
14 14
 [% LxERP.t8("Skonto amount") %]: [% P.input_tag("free_skonto_amount." _ bt_id _ "." _ invoice.id _ "", "$formatted_skonto_amount_selected", default=0, style=style, disabled=1, size=4, class='numeric', onblur="kivi.BankTransaction.update_invoice_amount(" _ bt_id _ ", 0, this)") %]
15
 [% IF invoice.forex %]
16
  </br>
17
  </br>
18
   [% LxERP.t8("Curr") %]: <b>[% HTML.escape(invoice.currency.name) %]</b></br>
19
   [% daily_exchangerate           = invoice.get_exchangerate_for_bank_transaction(bt_id) %]
20
   [% formatted_daily_exchangerate = daily_exchangerate ? LxERP.format_amount(daily_exchangerate, 5) : LxERP.format_amount(1, 5)  %]
21
   [% UNLESS daily_exchangerate  %][% LxERP.t8("new") %] [% END %][% LxERP.t8("default exchange rate") %]: [% P.input_tag("exchangerate_" _ bt_id _ "_" _  invoice.id , "$formatted_daily_exchangerate", style=style, disabled=0, size=4, class='numeric') %]
22
   [% P.hidden_tag("currency_id_" _ bt_id _ "_" _ invoice.id, invoice.currency.id) %]
23
   </br>
24
   [% UNLESS invoice.is_sales %]
25
     [% P.checkbox_tag("book_fx_bank_fees_" _ bt_id _ "_" _ invoice.id, value=1, checked="1") %] [% LxERP.t8("Bank Fee Booking") %]
26
     </br>
27
   [% END %]
28
 [% END %]
15 29
 [% P.link_tag("#", "x", onclick="kivi.BankTransaction.delete_invoice(" _ bt_id _ "," _ invoice.id _ ")") %]
16 30
</span>

Auch abrufbar als: Unified diff