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 &>
13 <td colspan=2 style="font-weight: bold">
14 <& /elements/radio.html,
19 <& /elements/radio.html,
25 <& /elements/tr-select.html,
28 'options' => \@countries,
29 'curr_value' => ($conf->config('countrydefault') || 'US'),
32 <& /elements/tr-select.html,
33 'label' => 'For tax named ',
35 'options' => \@taxnames,
39 <& /elements/tr-checkbox-multiple.html,
40 'label' => 'Break down by ',
41 'field' => 'breakdown',
42 'options' => \@breakdown,
44 taxclass => 'Tax class',
45 pkgclass => 'Package class',
47 district => 'District',
52 <TD>Deduct credited tax if it was
53 <SELECT NAME="credit_date">
54 <OPTION VALUE="cust_bill" SELECTED>invoiced in this period</OPTION>
55 <OPTION VALUE="cust_credit_bill">credited in this period</OPTION>
62 <BR><INPUT TYPE="submit" VALUE="Get Report">
67 $(document).ready(function() {
68 $('[name=all]').on('change', function(ev) {
69 // disable country/taxname/breakdown if 'all' = 1
71 var disabled = (this.value == 1);
72 $('[name=country').prop('disabled', disabled);
73 $('[name=taxname').prop('disabled', disabled);
74 $('[name=breakdown').prop('disabled', disabled);
77 $('[name=all]').change();
81 <% include('/elements/footer.html') %>
85 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
87 my $conf = new FS::Conf;
89 my $sth = dbh->prepare('SELECT DISTINCT(COALESCE(taxname, \'Tax\')) FROM cust_main_county');
90 $sth->execute or die $sth->errstr;
91 my @taxnames = map { $_->[0] } @{ $sth->fetchall_arrayref };
93 $sth = dbh->prepare('SELECT DISTINCT(country) FROM cust_location');
94 $sth->execute or die $sth->errstr;
95 my @countries = map { $_->[0] } @{ $sth->fetchall_arrayref };
98 if ( $conf->exists('enable_taxclasses') ) {
99 push @breakdown, 'taxclass';
101 if ( FS::pkg_class->count() > 0 ) {
102 push @breakdown, 'pkgclass';
104 if ( FS::cust_main_county->count("city is not null and city != ''") > 0 ) {
105 push @breakdown, 'city';
107 if ( FS::cust_main_county->count("district is not null") > 0 ) {
108 push @breakdown, 'district';