X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FReport%2FTable%2FMonthly.pm;h=f4ba02008f3e83a10d21d1371c05056d65be054d;hp=0ff7efd16c43424525b706d30fd2077cc54549e1;hb=32365ef65ca6a40b5262cf166543b1d84c6aa57d;hpb=53b6529e6a9c3eb3a314d87e4a405b17af4daf45 diff --git a/FS/FS/Report/Table/Monthly.pm b/FS/FS/Report/Table/Monthly.pm index 0ff7efd16..f4ba02008 100644 --- a/FS/FS/Report/Table/Monthly.pm +++ b/FS/FS/Report/Table/Monthly.pm @@ -182,9 +182,15 @@ sub data { push @{$data{label}}, "$smonth/$syear"; # sprintf? my $speriod = timelocal(0,0,0,1,$smonth-1,$syear); - push @{$data{speriod}}, $speriod; if ( ++$smonth == 13 ) { $syear++; $smonth=1; } my $eperiod = timelocal(0,0,0,1,$smonth-1,$syear); + # 12-month mode: show results in a sliding window ending at $eperiod, + # but starting 12 months before. + if ( $self->{'12mo'}) { + $speriod = timelocal(0,0,0,1,$smonth-1,$syear-1); + } + + push @{$data{speriod}}, $speriod; push @{$data{eperiod}}, $eperiod; my $col = 0; # a "column" here is the data corresponding to an item