summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2018-08-06 20:06:04 -0400
committerChristopher Burger <burgerc@freeside.biz>2018-08-06 20:06:04 -0400
commit038b31793f290f65222ae748df05e703c6ae035d (patch)
tree60bc6016b33e998a248f69e3db98a0c19ca785bc
parentf8c83f3becbd2792eba93c9f87d6c1e4f03414cf (diff)
RT# 77160 - updated date selection sql to make sure last cancel date falls with in range
-rw-r--r--httemplate/search/cust_timespan.html3
1 files changed, 2 insertions, 1 deletions
diff --git a/httemplate/search/cust_timespan.html b/httemplate/search/cust_timespan.html
index a511a30a5..9c9a8261c 100644
--- a/httemplate/search/cust_timespan.html
+++ b/httemplate/search/cust_timespan.html
@@ -88,7 +88,8 @@ my $active_date = 'select min(setup) from cust_pkg left join part_pkg using (pkg
## set cancel date range here
my($beginning_date, $ending_date) = FS::UI::Web::parse_beginning_ending($cgi, '');
-my $cancel_date = 'select max(cancel) from cust_pkg left join part_pkg using (pkgpart) where cust_pkg.custnum = cust_main.custnum and part_pkg.freq > \'0\' and (cancel >= '.$beginning_date.' and cancel <= '.$ending_date.')';
+my $max_cancel_sql = "select max(cancel) from cust_pkg left join part_pkg using (pkgpart) where cust_pkg.custnum = cust_main.custnum and part_pkg.freq > \'0\'";
+my $cancel_date = $max_cancel_sql.' and (('.$max_cancel_sql.') >= '.$beginning_date.' and ('.$max_cancel_sql.') <= '.$ending_date.')';
my $cancel_reason = 'select reason.reason from cust_pkg
left join cust_pkg_reason on (cust_pkg.pkgnum = cust_pkg_reason.pkgnum)