Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3ff5da55

Von Niclas Zimmermann vor etwa 12 Jahren hinzugefügt

  • ID 3ff5da55d203a1ac5dbd269737577f0abeb424e0
  • Vorgänger 3b9aee06
  • Nachfolger ecf1e7ec

Bilanzfehler bei Wechselkursbuchungen

Wenn man Rechnungen (die Fremdwährungen nutzen) bezahlt hat, wurden
Gewinne/Verluste durch mögliche Kurswechsel bei Zahlungsbuchungen
nicht weiter berücksichtigt. Dadurch kam es zu Bilanzfehlern im
Buchungsjournal.

Das return bei payments_only wird jetzt erst nach den Wechselkurs-
buchungen ausgeführt.

Project_id wurde durch ein conv_i gekapselt.

Unterschiede anzeigen:

SL/IS.pm
933 933

  
934 934
      # exchangerate difference
935 935
      $form->{fx}{$accno}{ $form->{"datepaid_$i"} } +=
936
      $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) + $diff;
936
        $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) + $diff;
937 937

  
938 938
      # gain/loss
939 939
      $amount =
940
      $form->{"paid_$i"} * $form->{exchangerate} - $form->{"paid_$i"} *
941
      $form->{"exchangerate_$i"};
940
        $form->{"paid_$i"} * $form->{exchangerate} - $form->{"paid_$i"} *
941
        $form->{"exchangerate_$i"};
942 942
      if ($amount > 0) {
943
        $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } +=
944
        $amount;
943
        $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } += $amount;
945 944
      } else {
946
        $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } +=
947
        $amount;
945
        $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } += $amount;
948 946
      }
949 947

  
950 948
      $diff = 0;
......
963 961

  
964 962
  IO->set_datepaid(table => 'ar', id => $form->{id}, dbh => $dbh);
965 963

  
966
  if ($payments_only) {
967
    $query = qq|UPDATE ar SET paid = ? WHERE id = ?|;
968
    do_query($form, $dbh, $query,  $form->{paid}, conv_i($form->{id}));
969

  
970
    $dbh->commit if !$provided_dbh;
971

  
972
    $main::lxdebug->leave_sub();
973
    return;
974
  }
975

  
976 964
  # record exchange rate differences and gains/losses
977 965
  foreach my $accno (keys %{ $form->{fx} }) {
978 966
    foreach my $transdate (keys %{ $form->{fx}{$accno} }) {
979
      if (
980
          ($form->{fx}{$accno}{$transdate} =
981
           $form->round_amount($form->{fx}{$accno}{$transdate}, 2)
982
          ) != 0
983
        ) {
967
      $form->{fx}{$accno}{$transdate} = $form->round_amount($form->{fx}{$accno}{$transdate}, 2);
968
      if ( $form->{fx}{$accno}{$transdate} != 0 ) {
984 969

  
985 970
        $query =
986 971
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id)
987 972
             VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1',
988 973
             (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
989
        @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, $project_id);
974
        @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, conv_i($project_id));
990 975
        do_query($form, $dbh, $query, @values);
991 976
      }
992 977
    }
993 978
  }
994 979

  
980
  if ($payments_only) {
981
    $query = qq|UPDATE ar SET paid = ? WHERE id = ?|;
982
    do_query($form, $dbh, $query,  $form->{paid}, conv_i($form->{id}));
983

  
984
    $dbh->commit if !$provided_dbh;
985

  
986
    $main::lxdebug->leave_sub();
987
    return;
988
  }
989

  
995 990
  $amount = $netamount + $tax;
996 991

  
997 992
  # save AR record

Auch abrufbar als: Unified diff