Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / search / report_tax.html
1 <% include('/elements/header.html', 'Tax Report' ) %>
2
3 <FORM ACTION="report_tax.cgi" METHOD="GET">
4
5 <TABLE>
6
7 % if ( $conf->config('tax-report_groups') ) {
8 %   my @lines = $conf->config('tax-report_groups');
9     
10   <TR>
11     <TD ALIGN="right">Tax group</TD>
12     <TD>
13       <SELECT NAME="report_group">
14
15         <OPTION VALUE="">all</OPTION>
16
17 %       foreach my $line ( @lines ) {
18 %         $line =~ /^\s*(.+)\s+(=|!=)\s+(.*)\s*$/ #or next;
19 %           or do { warn "bad report_group line: $line\n"; next; };
20 %         my($label, $op, $value) = ($1, $2, $3);
21
22           <OPTION VALUE="<% "$op $value" %>"><% $label %></OPTION>
23 %       }
24
25       </SELECT>
26     </TD>
27   </TR>
28
29 % }
30
31  <% include( '/elements/tr-select-agent.html', 'disable_empty'=>0 ) %>
32
33  <% include( '/elements/tr-input-beginning_ending.html' ) %>
34
35 %    if ( $city ) {
36    <TR>
37      <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="show_cities" VALUE="1" onclick="toggle_show_cities(this)"></TD>
38      <TD>Show cities</TD>
39    </TR>
40    <TR>
41      <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="show_districts" VALUE="1" DISABLED></TD>
42      <TD>Show districts</TD>
43    </TR>
44   <SCRIPT TYPE="text/javascript">
45   function toggle_show_cities() {
46     what = document.getElementsByName('show_cities')[0];
47     what.form.show_districts.disabled = !what.checked;
48     what.form.show_districts.checked  = what.checked;
49   }
50   toggle_show_cities();
51   </SCRIPT>
52 % } 
53
54 %    if ( $conf->exists('enable_taxclasses') ) {
55    <TR>
56      <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="show_taxclasses" VALUE="1"></TD>
57      <TD>Show tax classes</TD>
58    </TR>
59 % } 
60
61 % my @pkg_class = qsearch('pkg_class', {});
62 % if ( @pkg_class ) {
63    <TR>
64      <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="show_pkgclasses" VALUE="1"></TD>
65      <TD>Show package classes</TD>
66    </TR>
67 % } 
68
69 </TABLE>
70
71 <BR><INPUT TYPE="submit" VALUE="Get Report">
72
73 </FORM>
74
75 <% include('/elements/footer.html') %>
76 <%init>
77
78 die "access denied"
79   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
80
81 my $conf = new FS::Conf;
82
83 my $city_sql = "SELECT COUNT(*) FROM cust_main_county
84                   WHERE city != '' AND city IS NOT NULL
85                   LIMIT 1";
86
87 my $city_sth = dbh->prepare($city_sql) or die dbh->errstr;
88 $city_sth->execute or die $city_sth->errstr;
89 my $city = $city_sth->fetchrow_arrayref->[0];
90
91 </%init>