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',
33 district => 'District',
38 <TD>Deduct credited tax if it was
39 <SELECT NAME="credit_date">
40 <OPTION VALUE="cust_bill" SELECTED>invoiced in this period</OPTION>
41 <OPTION VALUE="cust_credit_bill">credited in this period</OPTION>
48 <BR><INPUT TYPE="submit" VALUE="Get Report">
52 <% include('/elements/footer.html') %>
56 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
58 my $conf = new FS::Conf;
60 my $sth = dbh->prepare('SELECT DISTINCT(COALESCE(taxname, \'Tax\')) FROM cust_main_county');
61 $sth->execute or die $sth->errstr;
62 my @taxnames = map { $_->[0] } @{ $sth->fetchall_arrayref };
64 $sth = dbh->prepare('SELECT DISTINCT(country) FROM cust_location');
65 $sth->execute or die $sth->errstr;
66 my @countries = map { $_->[0] } @{ $sth->fetchall_arrayref };
69 if ( $conf->exists('enable_taxclasses') ) {
70 push @breakdown, 'taxclass';
72 if ( FS::pkg_class->count() > 0 ) {
73 push @breakdown, 'pkgclass';
75 if ( FS::cust_main_county->count("city is not null and city != ''") > 0 ) {
76 push @breakdown, 'city';
78 if ( FS::cust_main_county->count("district is not null") > 0 ) {
79 push @breakdown, 'district';