X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_timespan.html;h=f95250a44784f5afd33848796297eee18301b9b8;hb=1af581404eae84707fa1c66e3f455eb433e3b16b;hp=a380b78ab3bacf6db69b00cc0831332ccf1d1542;hpb=2d16e600051d0bc024961e9790ea446c197ef67c;p=freeside.git diff --git a/httemplate/search/cust_timespan.html b/httemplate/search/cust_timespan.html index a380b78ab..f95250a44 100644 --- a/httemplate/search/cust_timespan.html +++ b/httemplate/search/cust_timespan.html @@ -11,6 +11,7 @@ 'header' => \@header, 'fields' => \@fields, 'links' => \@links, + 'disable_maxselect' => '1', &> <%init> @@ -84,11 +85,15 @@ my $active_pkg_sql = 'select pkgnum from cust_pkg where cust_pkg.custnum = cust_ ## sql to get the first active date, last cancel date, and last reason. my $active_date = 'select min(setup) from cust_pkg left join part_pkg using (pkgpart) where cust_pkg.custnum = cust_main.custnum and part_pkg.freq > \'0\''; -my $cancel_date = 'select max(cancel) from cust_pkg where cust_pkg.custnum = cust_main.custnum'; + +## 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 $cancel_reason = 'select reason.reason from cust_pkg left join cust_pkg_reason on (cust_pkg.pkgnum = cust_pkg_reason.pkgnum) left join reason on (cust_pkg_reason.reasonnum = reason.reasonnum) - where cust_pkg.custnum = cust_main.custnum and cust_pkg_reason.date = ('.$cancel_date.') + where cust_pkg.custnum = cust_main.custnum and cust_pkg_reason.date = ('.$cancel_date.') limit 1 '; my @header = ( '#', 'Name', 'Address', 'Phone', 'Email', 'Active Date', 'Cancelled Date', 'Reason', 'Active Days' );