diff options
| author | Mark Wells <mark@freeside.biz> | 2015-03-13 15:24:09 -0700 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2015-03-13 15:24:09 -0700 |
| commit | ed741d82e6ef8b2c66985f6b54d5cb26e0a70acb (patch) | |
| tree | c22fd88a977c369da77cfccb78172d747c49a56d /httemplate/search/agent_pkg_class.html | |
| parent | 8e50b6f6fbaa9d732a371114c0dfc95c326cb890 (diff) | |
restructure agent commission reporting, #23348
Diffstat (limited to 'httemplate/search/agent_pkg_class.html')
| -rw-r--r-- | httemplate/search/agent_pkg_class.html | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/httemplate/search/agent_pkg_class.html b/httemplate/search/agent_pkg_class.html new file mode 100644 index 000000000..5b8c7bfe5 --- /dev/null +++ b/httemplate/search/agent_pkg_class.html @@ -0,0 +1,45 @@ +<& elements/commission.html, + 'title' => $title, + 'name_singular' => 'package class', + 'header' => [ 'Package class' ], + 'fields' => [ 'classname' ], + 'links' => [ '' ], + 'align' => 'l', + 'query' => \%query, + 'count_query' => $count_query, + '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; + +$cgi->param('agentnum') =~ /^(\d+)$/ or die 'illegal agentnum'; +my $agentnum = $1; +my $agent = FS::agent->by_key($agentnum); + +my $title = $agent->agent . ' commission'; + +my %query = ( 'table' => 'agent_pkg_class', + 'addl_from' => ' LEFT JOIN pkg_class USING (classnum)', + 'hashref' => { 'agentnum' => $agentnum }, + ); +my $count_query = "SELECT COUNT(*) FROM agent_pkg_class WHERE agentnum = $agentnum"; + +# cust_bill_pkg.cgi expects "classnum=0" for null classnum +my $sales_link = [ 'cust_bill_pkg.cgi?nottax=1;'. + "agentnum=$agentnum;" . + 'classnum=', + sub { shift->classnum || 0 }, + ]; + +my $commission_link = [ 'cust_credit.html?'. + "commission_agentnum=$agentnum;" . + 'classnum=', + 'classnum' + ]; + +</%init> |
