X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Freport_tax.html;h=8d8d1084c4eb12f1f73b26a74d16ef0f17cd3527;hb=11df448ba461eed4d33fded0f21ed15c155a7896;hp=bdeb8e2372d45c17c14b5d94b3da55afb2e50fb1;hpb=2c757d7db4cb6a7b9655de13206fcc84fb7ce61f;p=freeside.git diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html index bdeb8e237..8d8d1084c 100755 --- a/httemplate/search/report_tax.html +++ b/httemplate/search/report_tax.html @@ -1,30 +1,47 @@ -<%= include('/elements/header.html', 'Tax Report' ) %> +<% include('/elements/header.html', 'Tax Report' ) %>
-<%= include('/elements/footer.html') %> +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + +my $conf = new FS::Conf; + +my $sth = dbh->prepare('SELECT DISTINCT(COALESCE(taxname, \'Tax\')) FROM cust_main_county'); +$sth->execute or die $sth->errstr; +my @taxnames = map { $_->[0] } @{ $sth->fetchall_arrayref }; + +$sth = dbh->prepare('SELECT DISTINCT(country) FROM cust_location'); +$sth->execute or die $sth->errstr; +my @countries = map { $_->[0] } @{ $sth->fetchall_arrayref }; + +my @breakdown; +if ( $conf->exists('enable_taxclasses') ) { + push @breakdown, 'taxclass'; +} +if ( FS::pkg_class->count() > 0 ) { + push @breakdown, 'pkgclass'; +} +if ( FS::cust_main_county->count("city is not null and city != ''") > 0 ) { + push @breakdown, 'city'; +} +if ( FS::cust_main_county->count("district is not null") > 0 ) { + push @breakdown, 'district'; +} + +%init>