X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Froutetrade;h=7f7d27f45d26d51a25c20b42ff66003e60d6848a;hb=c1af6b2456f3313efcb4d40e3df2b628bfb4fae6;hp=4885782e58a440b7a773510a049daf363e5e0838;hpb=59bee7afb77216585b904bd20f17e71005e9778c;p=ypp-sc-tools.db-live.git
diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade
index 4885782..7f7d27f 100644
--- a/yarrg/web/routetrade
+++ b/yarrg/web/routetrade
@@ -205,9 +205,12 @@ $addcols->({ DoReverse => 1, SortColKey => 'MarginSortKey' },
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>
@@ -269,6 +272,12 @@ foreach my $f (@flows) {
$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%%",
@@ -486,7 +495,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
-
+
% if ($optimise) {
@@ -499,8 +508,9 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
Collect
| Deliver
| Profit
- |
| Max
+ |
+ | Max
% if ($optimise) {
| Planned
% }
@@ -516,10 +526,12 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
| Qty
| Margin
| Unit
- | Dist
| Qty
| Capital
| Profit
+ | Dist
+ | Mass
+ | Vol
% if ($optimise) {
| Qty
| 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}};
-% $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;
@@ -584,11 +597,11 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
|
% $iquery->execute($islandids[$i]);
% my ($islandname) = $iquery->fetchrow_array();
-% my $this_dist= $distance->($islandids[$i-1],$islandids[$i]);
-% $total_dist += $this_dist;
% if (!$i) {
Start at <% $islandname |h %>
% } else {
+% my $this_dist= $distance->($islandids[$i-1],$islandids[$i]);
+% $total_dist += $this_dist;
Sail to <% $islandname |h %>
- <% $this_dist |h %> leagues |
% }
@@ -630,7 +643,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
}
my $total;
- my $dline= 0;
+ my $dline= 1;
my $show_flows= sub {
my ($od,$arbitrage,$collectdeliver) = @_;
%perl>
@@ -686,7 +699,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
% $total_total += $sign * $total;
% }
% $total= undef;
-% $dline= 0;
+% $dline= 1;
<%perl>
};