summaryrefslogtreecommitdiff
path: root/httemplate/search/agent_commission.html
blob: a7edc3b2278cea2a36c88596dceb0d5033f8d3d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% if ( $agentnum ) {
%   my $url = 'agent_pkg_class.html?' . $cgi->query_string;
<% $cgi->redirect($url) %>
% } else {
<& elements/commission.html,
  'title'         => $title,
  'name_singular' => 'agent',
  'header'        => [ 'Agent' ],
  'fields'        => [ 'agent' ],
  'links'         => [ '' ],
  'align'         => 'l',
  'query'         => \%query,
  'count_query'   => $count_query,
  'disableable'   => 1,
  'sales_detail_link'   => $sales_link,
  'credit_detail_link'  => $commission_link,
&>
% }
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');

my $conf = new FS::Conf;

my %query = ( 'table' => 'agent' );
my $count_query = "SELECT COUNT(*) FROM agent";

my $agentnum = '';
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
  $agentnum = $1;
} else {
  $cgi->delete('agentnum');
}

my $title = 'Agent commission';

my $sales_link = [ 'agent_pkg_class.html?agentnum=', 'agentnum' ];

my $commission_link = [ 'cust_credit.html?commission_agentnum=', 'agentnum' ];

</%init>