+<SCRIPT TYPE="text/javascript">
+
+function agent_changed(obj) {
+
+ if ( obj.value == '' ) { //breakdown, one color list per agent needed
+ document.getElementById('agent0-label').style.display = '';
+% for ( 1 .. $#agents ) {
+ document.getElementById('agent<% $_ %>-colors').style.display = '';
+% }
+ } else { //aggregate, only one color list needed
+ document.getElementById('agent0-label').style.display = 'none';
+% for ( 1 .. $#agents ) {
+ document.getElementById('agent<% $_ %>-colors').style.display = 'none';
+% }
+ }
+
+ enable_agent_totals(obj);
+}
+
+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 == '' ||
+ document.getElementById('class_agg_break_breakdown').checked ||
+ obj.form.use_setup.value == 1 ||
+ obj.form.use_usage.value == 1
+ )
+ );
+}
+
+function class_mode_changed() {
+ var options = document.getElementsByName('class_mode');
+ var mode;
+ for(var i=0; i < options.length; i++) {
+ if (options[i].checked) {
+ mode = options[i].value;
+ }
+ }
+
+ var div_pkg = document.getElementById('pkg_class');
+ var div_report = document.getElementById('report_class');
+ var span_exact = document.getElementById('exact_match');
+ if (mode == 'pkg') {
+ div_pkg.style.display = '';
+ div_report.style.display = 'none';
+ span_exact.style.display = 'none';
+ } else if (mode == 'report') {
+ div_pkg.style.display = 'none';
+ div_report.style.display = '';
+ span_exact.style.display = '';
+ }
+}
+window.onload = class_mode_changed;
+</SCRIPT>
+
+<& /elements/tr-select-agent.html,
+ 'field' => 'agentnum',
+ 'label' => 'Agent ',
+ 'disable_empty' => 0,
+ 'pre_options' => [ 'all' => 'all (aggregate)' ],
+ 'empty_label' => 'all (breakdown)',
+ 'onchange' => 'agent_changed',
+&>
+
+<& /elements/tr-select-cust_class.html,
+ 'field' => 'cust_classnum',
+ 'label' => 'Customer class',
+ 'multiple' => 1,
+&>
+
+<& /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'
+&>
+
+<TR>
+
+ <TD>
+ <INPUT TYPE="radio" NAME="class_mode" VALUE="pkg" onchange="class_mode_changed('pkg')" CHECKED>
+ <% emt('Package class') %>
+ <BR>
+ <INPUT TYPE="radio" NAME="class_mode" VALUE="report" onchange="class_mode_changed('report')">
+ <% emt('Report class') %>
+ </TD>
+
+ <TD>
+ <TABLE>
+ <TR>
+
+ <TD>
+ <DIV ID="pkg_class">
+ <& /elements/select-pkg_class.html,
+ 'field' => 'classnum',
+ 'multiple' => 1,
+ 'all_selected' => 1,
+ 'pre_options' => [ #'all' => 'all (aggregate)',
+ # '' => 'all (breakdown)',
+ '0' => '(empty class)' ],
+ 'disable_empty' => 1,
+ 'onchange' => 'enable_agent_totals',
+ &>
+ </DIV>
+ <DIV ID="report_class" STYLE="display: none">
+ <& /elements/select-table.html,
+ 'field' => 'report_optionnum',
+ 'table' => 'part_pkg_report_option',
+ 'name_col' => 'name',
+ 'value_col' => 'num',
+ 'multiple' => 1,
+ 'all_selected' => 1,
+ 'pre_options' => [ #'all' => 'all (aggregate)',
+ # '' => 'all (breakdown)',
+ '0' => '(empty class)' ],
+ 'disable_empty' => 1,
+ 'onchange' => 'enable_agent_totals',
+ &>
+ </DIV>
+ </TD>
+
+ <TD>
+ <INPUT TYPE="radio" NAME="class_agg_break" ID="class_agg_break_aggregate" VALUE="aggregate" onchange="enable_agent_totals(this)" CHECKED>
+ <% emt('Aggregate') %>
+ <BR>
+ <INPUT TYPE="radio" NAME="class_agg_break" ID="class_agg_break_breakdown" VALUE="breakdown" onchange="enable_agent_totals(this)">
+ <% emt('Breakdown') %>
+ <BR>
+ <SPAN ID="exact_match" style="display:none">
+ <INPUT TYPE="radio" NAME="class_agg_break" ID="class_agg_break_exact" VALUE="exact" onchange="enable_agent_totals(this)">
+ <% emt('Exact match') %>
+ </SPAN>
+ </TD>
+
+ </TR>
+ </TABLE>
+ </TD>
+
+</TR>
+
+<TR>
+ <TH CLASS="background" COLSPAN=2> </TH>
+</TR>
+
+<TR>
+ <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
+</TR>