summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2018-07-27 18:14:31 -0400
committerChristopher Burger <burgerc@freeside.biz>2018-07-27 18:14:31 -0400
commitb548768fbbcdcae4df6f46ac38f0615437a20298 (patch)
tree7e2f8c97b8f540a30c8574d4eb5af589f4dc15a1
parent25efd7207d9ea9be4bea1093917c0d8dc4b1e87a (diff)
RT# 77160 - added date search on customer timespan report
-rw-r--r--httemplate/search/cust_timespan.html7
-rw-r--r--httemplate/search/elements/search.html15
-rw-r--r--httemplate/search/report_cust_timespan.html2
3 files changed, 16 insertions, 8 deletions
diff --git a/httemplate/search/cust_timespan.html b/httemplate/search/cust_timespan.html
index f568425..f95250a 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,7 +85,11 @@ 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)
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index 0e8c69a..730a51a 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -389,14 +389,15 @@ unless ( $type =~ /^(csv|xml|\w*.xls)$/) {
#setup some pagination things if we're in html mode
my $conf = new FS::Conf;
- $confmax = $conf->config('maxsearchrecordsperpage') || 100;
- if ( $cgi->param('maxrecords') =~ /^(\d+)$/ ) {
- $maxrecords = $1;
- } else {
- $maxrecords ||= $confmax;
- }
-
$opt{'disable_maxselect'} ||= $conf->exists('disable_maxselect');
+ unless ($opt{'disable_maxselect'}) {
+ $confmax = $conf->config('maxsearchrecordsperpage') || 100;
+ if ( $cgi->param('maxrecords') =~ /^(\d+)$/ ) {
+ $maxrecords = $1;
+ } else {
+ $maxrecords ||= $confmax;
+ }
+ }
$limit = $maxrecords ? "LIMIT $maxrecords" : '';
diff --git a/httemplate/search/report_cust_timespan.html b/httemplate/search/report_cust_timespan.html
index 4ff3bb8..27dd940 100644
--- a/httemplate/search/report_cust_timespan.html
+++ b/httemplate/search/report_cust_timespan.html
@@ -20,6 +20,8 @@
'curr_value' => scalar( $cgi->param('cust_status') ),
&>
+ <& /elements/tr-input-beginning_ending.html &>
+
</FORM>
</TABLE>