X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Freport_tax.html;h=20aa07fc843ef74b86d6c2600ac4676374a8f287;hb=df1ebf662a9fc3f89503036e0dbf6833c1b95f9e;hp=8640e0ee720927f545f684361116c04451bd1873;hpb=8d9be02c9965db4c4a48a2221455160685a95462;p=freeside.git
diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html
index 8640e0ee7..20aa07fc8 100755
--- a/httemplate/search/report_tax.html
+++ b/httemplate/search/report_tax.html
@@ -4,49 +4,34 @@
-% if ( $conf->config('tax-report_groups') ) {
-% my @lines = $conf->config('tax-report_groups');
-
-
- Tax group |
-
-
- |
-
-
-% }
-
- <% include( '/elements/tr-select-agent.html', 'disable_empty'=>0 ) %>
-
- <% include( '/elements/tr-input-beginning_ending.html' ) %>
-
-% if ( $conf->exists('enable_taxclasses') ) {
-
- |
- Show tax classes |
-
-% }
-
-% my @pkg_class = qsearch('pkg_class', {});
-% if ( @pkg_class ) {
-
- |
- Show package classes |
-
-% }
-
+ <& /elements/tr-select-agent.html, 'disable_empty'=>0 &>
+
+ <& /elements/tr-input-beginning_ending.html &>
+
+ <& /elements/tr-select.html,
+ 'label' => 'Country',
+ 'field' => 'country',
+ 'options' => \@countries,
+ 'curr_value' => ($conf->config('countrydefault') || 'US'),
+ &>
+
+ <& /elements/tr-select.html,
+ 'label' => 'For tax named ',
+ 'field' => 'taxname',
+ 'options' => \@taxnames,
+ 'disable_empty' => 1,
+ &>
+
+ <& /elements/tr-checkbox-multiple.html,
+ 'label' => 'Break down by ',
+ 'field' => 'breakdown',
+ 'options' => \@breakdown,
+ 'option_labels' => {
+ taxclass => 'Tax class',
+ pkgclass => 'Package class',
+ city => 'City',
+ },
+ &>
@@ -61,4 +46,23 @@ die "access denied"
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';
+}
+
%init>