<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
-<% include( '/elements/tr-select-agent.html' ) %>
+% if ( $curuser->report_salesnum ) {
-<% include( '/elements/tr-select-sales.html' ) %>
+ <INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $curuser->report_sales->agentnum %>">
+ <INPUT TYPE="hidden" NAME="salesnum" VALUE="<% $curuser->report_salesnum %>">
-<% include( '/elements/tr-input-beginning_ending.html', ) %>
+% } else {
+
+ <& /elements/tr-select-agent.html,
+ 'onchange' => 'agent_changed(this)',
+ &>
+
+ <SCRIPT TYPE="text/javascript">
+
+ function agent_changed(what) {
+ salesnum_agentnum_changed(what);
+ }
+
+ <&| /elements/onload.js &>
+ agent_changed(document.getElementById('agentnum'))
+ </&>
+
+ </SCRIPT>
+
+ <& /elements/tr-select-sales.html,
+ 'empty_label' => 'all',
+ &>
+
+% }
+
+<& /elements/tr-checkbox.html,
+ 'label' => 'Customer sales person if there is no package sales person',
+ 'field' => 'cust_main_sales',
+ 'value' => 'Y',
+&>
+
+<& /elements/tr-checkbox.html,
+ 'label' => 'Show paid sales only',
+ 'field' => 'paid',
+ 'value' => 'Y',
+&>
+
+<& /elements/tr-input-beginning_ending.html &>
</TABLE>
<% include('/elements/footer.html') %>
<%init>
-die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied" unless $curuser->access_right('Financial reports');
</%init>