X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fpart_pkg.html;h=a90f13c951ff23832c12066b2184d75ae15e2a0c;hp=2c9bdee1c9457ffcc170eed13498337dceb6974c;hb=7b0bbc4117a7959b9f7b7b2cf999b8188ba34160;hpb=f8e71b44a39cf7b4d8185c57a46045636e7cc2a4 diff --git a/httemplate/search/part_pkg.html b/httemplate/search/part_pkg.html index 2c9bdee1c..a90f13c95 100644 --- a/httemplate/search/part_pkg.html +++ b/httemplate/search/part_pkg.html @@ -1,4 +1,4 @@ -<% include( 'elements/search.html', +<& elements/search.html, 'title' => $title, 'name_singular' => $name, 'header' => \@header, @@ -14,8 +14,8 @@ 'links' => \@links, 'align' => $align, 'sort_fields' => [], - ) -%> + +&> <%init> #this is about reports about packages definitions (starting w/commission ones) @@ -23,7 +23,7 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" - unless $curuser->access_right('Financial reports'); + unless $curuser->access_right('Employees: Commission Report'); #that's all this does so far my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; @@ -34,6 +34,7 @@ my $name = 'package definition'; my $select = ''; my $addl_from = ''; my @where = (); +my @top_where = (); my @order_by = (); my @header = (); my @fields = (); @@ -65,7 +66,7 @@ if (1) { #commission reports $title = $access_user->name; - $match = 'cust_pkg.usernum = '. $access_user->usernum; + push @top_where, 'access_user.usernum = '. $access_user->usernum; } else { @@ -196,6 +197,8 @@ if (1) { #commission reports } elsif (0) { #agent commission reports push @arg, 'XXXagent_custnum'; #$agent->agent_custnum } + #warn $sql; + #warn join(',', @arg); my $sth = dbh->prepare($sql) or die dbh->errstr; $sth->execute(@arg) or die $sth->errstr; $money_char. sprintf('%.2f', $sth->fetchrow_arrayref->[0] ); @@ -207,7 +210,8 @@ if (1) { #commission reports push @order_by, 'pkgpart'; #pkg? $select ||= 'part_pkg.*'; -my $extra_sql = scalar(@where) ? 'WHERE ' . join(' AND ', @where) : ''; +push @top_where, @where; +my $extra_sql = scalar(@top_where) ? 'WHERE ' . join(' AND ', @top_where) : ''; $extra_sql .= "GROUP BY $group_by" if $group_by; my $order_by = join(', ', @order_by);