X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fgraph%2Felements%2Freport.html;h=da2235fa91d9c62c7f22470069627cd45ab2c9df;hb=cfceb11a01354e3e6e78fd3e466656a3fdbac19e;hp=b831f3a4f047bfd694c5e7b1b660df07d520172c;hpb=f22b714f2b7a38c8a930d8248ccb32751db82b5e;p=freeside.git diff --git a/httemplate/graph/elements/report.html b/httemplate/graph/elements/report.html index b831f3a4f..da2235fa9 100644 --- a/httemplate/graph/elements/report.html +++ b/httemplate/graph/elements/report.html @@ -105,11 +105,11 @@ any delimiter and linked from the elements in @data. % $worksheet->write( $r, $c++, shift( @row_labels ) ); % foreach ( @{ shift( @data ) } ) { % $total += $_; -% $bottom_total[$c] += $_; +% $bottom_total[$c-1] += $_; % $worksheet->write($r, $c++, sprintf($sprintf, $_) ); % } % unless ( $opt{'nototal'} ) { -% $bottom_total[$c] += $total; +% $bottom_total[$c-1] += $total; % $worksheet->write($r, $c++, sprintf($sprintf, $total) ); % } % } @@ -155,26 +155,28 @@ any delimiter and linked from the elements in @data. % ); % % http_header('Content-Type' => 'image/png' ); +% http_header('Cache-Control' => 'no-cache' ); % % $chart->_set_colors(); % <% $chart->scalar_png([ $opt{'axis_labels'}, @data ]) %> % % } else { +% # image and download links should use the cached data +% # just directly reference this component +% my $myself = $p.'graph/elements/report.html?session='.$session; % <% include('/elements/header.html', $opt{'title'} ) %> -% $cgi->param('_type', 'png'); +% unless ( $opt{'graph_type'} eq 'none' ) { - +" WIDTH="976" HEIGHT="384"> +% }

% unless ( $opt{'disable_download'} ) { -% $cgi->param('_type', "xls" ); Download full results
- as Excel spreadsheet
-% $cgi->param('_type', 'csv'); - as CSV file

-% $cgi->param('_type', "html" ); + as ">Excel spreadsheet
+ as ">CSV file

% } %

@@ -269,6 +271,16 @@ any delimiter and linked from the elements in @data. <%init> my(%opt) = @_; +my $session; +# load from cache if possible, to avoid recalculating +if ( $cgi->param('session') =~ /^(\d+)$/ ) { + $session = $1; + %opt = %{ $m->cache->get($session) }; +} +else { + $session = sprintf("%010d%06d", time, int(rand(1000000))); + $m->cache->set($session, \%opt, '1h'); +} my $sprintf = $opt{'sprintf'} || '%.2f';