-<% include('/elements/tr-select-agent.html',
- 'label' => 'Agent ',
- 'disable_empty' => 0,
- 'pre_options' => [ 'all' => 'all (aggregate)' ],
- 'empty_label' => 'all (breakdown)',
- )
-%>
-
-<% include('/elements/tr-select-part_referral.html',
- 'label' => 'Advertising source ',
- 'disable_empty' => 0,
- 'pre_options' => [ 'all' => 'all (aggregate)' ],
- 'empty_label' => 'all (breakdown)',
- )
-%>
-
-<% include('/elements/tr-select-pkg_class.html',
- 'pre_options' => [ 'all' => 'all (aggregate)',
- '0' => 'all (breakdown)' ],
- 'empty_label' => '(empty class)',
- )
-%>
+<SCRIPT TYPE="text/javascript">
+function enable_agent_totals(obj) {
+%# enable it iff we are breaking down by agent AND something else
+ obj.form.agent_totals.disabled = !(
+ obj.form.agentnum.value == '' && (
+ obj.form.refnum.value == '' ||
+ obj.form.classnum.value == 0 ||
+ obj.form.use_setup.value == 1 ||
+ obj.form.use_usage.value == 1
+ )
+ );
+}
+</SCRIPT>
+
+<& /elements/tr-select-agent.html,
+ 'field' => 'agentnum',
+ 'label' => 'Agent ',
+ 'disable_empty' => 0,
+ 'pre_options' => [ 'all' => 'all (aggregate)' ],
+ 'empty_label' => 'all (breakdown)',
+ 'onchange' => 'enable_agent_totals',
+&>
+
+<& /elements/tr-select-part_referral.html,
+ 'field' => 'refnum',
+ 'label' => 'Advertising source ',
+ 'disable_empty' => 0,
+ 'pre_options' => [ 'all' => 'all (aggregate)' ],
+ 'empty_label' => 'all (breakdown)',
+ 'onchange' => 'enable_agent_totals'
+&>
+
+<& /elements/tr-select-pkg_class.html,
+ 'field' => 'classnum',
+ 'pre_options' => [ 'all' => 'all (aggregate)',
+ '0' => 'all (breakdown)' ],
+ 'empty_label' => '(empty class)',
+ 'onchange' => 'enable_agent_totals',
+&>