chiark / gitweb /
Stripey tables
[ypp-sc-tools.db-live.git] / yarrg / web / query_commod
index 052d019f998b137cd103f806c46bbbb0f3e0fd4a..34b1347f20f5034315a1821d535cd6de40f8f8e2 100644 (file)
@@ -97,14 +97,13 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
        my ($ascdesc) = ($bs eq 'buy')
                ? ('DESC')
                : ('ASC');
-       my $joinkind= $ARGS{ShowBlank} eq 'show'
-               ? 'LEFT OUTER JOIN' : 'INNER JOIN';
+       my $joinkind= $ARGS{ShowBlank} ? 'LEFT OUTER JOIN' : 'INNER JOIN';
        my $islands= $dbh->prepare(
        "SELECT islands.islandid AS islandid, archipelago, islandname,
                        sum(qty) as tqty
                FROM islands $joinkind $bs offers
                ON islands.islandid == offers.islandid AND commodid == ?
-               GROUP BY islands.islandid,
+               GROUP BY islands.islandid
                ORDER BY archipelago, islandname"
                );
 
@@ -138,6 +137,7 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 %      $islands->execute($commodid);
 %      my $island;
 %      my %ts_sortkeys;
+%      my $rowix= 0;
 %      while ($island= $islands->fetchrow_hashref) {
 %              my $islandid= $island->{'islandid'};
 %              $offers->execute($commodid, $islandid);
@@ -180,7 +180,7 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 %              }
 %
 %              $cqty == $tqty or die "$bs $cqty $tqty $commodid $islandid ";
-<tr id=<% $rowid %> >
+<tr id=<% $rowid %> class="<% 'datarow'.($rowix & 1) %>">
      <td><% $s->[0]= $island->{'archipelago'} |h %>
      <td><% $s->[1]= $island->{'islandname'} |h %>
      <td><%          $stallname |h %>
@@ -193,11 +193,12 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 %              for my $cix (0..$#$s) {
 %                      $ts_sortkeys{$cix}{$rowid}= $s->[$cix];
 %              }
+%              $rowix++;
 %      }
 </table>
 
 <& tabsort,    table => "${bs}_table", sortkeys => "${bs}_sortkeys",
-               throw => "${bs}_table_thr", cols => [
+               throw => "${bs}_table_thr", rowclass => 'datarow', cols => [
        {}, {},
        { DoReverse => 1 },
        { DoReverse => 1, Numeric => 1, MapFn => "ts_Pricemap_${bs}" },