This Mason component is the core trade planner for a specific route.
-========== TODO ==========
-16:36 <ceb> alpha,byrne,papaya,turtle,jorvik,luthien is my example
-
-use POST for update. Hrrm.
-
-LATER OR NOT AT ALL
-
-adjustable potential cost of losses (rather than fixed 1e-BIG per league)
-
-max volume/mass
-
-========== TODO ==========
-
</%doc>
<%args>
$dbh
Sail to <% $islandname |h %>
% }
</strong>
-% my $age_reported= 0;
-% my %flowlists;
-% foreach my $od (qw(org dst)) {
-% foreach my $f (@flows) {
-% next if $f->{Suppress};
-% next unless $f->{"${od}_id"} == $islandids[$i];
-% next unless $f->{OptQty};
-% my $price= $f->{"${od}_price"};
-% my $stallname= $f->{"${od}_stallname"};
-% my $todo= \$flowlists{$od}{
-% $f->{'commodname'},
-% (sprintf "%07d", $price),
-% $stallname
-% };
-% $$todo= {
-% Qty => 0,
-% orgArbitrage => 0,
-% dstArbitrage => 0,
-% } unless $$todo;
-% $$todo->{'commodname'}= $f->{'commodname'};
-% $$todo->{'stallname'}= $stallname;
-% $$todo->{Price}= $price;
-% $$todo->{Timestamp}= $f->{"${od}_timestamp"};
-% $$todo->{Qty} += $f->{OptQty};
-% $$todo->{Total}= $$todo->{Price} * $$todo->{Qty};
-% $$todo->{Stalls}= $f->{"${od}Stalls"};
-% if ($f->{'org_id'} == $f->{'dst_id'}) {
-% $$todo->{"${od}Arbitrage"}= 1;
-% }
-% }
-% }
-%
-% my $total;
-% my $dline= 0;
-% my $show_flows= sub {
-% my ($od,$arbitrage,$collectdeliver) = @_;
+<%perl>
+ my $age_reported= 0;
+ my %flowlists;
+ foreach my $od (qw(org dst)) {
+ foreach my $f (@flows) {
+ next if $f->{Suppress};
+ next unless $f->{"${od}_id"} == $islandids[$i];
+ next unless $f->{OptQty};
+ my $price= $f->{"${od}_price"};
+ my $stallname= $f->{"${od}_stallname"};
+ my $todo= \$flowlists{$od}{
+ $f->{'commodname'},
+ (sprintf "%07d", ($od eq 'dst' ?
+ 9999999-$price : $price)),
+ $stallname
+ };
+ $$todo= {
+ Qty => 0,
+ orgArbitrage => 0,
+ dstArbitrage => 0,
+ } unless $$todo;
+ $$todo->{'commodname'}= $f->{'commodname'};
+ $$todo->{'stallname'}= $stallname;
+ $$todo->{Price}= $price;
+ $$todo->{Timestamp}= $f->{"${od}_timestamp"};
+ $$todo->{Qty} += $f->{OptQty};
+ $$todo->{Total}= $$todo->{Price} * $$todo->{Qty};
+ $$todo->{Stalls}= $f->{"${od}Stalls"};
+ if ($f->{'org_id'} == $f->{'dst_id'}) {
+ $$todo->{"${od}Arbitrage"}= 1;
+ }
+ }
+ }
+
+ my $total;
+ my $dline= 0;
+ my $show_flows= sub {
+ my ($od,$arbitrage,$collectdeliver) = @_;
+</%perl>
%
% my $todo= $flowlists{$od};
% return unless $todo;
% }
% $total= undef;
% $dline= 0;
-% };
-%
-% $show_flows->('org',1,'Collect'); $show_total->('(Arbitrage) outlay');
-% $show_flows->('dst',1,'Deliver');
-% $show_flows->('dst',0,'Deliver'); $show_total->('Proceeds');
-% $show_flows->('org',0,'Collect'); $show_total->('Outlay');
-%
-% }
+<%perl>
+ };
+
+ $show_flows->('dst',0,'Deliver'); $show_total->('Proceeds');
+ $show_flows->('org',1,'Collect'); $show_total->('(Arbitrage) outlay');
+ $show_flows->('dst',1,'Deliver'); $show_total->('(Arbitrage) proceeds');
+ $show_flows->('org',0,'Collect'); $show_total->('Outlay');
+
+}
+</%perl>
</table>
<& query_age:dataages, id2age => \%da_ages &>
%