RT# 75095 - Added Ooma integration to one time charges
[freeside.git] / httemplate / misc / sales.cgi
1 <% encode_json( \@return ) %>\
2 <%init>
3
4 my $agentnum = scalar($cgi->param('arg'));
5
6 my %hash = ( 'disabled' => '' );
7 if ( $agentnum > 0 ) {
8   $hash{'agentnum'} = $agentnum;
9 }
10 my @sales = qsearch({
11   'table'     => 'sales',
12   'hashref'   => \%hash,
13   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
14   'order_by'  => 'ORDER BY salesperson',
15 });
16
17 my @return = map  {
18                     ( $_->salesnum,
19                       $_->salesperson,
20                     )
21                   }
22                   #sort { $a->salesperson cmp $b->salesperson }
23                   @sales;
24
25 </%init>