Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9557707c

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 9557707c3a18daeb9371f2366b8637a7e1f0fa3c
  • Vorgänger c1a8c632
  • Nachfolger ae27679f

Revert "Nutzung der Tabelle currencies"

This reverts commit be776964b83340e69fa2f02eae59b703c0c95b88.

Unterschiede anzeigen:

SL/CP.pm
93 93
  }
94 94
  $sth->finish;
95 95

  
96
  # get closedto
97
  $query = qq|SELECT closedto FROM defaults|;
98
  ($form->{closedto}) = selectrow_query($form, $dbh, $query);
96
  # get currencies and closedto
97
  $query = qq|SELECT curr, closedto FROM defaults|;
98
  ($form->{currencies}, $form->{closedto}) =
99
    selectrow_query($form, $dbh, $query);
99 100

  
100 101
  $dbh->disconnect;
101 102

  
......
149 150
  my $arap = $form->{arap} eq "ar" ? "ar" : "ap";
150 151

  
151 152
  my $query =
152
     qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, cu.curr | .
153
     qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, a.curr | .
153 154
     qq|FROM $arap a | .
154
     qq|LEFT JOIN currencies cu ON (cu.id=a.curr)| .
155
     qq|WHERE (a.${vc}_id = ?) AND cu.curr = ? AND NOT (a.amount = a.paid)| .
155
     qq|WHERE (a.${vc}_id = ?) AND (COALESCE(a.curr, '') = ?) AND NOT (a.amount = a.paid)| .
156 156
     qq|ORDER BY a.id|;
157 157
  my $sth = prepare_execute_query($form, $dbh, $query,
158 158
                                  conv_i($form->{"${vc}_id"}),
......
174 174
    SELECT COUNT(*)
175 175
    FROM $arap
176 176
    WHERE (${vc}_id = ?)
177
      AND ((SELECT cu.curr FROM currencies cu WHERE cu.id=${arap}.curr) <> ?)
177
      AND (COALESCE(curr, '') <> ?)
178 178
      AND (amount <> paid)
179 179
SQL
180 180
  ($form->{openinvoices_other_currencies}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{"${vc}_id"}), "$form->{currency}");
......
250 250
        qq|SELECT $buysell | .
251 251
        qq|FROM exchangerate e | .
252 252
        qq|JOIN ${arap} a ON (a.transdate = e.transdate) | .
253
        qq|WHERE (e.curr = (SELECT id FROM currencies WHERE curr = ?)) AND (a.id = ?)|;
253
        qq|WHERE (e.curr = ?) AND (a.id = ?)|;
254 254
      my ($exchangerate) =
255 255
        selectrow_query($form, $dbh, $query,
256 256
                        $form->{currency}, $form->{"id_$i"});

Auch abrufbar als: Unified diff