From: ivan Date: Tue, 16 Mar 2010 01:00:41 +0000 (+0000) Subject: w/svc_whatever option on zip code distribution report, RT#7784 X-Git-Tag: freeside_1_9_2~1 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=7527ddf7be6610d3ceb0763ba8f3a4504462d6d1 w/svc_whatever option on zip code distribution report, RT#7784 --- diff --git a/httemplate/search/cust_main-zip.html b/httemplate/search/cust_main-zip.html index 56df924bc..e87b21474 100644 --- a/httemplate/search/cust_main-zip.html +++ b/httemplate/search/cust_main-zip.html @@ -32,6 +32,17 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { $agentnum = $1; push @where, "cust_main.agentnum = $agentnum"; } + +# select svcdb + +if ( $cgi->param('svcdb') =~ /^(\w+)$/ ) { + my $svcdb = $1; + push @where, "EXISTS( SELECT 1 FROM $svcdb LEFT JOIN cust_svc USING ( svcnum ) + LEFT JOIN cust_pkg USING ( pkgnum ) + WHERE cust_pkg.custnum = cust_main.custnum + )"; +} + my $where = scalar(@where) ? 'WHERE '. join(' AND ', @where) : ''; # bill zip vs ship zip diff --git a/httemplate/search/report_cust_main-zip.html b/httemplate/search/report_cust_main-zip.html index aa802f302..00cb9ed2c 100644 --- a/httemplate/search/report_cust_main-zip.html +++ b/httemplate/search/report_cust_main-zip.html @@ -20,7 +20,7 @@ - Show customers with status: + Show customers with status +