From 84a171d7e0f4591a55d39d0208bd865db9d22b22 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 2 Sep 2009 23:42:32 +0100 Subject: [PATCH] Show total mass/volumes --- yarrg/web/routetrade | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 4885782..cb7550e 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); +} @@ -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; -- 2.30.2