Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7368797d

Von Kivitendo Admin vor etwa 1 Jahr hinzugefügt

  • ID 7368797d1d627d0234b4042ca53f5afe08b0d68c
  • Vorgänger 26876a4e
  • Nachfolger f90c73d5

Debitorenbuchungen - fx_paid -> defaultcurrency_paid

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

Unterschiede anzeigen:

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

  
494 494
  my @payments;
495

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

  
495 500
  for my $i (1 .. $form->{paidaccounts}) {
496
    # hook for calc of of fx_paid and check if banktransaction has a record exchangerate
497
    if ($form->{"exchangerate_$i"}) {
501
    # hook for calc of of defaultcurrency_paid and check if banktransaction has a record exchangerate
502
    if ($form->{"exchangerate_$i"} && $form->{"acc_trans_id_$i"}) {
503
      # only check for bank transactions for payments that have already been saved
498 504
      my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"});
499
        if ($bt_acc_trans) {
500
          if ($bt_acc_trans->bank_transaction->exchangerate > 0) {
501
            $form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate;
502
            $form->{"forex_$i"}        = $form->{"exchangerate_$i"};
503
            $form->{"record_forex_$i"} = 1;
504
          }
505
      if ($bt_acc_trans) {
506
        if ($bt_acc_trans->bank_transaction->exchangerate > 0) {
507
          $form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate;
508
          $form->{"forex_$i"}        = $form->{"exchangerate_$i"};
509
          $form->{"record_forex_$i"} = 1;
505 510
        }
506
      $form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"};
507
      $form->{"fx_totalpaid"} +=  $form->{"fx_paid_$i"};
508
    } # end hook fx_paid
511
      }
512
      $form->{"defaultcurrency_paid_$i"} = $form->{"paid_$i"} * $form->{"exchangerate_$i"};
513
      $form->{"defaultcurrency_totalpaid"} += $form->{"defaultcurrency_paid_$i"};
514
    } # end hook defaultcurrency_paid
515

  
509 516
    my $payment = {
510 517
      paid             => $form->{"paid_$i"},
511 518
      exchangerate     => $form->{"exchangerate_$i"} || '',
......
519 526
      datepaid         => $form->{"datepaid_$i"},
520 527
      paid_project_id  => $form->{"paid_project_id_$i"},
521 528
      gldate           => $form->{"gldate_$i"},
522
      fx_paid          => $form->{"fx_paid_$i"},
523
      fx_totalpaid     => $form->{"fx_totalpaid_$i"},
529
      # only used if we have an fx currency
530
      defaultcurrency_paid      => $form->{"defaultcurrency_paid_$i"},
531
      defaultcurrency_totalpaid => $form->{"defaultcurrency_totalpaid_$i"},
524 532
    };
525 533

  
526 534
    # default account for current assets (i.e. 1801 - SKR04) if no account is selected
templates/webpages/ar/form_header.html
299 299
         <td align=center>
300 300
    [%- IF row.forex || !row.changeable%]
301 301
          <input type=hidden name="exchangerate_[% loop.count %]" value="[%- LxERP.format_amount(row.exchangerate, 5, 1) -%]">
302
      [%- LxERP.format_amount(row.exchangerate, 5, 0) -%] = [% LxERP.format_amount(row.fx_paid, 2) %] [% currency %]</br>
302
      [%- LxERP.format_amount(row.exchangerate, 5, 0) -%] = [% LxERP.format_amount(row.defaultcurrency_paid, 2) %] [% defaultcurrency %]</br>
303 303
      [% IF $record_forex %][% 'bank transaction exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %]
304 304
    [%- ELSE %]
305 305
          <input name="exchangerate_[% loop.count %]" size=10 value="[%- LxERP.format_amount(row.exchangerate, 5, 1) -%]">
......
331 331
          <td></td>
332 332
          <td></td>
333 333
          <td align="center">[% 'Total' | $T8 %]</td>
334
          <td align="center">[% LxERP.format_amount(totalpaid, 2) | html %]  [% defaultcurrency %] </td>
334
          <td align="center">[% LxERP.format_amount(totalpaid, 2) | html %]  [% currency %] </td>
335 335
        [% IF show_exch %]
336 336
            <td></td>
337
            <td align="center">[% LxERP.format_amount(fx_totalpaid, 2) | html %] [% currency %]</td>
338
            <input type="hidden" name="fx_totalpaid" value="[% fx_totalpaid %]">
337
            <td align="center">[% LxERP.format_amount(defaultcurrency_totalpaid, 2) | html %] [% defaultcurrency %]</td>
338
            <input type="hidden" name="defaultcurrency_totalpaid" value="[% defaultcurrency_totalpaid %]">
339 339
            <input type="hidden" name="is_linked_bank_transaction" value="[% is_linked_bank_transaction %]">
340 340
        [% END %]
341 341
        </tr>
......
343 343
          <td></td>
344 344
          <td></td>
345 345
          <td align="center">[% 'Missing amount' | $T8 %]</td>
346
          <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
346
          <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %] [% currency %]</td>
347 347
        </tr>
348 348
        <input type=hidden name=paidaccounts value='[% paidaccounts %]'>
349 349

  

Auch abrufbar als: Unified diff