</pre>
% }
-% {
<& dumptable:start, qa => $qa, sth => $sth &>
-% my $flow;
-% while ($flow= $sth->fetchrow_hashref()) {
-% $flow->{Ix}= @flows;
-% $flow->{Var}= "f$flow->{Ix}";
-% push @flows, $flow;
-<& dumptable:row, qa => $qa, 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;
+
+ push @flows, $f;
+
+</%perl>
+<& dumptable:row, qa => $qa, sth => $sth, row => $f &>
% }
<& dumptable:end, qa => $qa &>
% }
my %avail_csts;
foreach my $flow (@flows) {
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"};
}
% foreach my $flow (@flows) {
<tr>
% 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 %>
% }
% }