chiark / gitweb /
Improve presentation
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 23 Aug 2009 15:03:05 +0000 (16:03 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 23 Aug 2009 15:03:05 +0000 (16:03 +0100)
yarrg/web/routetrade

index e200aa5cfd78e7643297dfb350f73f2320b0b640..45e0f8168703597babb20b9b2c7c5e1b8e75fa10 100644 (file)
@@ -148,9 +148,10 @@ if ($qa->{ShowStalls}) {
 } else {
        push @columns,       qw(org_name dst_name);
 }
+my $ntextcolumns= @columns+1;
 push @columns,              qw(commodname
-                               org_price org_qty dst_price dst_qty
-                               unitprofit PctProfit
+                               org_qty org_price dst_qty dst_price
+                               Margin unitprofit
                                MaxQty MaxCapital MaxProfit);
 
 </%perl>
@@ -176,7 +177,7 @@ push @columns,                   qw(commodname
        $f->{MaxProfit}= $f->{MaxQty} * $f->{'unitprofit'};
        $f->{MaxCapital}= $f->{MaxQty} * $f->{'org_price'};
 
-       $f->{PctProfit}= sprintf "%3.1f%%",
+       $f->{Margin}= sprintf "%3.1f%%",
                $f->{'dst_price'} * 100.0 / $f->{'org_price'} - 100.0;
 
        $f->{"org_stallid"}= $f->{"dst_stallid"}= 'all'
@@ -373,7 +374,18 @@ push @columns, qw(OptQty OptCapital OptProfit);
 % {
 %      my $cdspan= $qa->{ShowStalls} ? ' colspan=2' : '';
 %      my $cdstall= $qa->{ShowStalls} ? '<th>Stall</th>' : '';
-<table>
+<table rules=groups>
+<colgroup span=1>
+<colgroup span=2>
+<% $qa->{ShowStalls} ? '<colgroup span=2>' : '' %>
+<colgroup span=1>
+<colgroup span=2>
+<colgroup span=2>
+<colgroup span=2>
+<colgroup span=3>
+%      if ($optimise) {
+<colgroup span=3>
+%      }
 <tr>
 <th>
 <th<% $cdspan %>>Collect
@@ -392,12 +404,12 @@ push @columns, qw(OptQty OptCapital OptProfit);
 <th>Island <% $cdstall %>
 <th>Island <% $cdstall %>
 <th>Commodity
-<th>Price
 <th>Qty
 <th>Price
 <th>Qty
-<th>Unit
+<th>Price
 <th>Margin
+<th>Unit
 <th>Qty
 <th>Capital
 <th>Profit
@@ -413,8 +425,12 @@ push @columns, qw(OptQty OptCapital OptProfit);
 <td><input type=hidden   name=R<% $flow->{UidShort} %> value="">
     <input type=checkbox name=T<% $flow->{UidShort} %> value=""
        <% $flow->{Suppress} ? '' : 'checked' %> >
-%      foreach my $col (@columns) {
-<td><% $flow->{$col} |h %>
+%      foreach my $ci (0..$#columns) {
+%              my $col= $columns[$ci];
+%              my $v= $flow->{$col};
+%              my $isnum= $ci >= $ntextcolumns;
+%              $v='' if $isnum && !$v;
+<td <% $isnum ? 'align=right' : '' %>><% $v |h %>
 %      }
 % }
 </table>