From: Ian Jackson Date: Wed, 2 Sep 2009 22:42:32 +0000 (+0100) Subject: Show total mass/volumes X-Git-Tag: 3.4~21 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=commitdiff_plain;h=84a171d7e0f4591a55d39d0208bd865db9d22b22 Show total mass/volumes --- 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;