chiark / gitweb /
Show total mass/volumes
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Wed, 2 Sep 2009 22:42:32 +0000 (23:42 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Wed, 2 Sep 2009 22:42:32 +0000 (23:42 +0100)
yarrg/web/routetrade

index 4885782e58a440b7a773510a049daf363e5e0838..cb7550e5e127f1a8e7a1623d8861b80144507d2b 100644 (file)
@@ -205,9 +205,12 @@ $addcols->({ DoReverse => 1, SortColKey => 'MarginSortKey' },
        qw(     Margin
        ));
 $addcols->({ DoReverse => 1 },
        qw(     Margin
        ));
 $addcols->({ DoReverse => 1 },
-       qw(     unitprofit dist MaxQty
-               MaxCapital MaxProfit
+       qw(     unitprofit MaxQty MaxCapital MaxProfit dist
        ));
        ));
+foreach my $v (qw(MaxMass MaxVolume)) {
+   $addcols->({
+       DoReverse => 1, Total => 0, SortColKey => "${v}SortKey" }, $v);
+}
 
 </%perl>
 
 
 </%perl>
 
@@ -269,6 +272,12 @@ foreach my $f (@flows) {
        $f->{MaxProfit}= $f->{MaxQty} * $f->{'unitprofit'};
        $f->{MaxCapital}= $f->{MaxQty} * $f->{'org_price'};
 
        $f->{MaxProfit}= $f->{MaxQty} * $f->{'unitprofit'};
        $f->{MaxCapital}= $f->{MaxQty} * $f->{'org_price'};
 
+       $f->{MaxMassSortKey}= $f->{MaxQty} * $f->{'unitmass'};
+       $f->{MaxVolumeSortKey}= $f->{MaxQty} * $f->{'unitvolume'};
+       foreach my $v (qw(Mass Volume)) {
+               $f->{"Max$v"}= sprintf "%.1f", $f->{"Max${v}SortKey"} * 1e-6;
+       }
+
        $f->{MarginSortKey}= sprintf "%d",
                $f->{'dst_price'} * 10000 / $f->{'org_price'};
        $f->{Margin}= sprintf "%3.1f%%",
        $f->{MarginSortKey}= sprintf "%d",
                $f->{'dst_price'} * 10000 / $f->{'org_price'};
        $f->{Margin}= sprintf "%3.1f%%",
@@ -486,7 +495,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 <colgroup span=2>
 <colgroup span=2>
 <colgroup span=2>
 <colgroup span=2>
 <colgroup span=2>
 <colgroup span=2>
-<colgroup span=1>
+<colgroup span=3>
 <colgroup span=3>
 %      if ($optimise) {
 <colgroup span=3>
 <colgroup span=3>
 %      if ($optimise) {
 <colgroup span=3>
@@ -499,8 +508,9 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 <th colspan=2>Collect
 <th colspan=2>Deliver
 <th colspan=2>Profit
 <th colspan=2>Collect
 <th colspan=2>Deliver
 <th colspan=2>Profit
-<th colspan=1>
 <th colspan=3>Max
 <th colspan=3>Max
+<th colspan=1>
+<th colspan=2>Max
 %      if ($optimise) {
 <th colspan=3>Planned
 %      }
 %      if ($optimise) {
 <th colspan=3>Planned
 %      }
@@ -516,10 +526,12 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 <th>Qty
 <th>Margin
 <th>Unit
 <th>Qty
 <th>Margin
 <th>Unit
-<th>Dist
 <th>Qty
 <th>Capital
 <th>Profit
 <th>Qty
 <th>Capital
 <th>Profit
+<th>Dist
+<th>Mass
+<th>Vol
 %      if ($optimise) {
 <th>Qty
 <th>Capital
 %      if ($optimise) {
 <th>Qty
 <th>Capital
@@ -542,7 +554,8 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 %      foreach my $ci (1..$#cols) {
 %              my $col= $cols[$ci];
 %              my $v= $flow->{$col->{Name}};
 %      foreach my $ci (1..$#cols) {
 %              my $col= $cols[$ci];
 %              my $v= $flow->{$col->{Name}};
-%              $col->{Total} += $v if defined $col->{Total};
+%              $col->{Total} += $v
+%                      if defined $col->{Total} and not $flow->{Suppress};
 %              $v='' if !$col->{Text} && !$v;
 %              my $sortkey= $col->{SortColKey} ?
 %                      $flow->{$col->{SortColKey}} : $v;
 %              $v='' if !$col->{Text} && !$v;
 %              my $sortkey= $col->{SortColKey} ?
 %                      $flow->{$col->{SortColKey}} : $v;