commods.commodid commodid,
commods.unitmass unitmass,
commods.unitvolume unitvolume,
+ commods.ordval ordval,
+ commods.posinclass posinclass,
+ commods.commodclassid commodclassid,
dist dist,
buy.price - sell.price unitprofit
FROM commods
my ($varname, $qty) = m/^
\s* \d+ \s+
(\w+) \s+ (?: [A-Z*]+ \s+ )?
- ([0-9.]+) \s
+ ([+-e0-9.]+) \s
/x or die "$cplex \n==\n $glpsol_out $_ ?";
if ($varname =~ m/^f(\d+)s(\d+)_/) {
my ($ix,$orgix) = ($1,$2);
%
% foreach my $i (0..$#islandids) {
<% $tbody->(1) %>
-<tr><td colspan=4>
+<tr><td colspan=5>
% $iquery->execute($islandids[$i]);
% my ($islandname) = $iquery->fetchrow_array();
% if (!$i) {
<%perl>
my $age_reported= 0;
my %flowlists;
- #print "<tr><td colspan=6>" if $qa->{'debug'};
+ #print "<tr><td colspan=7>" if $qa->{'debug'};
foreach my $od (qw(org dst)) {
#print " [[ i $i od $od " if $qa->{'debug'};
foreach my $sf (@subflows) {
my $price= $f->{"${od}_price"};
my $stallname= $f->{"${od}_stallname"};
my $todo= \$flowlists{$od}{
+ (sprintf "%010d", $f->{'ordval'}),
$f->{'commodname'},
(sprintf "%07d", ($od eq 'dst' ?
9999999-$price : $price)),
dstArbitrage => 0,
} unless $$todo;
$$todo->{'commodname'}= $f->{'commodname'};
+ $$todo->{'posinclass'}= '';
+ if ($f->{'posinclass'}) {
+ my $findclass= $dbh->prepare(<<END);
+SELECT commodclass, maxposinclass FROM commodclasses WHERE commodclassid = ?
+END
+ $findclass->execute($f->{'commodclassid'});
+ my $classinfo= $findclass->fetchrow_hashref();
+ if ($classinfo->{'maxposinclass'} >= 8) {
+ my $maxpic= $classinfo->{'maxposinclass'};
+ my $inpic= $f->{'posinclass'};
+ my @tmbs= qw(TT T M B BB);
+ my @tmbds= ( 'in Top fifth of list',
+ 'in 2nd fifth of the list',
+ 'in Middle fifth of the list',
+ 'in 2nd-bottom fifth of list',
+ 'in Bottom fifth of the list');
+ my $tmbi= ($inpic+0.5)*$#tmbs/$maxpic;
+ my $desc= (sprintf "%s is under %s,".
+ " commodity %d of %d;".
+ " i.e. %s or %s",
+ $f->{'commodname'},
+ $classinfo->{'commodclass'},
+ $inpic, $maxpic,
+ $tmbs[$tmbi], $tmbds[$tmbi]);
+ $$todo->{'posinclass'}=
+ "<div class=mouseover title=\"$desc\">$tmbs[$tmbi]</div>";
+ }
+ }
$$todo->{'stallname'}= $stallname;
$$todo->{Price}= $price;
$$todo->{Timestamp}= $f->{"${od}_timestamp"};
</%perl>
<tr>
<td colspan=1>
-<td colspan=2><% $xinfo %>
+<td colspan=3><% $xinfo %>
<td colspan=2 align=right><% $totaldesc %>
<td align=right><% $totalwas |h %> total
<%perl>
% tr_datarow($m,$dline);
<<% $td %>><% $collectdeliver %>
<<% $td %>><% $t->{'commodname'} |h %>
+<<% $td %>><% $t->{'posinclass'} %>
%
% my @stalls= sort keys %{ $t->{Stalls} };
% my $pstall= sub {
}
</%perl><a name="summary"></a>
<% $tbody->(1) %><tr>
-<td colspan=2>Total distance: <% $total_dist %> leagues.
+<td colspan=3>Total distance: <% $total_dist %> leagues.
<td colspan=3 align=right>Overall net cash flow
<td align=right><strong><%
$total_total < 0 ? -$total_total." loss" : $total_total." gain"