From: Ian Jackson Date: Mon, 24 Aug 2009 13:58:54 +0000 (+0100) Subject: Fix profit margin X-Git-Tag: 3.4~106^2~7 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=commitdiff_plain;h=4d67a78cf9ce16640830d627b407b97810d25bf9;ds=sidebyside Fix profit margin --- diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 91ff421..56a1c38 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'};