From 665109510114cf56e5ebd8eda0bef24b12ca41a2 Mon Sep 17 00:00:00 2001
From: mark
Date: Sat, 7 Jan 2012 23:04:03 +0000
Subject: projected sales report, #15393
---
httemplate/graph/elements/monthly.html | 12 ++++++++++++
httemplate/graph/elements/report.html | 24 +++++++++++++++++-------
httemplate/graph/report_cust_bill_pkg.html | 7 +++++++
3 files changed, 36 insertions(+), 7 deletions(-)
(limited to 'httemplate')
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');
-
% unless ( $opt{'disable_download'} ) {
-% $cgi->param('_type', "xls" );
Download full results
+
" WIDTH="976" HEIGHT="384">
% }
- as Excel spreadsheet
-% $cgi->param('_type', 'csv');
- as CSV file
+ as ">CSV file