3 %my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
6 % JOIN cust_bill USING ( invnum )
7 % LEFT JOIN cust_main USING ( custnum )
11 % LEFT JOIN cust_pkg USING ( pkgnum )
12 % LEFT JOIN part_pkg USING ( pkgpart )
16 % JOIN cust_bill_pkg USING ( billpkgnum )
22 % WHERE _date >= $beginning AND _date <= $ending
24 %# AND payby != 'COMP'
26 %if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
27 % $where .= " AND agentnum = $1 ";
30 %if ( $cgi->param('out') ) {
34 % SELECT COUNT(*) FROM cust_main_county AS county_out
35 % WHERE ( county_out.county = cust_main.county
36 % OR ( county_out.county IS NULL AND cust_main.county = '' )
37 % OR ( county_out.county = '' AND cust_main.county IS NULL)
38 % OR ( county_out.county IS NULL AND cust_main.county IS NULL)
40 % AND ( county_out.state = cust_main.state
41 % OR ( county_out.state IS NULL AND cust_main.state = '' )
42 % OR ( county_out.state = '' AND cust_main.state IS NULL )
43 % OR ( county_out.state IS NULL AND cust_main.state IS NULL )
45 % AND county_out.country = cust_main.country
46 % AND county_out.tax > 0
50 %} elsif ( $cgi->param('country' ) ) {
52 % my $county = dbh->quote( $cgi->param('county') );
53 % my $state = dbh->quote( $cgi->param('state') );
54 % my $country = dbh->quote( $cgi->param('country') );
56 % AND ( county = $county OR $county = '' )
57 % AND ( state = $state OR $state = '' )
58 % AND country = $country
60 % $where .= ' AND taxclass = '. dbh->quote( $cgi->param('taxclass') )
61 % if $cgi->param('taxclass');
65 %my $count_query = "SELECT COUNT(*), SUM(amount)".
66 % " FROM cust_tax_exempt_pkg $join $where";
69 % 'table' => 'cust_tax_exempt_pkg',
70 % 'addl_from' => $join,
72 % 'select' => join(', ',
73 % 'cust_tax_exempt_pkg.*',
77 % 'cust_main.custnum',
78 % FS::UI::Web::cust_sql_fields(),
80 % 'extra_sql' => $where,
83 %my $ilink = [ "${p}view/cust_bill.cgi?", 'invnum' ];
84 %my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
86 %my $conf = new FS::Conf;
87 %my $money_char = $conf->config('money_char') || '$';
90 <% include( 'elements/search.html',
91 'title' => 'Tax exemptions',
92 'name' => 'tax exemptions',
94 'count_query' => $count_query,
95 'count_addl' => [ $money_char. '%.2f total', ],
103 FS::UI::Web::cust_header(),
107 sub { $_[0]->month. '/'. $_[0]->year; },
108 sub { $money_char. $_[0]->amount; },
111 $_[0]->billpkgnum. ': '.
114 : $_[0]->get('itemdesc')
118 ? $money_char. $_[0]->setup. ' setup'
121 ( $_[0]->setup > 0 && $_[0]->recur > 0
126 ? $money_char. $_[0]->recur. ' recur'
133 sub { time2str('%b %d %Y', shift->_date ) },
135 \&FS::UI::Web::cust_fields,
146 ( map { $clink } FS::UI::Web::cust_header() ),
148 'align' => 'rrrlrc', # 'rlrrrc',