1 <& elements/browse.html,
2 'title' => 'Sales People',
3 'name_singular' => 'sales person',
4 'menubar' => ['Add a new sales person' => $p.'edit/sales.html'],
5 'query' => { 'table' => 'sales' },
6 'count_query' => 'SELECT COUNT(*) FROM sales',
11 'disabled_statuspos' => 1,
16 my $curuser = $FS::CurrentUser::CurrentUser;
17 die "access denied" unless $curuser->access_right('Edit sales people');
19 my $conf = new FS::Conf;
21 #Sales people bring in business.<BR><BR>
23 my @header = ( 'Sales person' );
24 my @fields = ( 'salesperson' );
25 my @links = ( [$p.'edit/sales.html?', 'salesnum'] );
27 if ( $curuser->access_right('Configuration') ) {
28 push @header, 'Agent';
29 push @fields, 'agent_name';
30 push @links, [ $p.'edit/agent.cgi?', 'agentnum' ];
33 push @header, 'Master Customer';
36 return '' unless $sales->sales_custnum;
37 include('/elements/small_custview.html',
38 $sales->sales_custnum,
39 scalar($conf->config('countrydefault')),
41 $p.'view/cust_main.cgi',
46 push @header, 'Commissions';
51 #started out as false laziness w/browse/agent.cgi
52 # (which said surprising amount of false laziness w/ edit/process/agent.cgi)
53 # but this now returns an edit.html data structure that renders to a table
56 my @pkg_class = qsearch('pkg_class', { 'disabled'=>'' });
60 my %sales_pkg_class = ( 'salesnum' => $sales->salesnum,
61 'classnum' => $_ ? $_->classnum : ''
64 qsearchs( 'sales_pkg_class', \%sales_pkg_class )
65 || new FS::sales_pkg_class \%sales_pkg_class;
66 #my $param = 'classnum'. $sales_pkg_class{classnum};
70 data => encode_entities(
71 $_ ? $_->classname : mt('(no package class)')
75 data => ($sales_pkg_class->commission_percent || 0). '%',
79 $sales_pkg_class->commission_duration
80 ? ' for '. $sales_pkg_class->commission_duration. ' months'