X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_tax_exempt_pkg.cgi;h=267c9383a62a90c13e4472ba30ea58cbe849eedb;hb=baf5cfb99275c060748ec1c212e646759af6e96b;hp=990e344b7dc575bfbea5e12535445c2e061f4d71;hpb=d2062945973d28e65b942f37bbbd9a5ab4f4172c;p=freeside.git diff --git a/httemplate/search/cust_tax_exempt_pkg.cgi b/httemplate/search/cust_tax_exempt_pkg.cgi index 990e344b7..267c9383a 100644 --- a/httemplate/search/cust_tax_exempt_pkg.cgi +++ b/httemplate/search/cust_tax_exempt_pkg.cgi @@ -1,4 +1,4 @@ -<% include( 'elements/search.html', +<& elements/search.html, 'title' => 'Tax exemptions', 'name' => 'tax exemptions', 'query' => $query, @@ -54,17 +54,35 @@ $ilink, $ilink, - ( map { $clink } FS::UI::Web::cust_header() ), + ( map { $_ ne 'Cust. Status' ? $clink : '' } + FS::UI::Web::cust_header() + ), ], - 'align' => 'rrrlrc', # 'rlrrrc', - ) -%> + 'align' => 'rrrlrc'.FS::UI::Web::cust_aligns(), # 'rlrrrc', + 'color' => [ + '', + '', + '', + '', + '', + '', + FS::UI::Web::cust_colors(), + ], + 'style' => [ + '', + '', + '', + '', + '', + '', + FS::UI::Web::cust_styles(), + ], +&> <%once> my $join_cust = " - JOIN cust_bill USING ( invnum ) - LEFT JOIN cust_main USING ( custnum ) -"; + JOIN cust_bill USING ( invnum )" . + FS::UI::Web::join_cust_main('cust_bill', 'cust_pkg'); my $join_pkg = " LEFT JOIN cust_pkg USING ( pkgnum ) @@ -73,14 +91,17 @@ my $join_pkg = " my $join = " JOIN cust_bill_pkg USING ( billpkgnum ) - $join_cust $join_pkg + $join_cust "; <%init> -my @where = (); +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View customer tax exemptions'); + +my @where = ("exempt_monthly = 'Y'"); my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); if ( $beginning || $ending ) { @@ -90,14 +111,21 @@ if ( $beginning || $ending ) { } if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { - push @where, "agentnum = $1"; + push @where, "cust_main.agentnum = $1"; } if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { push @where, "cust_main.custnum = $1"; } +if ( $cgi->param('classnum') eq '0' ) { + push @where, "part_pkg.classnum IS NULL"; +} elsif ( $cgi->param('classnum') =~ /^(\d+)$/ ) { + push @where, "part_pkg.classnum = $1"; +} + if ( $cgi->param('out') ) { + # wtf? how would you ever get exemptions on a non-taxable package location? push @where, " 0 = ( @@ -128,6 +156,11 @@ if ( $cgi->param('out') ) { push @where, 'taxclass = '. dbh->quote( $cgi->param('taxclass') ) if $cgi->param('taxclass'); +} elsif ( $cgi->param('taxnum') ) { + + my $taxnum_in = join(',', grep /^\d+$/, $cgi->param('taxnum') ); + push @where, "taxnum IN ($taxnum_in)" if $taxnum_in; + } my $where = scalar(@where) ? 'WHERE '.join(' AND ', @where) : '';