+ $$todo->{'posinclass'}= '';
+ my $incl= $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) {
+ my $clname= $classinfo->{'commodclass'};
+ my $desc= encode_entities(sprintf "%s is under %s",
+ $f->{'commodname'}, $clname);
+ my $abbrev= substr($clname,0,1);
+ if ($incl) {
+ my $maxpic= $classinfo->{'maxposinclass'};
+ $desc.= (sprintf ", commodity %d of %d",
+ $incl, $maxpic);
+ if ($classinfo->{'maxposinclass'} >= 8) {
+ my @tmbs= qw(0 1 2 3 4 5 6 7 8 9);
+ my $tmbi= ($incl+0.5)*$#tmbs/$maxpic;
+ $abbrev.= " ".$tmbs[$tmbi]." ";
+ }
+ }
+ $$todo->{'posinclass'}=
+ "<div class=mouseover title=\"$desc\">"
+ .$abbrev."</div>";
+ }