X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Froutetrade;h=4dbe36e95c533e95cfecce13497c3baba0df66b4;hb=ec244cf220ba2232df707da397dd10de776dbda2;hp=91ff421625fd7d4757a6def0a6e471341ac073e1;hpb=b6475c671134b0dba4ac23446d90a34a736290ca;p=ypp-sc-tools.db-test.git diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 91ff421..4dbe36e 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -259,6 +259,11 @@ foreach my $f (@flows) { $f->{MaxProfit}= $f->{MaxQty} * $f->{'unitprofit'}; $f->{MaxCapital}= $f->{MaxQty} * $f->{'org_price'}; + $f->{MarginSortKey}= sprintf "%d", + $f->{'dst_price'} * 10000 / $f->{'org_price'}; + $f->{Margin}= sprintf "%3.1f%%", + $f->{'dst_price'} * 100.0 / $f->{'org_price'} - 100.0; + $f->{ExpectedUnitProfit}= $f->{'dst_price'} * (1.0 - $loss_per_league) ** $f->{'dist'} - $f->{'org_price'}; @@ -595,7 +600,7 @@ Sail to <% $islandname |h %> % my $age= $now - (values %todo)[0]->{Timestamp}; % my $cellid= "da_${i}"; % $da_ages{$cellid}= $age; -\ +\ (Data age: <% prettyprint_age($age) %>) % } % my $total= 0; @@ -612,13 +617,11 @@ Sail to <% $islandname |h %> % my @stalls= sort keys %{ $t->{Stalls} }; % my $pstall= sub { % my $name= $stalls[$_[0]]; -% my $avail= $t->{Stalls}{$name}; -<% $avail |h %> <% $od eq 'org' ? 'avail.' : 'wanted' %> <% $name |h %> % }; % % $pstall->(0); -<<% $td %> align=right><% $t->{Price} |h %> each +<<% $td %> align=right><% $t->{Price} |h %> poe ea. <<% $td %> align=right><% $t->{Qty} |h %> unit(s) <<% $td %> align=right><% $t->{Total} |h %> total % @@ -631,7 +634,7 @@ Sail to <% $islandname |h %> % } % if (%todo) { -<% $od eq 'org' ? 'Outlay' : 'Proceeds' %> +<% $od eq 'org' ? 'Outlay' : 'Proceeds' %> <% $total |h %> total % } % }