</pre>
% }
+<& dumptable:start, qa => $qa, sth => $sth &>
% {
-<& dumptable:start, sth => $sth &>
-% my $flow;
-% while ($flow= $sth->fetchrow_hashref()) {
-% $flow->{Ix}= @flows;
-% $flow->{Var}= "f$flow->{Ix}";
-% push @flows, $flow;
-<& dumptable:row, sth => $sth, row => $flow &>
+% my $f;
+% while ($f= $sth->fetchrow_hashref()) {
+<%perl>
+
+ $f->{Ix}= @flows;
+ $f->{Var}= "f$f->{Ix}";
+
+ $f->{MaxQty}= $f->{'org_qty'} < $f->{'dst_qty'}
+ ? $f->{'org_qty'} : $f->{'dst_qty'};
+ $f->{MaxProfit}= $f->{MaxQty} * $f->{'unitprofit'};
+ $f->{MaxCapital}= $f->{MaxQty} * $f->{'org_price'};
+
+ $f->{PctProfit}= sprintf "%3.1f%%",
+ $f->{'dst_price'} * 100.0 / $f->{'org_price'} - 100.0;
+
+ $f->{"org_stallid"}= $f->{"dst_stallid"}= 'all'
+ if !$qa->{ShowStalls};
+
+ my @uid= $f->{commodid};
+ foreach my $od (qw(org dst)) {
+ push @uid,
+ $f->{"${od}_id"},
+ $f->{"${od}_price"},
+ $f->{"${od}_stallid"};
+ }
+ $f->{Uid}= join '_', @uid;
+
+ if ($qa->{"rtsela_$f->{Uid}"} &&
+ !$qa->{"rtselg_$f->{Uid}"}) {
+ $f->{Suppress}= 1;
+ }
+
+ push @flows, $f;
+
+</%perl>
+<& dumptable:row, qa => $qa, sth => $sth, row => $f &>
% }
-<& dumptable:end &>
+<& dumptable:end, qa => $qa &>
% }
% my $optimise= $specific && !$confusing && @islandids>1;
my %avail_csts;
foreach my $flow (@flows) {
+ if ($flow->{Suppress}) {
+ $cplex .= "
+ $flow->{Var} = 0
+";
+ next;
+ }
foreach my $od (qw(org dst)) {
- my $cstname= join '_',
+ my $cstname= join '_', (
'avail',
$flow->{'commodid'},
$od,
$flow->{"${od}_id"},
- $flow->{"${od}_price"};
+ $flow->{"${od}_price"},
+ $flow->{"${od}_stallid"},
+ );
+
push @{ $avail_csts{$cstname}{Flows} }, $flow->{Var};
$avail_csts{$cstname}{Qty}= $flow->{"${od}_qty"};
}
% my $cdstall= $qa->{ShowStalls} ? '<th>Stall</th>' : '';
<table>
<tr>
+<th>
<th<% $cdspan %>>Collect
<th<% $cdspan %>>Deliver
<th>
% }
<tr>
+<th>
<th>Island <% $cdstall %>
<th>Island <% $cdstall %>
<th>Commodity
% foreach my $flow (@flows) {
<tr>
+<td><input type=hidden name=rtsela_<% $flow->{Uid} %> value=1>
+ <input type=checkbox name=rtselg_<% $flow->{Uid} %> value=1
+ <% $flow->{Suppress} ? '' : 'checked' %> >
% foreach my $col (@columns) {
-% $flow->{MaxQty}= $flow->{'org_qty'} < $flow->{'dst_qty'}
-% ? $flow->{'org_qty'} : $flow->{'dst_qty'};
-% $flow->{MaxProfit}= $flow->{MaxQty} * $flow->{'unitprofit'};
-% $flow->{PctProfit}= sprintf "%3.1f%%",
-% $flow->{'dst_price'} * 100.0 / $flow->{'org_price'}
-% - 100.0;
-% $flow->{MaxCapital}= $flow->{MaxQty} * $flow->{'org_price'};
<td><% $flow->{$col} |h %>
% }
% }
</table>
+<input type=submit name=update value="Update">
+
<%init>
use CommodsWeb;
use Commods;