diff options
author | mark <mark> | 2012-01-07 23:04:03 +0000 |
---|---|---|
committer | mark <mark> | 2012-01-07 23:04:03 +0000 |
commit | 665109510114cf56e5ebd8eda0bef24b12ca41a2 (patch) | |
tree | e0bea6ca928b213ec0502d1343f745a52c109ccd /httemplate/graph | |
parent | a25b4a4f96f93c8824d9e5a02591d464848d4f75 (diff) |
projected sales report, #15393
Diffstat (limited to 'httemplate/graph')
-rw-r--r-- | httemplate/graph/elements/monthly.html | 12 | ||||
-rw-r--r-- | httemplate/graph/elements/report.html | 24 | ||||
-rw-r--r-- | httemplate/graph/report_cust_bill_pkg.html | 7 |
3 files changed, 36 insertions, 7 deletions
diff --git a/httemplate/graph/elements/monthly.html b/httemplate/graph/elements/monthly.html index 99db31ecf..275e5e6ff 100644 --- a/httemplate/graph/elements/monthly.html +++ b/httemplate/graph/elements/monthly.html @@ -90,6 +90,11 @@ $opt{'start_year'} ||= $cgi->param('start_year'); # || 1899+$curyear; $opt{'end_month'} ||= $cgi->param('end_month'); # || $curmon+1; $opt{'end_year'} ||= $cgi->param('end_year'); # || 1900+$curyear; +#find end of projection +$opt{'project_month'} ||= $cgi->param('project_month') || 0; +$opt{'project_year'} ||= $cgi->param('project_year') || 0; +# setting these to zero prevents projection on reports that don't support it + if ( $opt{'daily'} ) { # daily granularity $opt{'start_day'} ||= $cgi->param('start_day'); $opt{'end_day'} ||= $cgi->param('end_day'); @@ -111,6 +116,9 @@ my %reportopts = ( 'end_day' => $opt{'end_day'}, 'end_month' => $opt{'end_month'}, 'end_year' => $opt{'end_year'}, + 'project_day' => $opt{'project_day'}, + 'project_month' => $opt{'project_month'}, + 'project_year' => $opt{'project_year'}, 'agentnum' => $opt{'agentnum'}, 'remove_empty' => $opt{'remove_empty'}, 'doublemonths' => $opt{'doublemonths'}, @@ -125,6 +133,10 @@ my $data = $report->data; warn Dumper({'DATA' => $data}) if $opt{'debug'}; +if ( $data->{'error'} ) { + die $data->{'error'}; # could be smarter +} + my $col_labels = [ map { my $m = $_; $m =~ s/^(\d+)\//$mon[$1-1] / ; $m } @{$data->{label}} ]; $col_labels = $data->{label} if $opt{'daily'}; diff --git a/httemplate/graph/elements/report.html b/httemplate/graph/elements/report.html index 2be511aec..3773fbf1d 100644 --- a/httemplate/graph/elements/report.html +++ b/httemplate/graph/elements/report.html @@ -155,28 +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'} ) %> % unless ( $opt{'graph_type'} eq 'none' ) { -% $cgi->param('_type', 'png'); -<IMG SRC="<% $cgi->self_url %>" WIDTH="976" HEIGHT="384"> +<IMG SRC="<% "$myself;_type=png" %>" WIDTH="976" HEIGHT="384"> % } <P ALIGN="right"> % unless ( $opt{'disable_download'} ) { -% $cgi->param('_type', "xls" ); Download full results<BR> - as <A HREF="<% $cgi->self_url %>">Excel spreadsheet</A><BR> -% $cgi->param('_type', 'csv'); - as <A HREF="<% $cgi->self_url %>">CSV file</A></P> -% $cgi->param('_type', "html" ); + as <A HREF="<% "$myself;_type=xls" %>">Excel spreadsheet</A><BR> + as <A HREF="<% "$myself;_type=csv" %>">CSV file</A></P> % } % </P> @@ -271,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("%10d%6d", time, int(rand(1000000))); + $m->cache->set($session, \%opt, '1h'); +} my $sprintf = $opt{'sprintf'} || '%.2f'; diff --git a/httemplate/graph/report_cust_bill_pkg.html b/httemplate/graph/report_cust_bill_pkg.html index af61dda82..f2c486cf4 100644 --- a/httemplate/graph/report_cust_bill_pkg.html +++ b/httemplate/graph/report_cust_bill_pkg.html @@ -6,6 +6,13 @@ <% include('/elements/tr-select-from_to.html' ) %> +<TR> + <TD ALIGN="right">Project to:</TD> + <TD><& /elements/select-month_year.html, + prefix => 'project', + show_month_abbr => 1 &></TD> +</TR> + <% include('/elements/tr-select-agent.html', 'label' => 'For agent: ', 'disable_empty' => 0, |