-% my $color = shift( @{ $opt{'colors'} } );
-% my @links = @{ shift( @{ $opt{'links'} } ) };
-% # $opt{'links'} is an array parallel to items.
-% # Each element of that is an array containing a prefix,
-% # followed by suffixes matched to the cells of the table.
-% my $link_prefix = shift @links;
-% $link_prefix = $link_prefix ? qq(<A HREF="$link_prefix) : ''; #"
-% my $label = shift( @row_labels );
-
- <TR>
-
- <TH>
- <FONT COLOR="#<% $color %>"><% $label %></FONT>
- </TH>
+% my $data_row = $data[$i-1];
+%# my $data_row = shift @data;
+% if ( ! $opt{'nototal'} ) {
+% push @$data_row, sum(@$data_row);
+% }
+% my $e = 0;
+% foreach ( @$data_row ) {
+% my $entry = $_;
+% $entry = $money_char . sprintf($sprintf, $entry);
+% $entry = $link_prefix . shift(@$links) . "\">$entry</A>" if $link_prefix;
+% push @{$cell[$i]}, $entry;
+% $bottom_total[$e++] += $_ unless $opt{no_graph}[$i-1];
+% }
+% $i++;
+% }
+% if ( $opt{'bottom_total'} ) {
+% # it's an extra item
+% $num_items++;
+% push @styles, ".i$i { text-align: right; background-color: #f5f6be; }";
+% my $links = $opt{'bottom_link'} || [];
+% my $link_prefix = shift @$links;
+% $link_prefix = '<A CLASS="cell" HREF="'.$link_prefix if $link_prefix;
+% $cell[$i] = [ emt('Total') ];
+% for (my $e = 0; $e < $num_entries + 1; $e++) {
+% my $entry = $bottom_total[$e];
+% $entry = $money_char . sprintf($sprintf, $entry);
+% $entry = $link_prefix . shift(@$links) . "\">$entry</A>" if $link_prefix;
+% push @{$cell[$i]}, $entry;
+% }
+% }