Revert "RT# 39340 - configured the minimal selfservice to get mac address from radius...
[freeside.git] / httemplate / search / cust_tax_adjustment.html
1 <& elements/search.html,
2               'title'         => $title,
3               'name_singular' => 'tax adjustment',
4               'query'         => $query,
5               'count_query'   => $count_query,
6               'header'        => [ 'Tax', 'Amount', 'Comment', 'Invoice' ],
7               'fields'        => [ 'taxname',
8                                    sub { $money_char. shift->amount },
9                                    'comment',
10                                    sub { my $l = shift->cust_bill_pkg;
11                                          $l ? '#'.$l->invnum : '';
12                                        },
13                                  ],
14               'links'         => [ '', '', '', $ilink ],
15           
16 &>
17 <%init>
18
19 die "access denied"
20   unless $FS::CurrentUser::CurrentUser->access_right('Add customer tax adjustment');
21
22 my $conf = new FS::Conf;
23 my $money_char = $conf->config('money_char') || '$';
24
25 my $count_query = 'SELECT COUNT(*) FROM cust_tax_adjustment';
26
27 my $hashref = {};
28
29 my $custnum = '';
30 my $cust_main = '';
31 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
32   $custnum = $1;
33   $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
34   $hashref->{'custnum'} = $custnum;
35   $count_query .= " WHERE custnum = $custnum ";
36 }
37
38 my $title = 'Tax adjustments';
39 $title .= ' for '. $cust_main->name if $cust_main;
40
41 my $query = { 'table'   => 'cust_tax_adjustment',
42               'hashref' => $hashref,
43             };
44
45 my $ilink = [ $p.'view/cust_bill.cgi?', sub { my $l = shift->cust_bill_pkg;
46                                                $l ? $l->invnum : 'EXCEPTION';
47                                              }
48            ];
49
50 #XXX would be nice to list customer fields on the report too, if we ever need
51 # to link to here without a custnum (i'm sure we will, eventually...)
52
53 </%init>