summaryrefslogtreecommitdiff
path: root/FS/FS/Report
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-04-05 19:14:03 -0700
committerMark Wells <mark@freeside.biz>2012-04-05 19:14:03 -0700
commit43d5252f60e7322ea4a0922658939b703f304db2 (patch)
treeda6c84b594f5d3d5e4107024d2bb7fcd7061cde6 /FS/FS/Report
parentaef1bdae7fb5e72b785581493901d390f2cbdac9 (diff)
simplify UI for projected sales report, #15393
Diffstat (limited to 'FS/FS/Report')
-rw-r--r--FS/FS/Report/Table/Monthly.pm31
1 files changed, 10 insertions, 21 deletions
diff --git a/FS/FS/Report/Table/Monthly.pm b/FS/FS/Report/Table/Monthly.pm
index 4121699..87c13a8 100644
--- a/FS/FS/Report/Table/Monthly.pm
+++ b/FS/FS/Report/Table/Monthly.pm
@@ -49,9 +49,8 @@ sub data {
my $syear = $self->{'start_year'};
my $emonth = $self->{'end_month'};
my $eyear = $self->{'end_year'};
- # how far to extrapolate into the future
- my $pmonth = $self->{'project_month'};
- my $pyear = $self->{'project_year'};
+ # whether to extrapolate into the future
+ my $projecting = $self->{'projection'};
# sanity checks
if ( $eyear < $syear or
@@ -61,17 +60,14 @@ sub data {
my $agentnum = $self->{'agentnum'};
- if ( $pyear > $eyear or
- ($pyear == $eyear and $pmonth > $emonth) ) {
+ if ( $projecting ) {
- # create the entire projection set first to avoid timing problems
+ $self->init_projection;
- $self->init_projection if $pmonth;
-
- my $thisyear = $eyear;
- my $thismonth = $emonth;
- while ( $thisyear < $pyear ||
- ( $thisyear == $pyear and $thismonth <= $pmonth )
+ my $thismonth = $smonth;
+ my $thisyear = $syear;
+ while ( $thisyear < $eyear ||
+ ( $thisyear == $eyear and $thismonth <= $emonth )
) {
my $speriod = timelocal(0,0,0,1,$thismonth-1,$thisyear);
$thismonth++;
@@ -84,10 +80,8 @@ sub data {
my %data;
- my $max_year = $pyear || $eyear;
- my $max_month = $pmonth || $emonth;
-
- my $projecting = 0; # are we currently projecting?
+ my $max_year = $eyear;
+ my $max_month = $emonth;
while ( $syear < $max_year
|| ( $syear == $max_year && $smonth < $max_month+1 ) ) {
@@ -101,11 +95,6 @@ sub data {
push @{$data{label}}, "$smonth/$syear";
}
- if ( $syear > $eyear || ( $syear == $eyear && $smonth >= $emonth + 1 ) ) {
- # start getting data from the projection
- $projecting = 1;
- }
-
my $speriod = timelocal(0,0,0,1,$smonth-1,$syear);
push @{$data{speriod}}, $speriod;
if ( ++$smonth == 13 ) { $syear++; $smonth=1; }