X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Freport_tax.html;h=f920adbac515f625e8a4c59997401df005fb1333;hb=5027e0e807b38364fc10c992ea50a2ad7d934986;hp=6e78d354a07fc2fb54371ca5056c308333f36870;hpb=3ce7691203a7737406bf2d4442f7fd84b81f847e;p=freeside.git
diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html
index 6e78d354a..f920adbac 100755
--- a/httemplate/search/report_tax.html
+++ b/httemplate/search/report_tax.html
@@ -4,28 +4,58 @@
- <% include( '/elements/tr-select-agent.html' ) %>
+ <& /elements/tr-select-agent.html, 'disable_empty'=>0 &>
- <% include( '/elements/tr-input-beginning_ending.html' ) %>
-% my $conf = new FS::Conf;
-% if ( $conf->exists('enable_taxclasses') ) {
-%
+ <& /elements/tr-input-beginning_ending.html &>
-
- |
- Show tax classes |
-
-% }
-% my @pkg_class = qsearch('pkg_class', {});
-% if ( @pkg_class ) {
-%
+
+ |
+
+ <& /elements/radio.html,
+ 'field' => 'all',
+ 'value' => 1,
+ 'curr_value' => 1,
+ &> All taxes
+ <& /elements/radio.html,
+ 'field' => 'all',
+ 'value' => 0,
+ &> A specific tax
+ |
+
+ <& /elements/tr-select.html,
+ 'label' => 'Country',
+ 'field' => 'country',
+ 'options' => \@countries,
+ 'curr_value' => ($conf->config('countrydefault') || 'US'),
+ &>
-
- |
- Show package classes |
-
-% }
+ <& /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',
+ district => 'District',
+ },
+ &>
+
+ |
+ Deduct credited tax if it was
+
+ |
+
@@ -33,4 +63,49 @@
+
+
<% 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>