1 <% include('/elements/header.html', 'Tax Report' ) %>
3 <FORM ACTION="report_tax.cgi" METHOD="GET">
7 <& /elements/tr-select-agent.html, 'disable_empty'=>0 &>
9 <& /elements/tr-input-beginning_ending.html &>
11 <& /elements/tr-select.html,
14 'options' => \@countries,
15 'curr_value' => ($conf->config('countrydefault') || 'US'),
18 <& /elements/tr-select.html,
19 'label' => 'For tax named ',
21 'options' => \@taxnames,
25 <& /elements/tr-checkbox-multiple.html,
26 'label' => 'Break down by ',
27 'field' => 'breakdown',
28 'options' => \@breakdown,
30 taxclass => 'Tax class',
31 pkgclass => 'Package class',
37 <BR><INPUT TYPE="submit" VALUE="Get Report">
41 <% include('/elements/footer.html') %>
45 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
47 my $conf = new FS::Conf;
49 my $sth = dbh->prepare('SELECT DISTINCT(COALESCE(taxname, \'Tax\')) FROM cust_main_county');
50 $sth->execute or die $sth->errstr;
51 my @taxnames = map { $_->[0] } @{ $sth->fetchall_arrayref };
53 $sth = dbh->prepare('SELECT DISTINCT(country) FROM cust_location');
54 $sth->execute or die $sth->errstr;
55 my @countries = map { $_->[0] } @{ $sth->fetchall_arrayref };
58 if ( $conf->exists('enable_taxclasses') ) {
59 push @breakdown, 'taxclass';
61 if ( FS::pkg_class->count() > 0 ) {
62 push @breakdown, 'pkgclass';
64 if ( FS::cust_main_county->count("city is not null and city != ''") > 0 ) {
65 push @breakdown, 'city';