fix advanced package report, RT#40292, fallout from RT#20173
[freeside.git] / httemplate / search / agent_commission.html
1 % if ( $agentnum ) {
2 <% $cgi->redirect($sales_link->[0] . $agentnum) %>
3 % } else {
4 <& elements/commission.html,
5   'title'         => $title,
6   'name_singular' => 'agent',
7   'header'        => [ 'Agent' ],
8   'fields'        => [ 'agent' ],
9   'links'         => [ '' ],
10   'align'         => 'l',
11   'query'         => \%query,
12   'count_query'   => $count_query,
13   'disableable'   => 1,
14   'sales_detail_link'   => $sales_link,
15   'credit_detail_link'  => $commission_link,
16 &>
17 % }
18 <%init>
19
20 die "access denied"
21   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
22
23 my $conf = new FS::Conf;
24
25 my %query = ( 'table' => 'agent' );
26 my $count_query = "SELECT COUNT(*) FROM agent";
27
28 my $agentnum = '';
29 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
30   $agentnum = $1;
31 } else {
32   $cgi->delete('agentnum');
33 }
34
35 my $title = 'Agent commission';
36
37 my $sales_link = [ 'agent_pkg_class.html?agentnum=', 'agentnum' ];
38
39 my $commission_link = [ 'cust_credit.html?commission_agentnum=', 'agentnum' ];
40
41 </%init>