+ 'charges' => $component,
+ );
+
+ my $row_link = "$link;".
+ "charges=$component;".
+ "distribute=$distribute;";
+
+ if ( $component eq 'D' ) {
+ # discounts ignore 'charges' and 'distribute'
+ $row_link = "${p}search/cust_bill_pkg_discount.html?";
+ } elsif ( $component eq 'T' ) {
+ $row_link = "${p}search/cust_bill_pkg.cgi?istax=1;";
+ }
+
+ $row_link .= ($all_agent ? '' : "agentnum=$row_agentnum;").
+ ($all_part_referral ? '' : "refnum=$row_refnum;").
+ (join('',map {"cust_classnum=$_;"} @cust_classnums)).
+ "use_override=$use_override;";
+ $row_link .= "$class_param=$_;" foreach @classnums;
+ if ( $all_report_options ) {
+ push @row_params, 'all_report_options', 1;
+ $row_link .= 'all_report_options=1';
+ }
+ push @params, \@row_params;
+ push @links, $row_link;
+
+ @colorbuf = @agent_colors unless @colorbuf;
+ push @colors, shift @colorbuf;
+ push @no_graph, 0;
+
+ } #foreach $component
+
+ } elsif ( $cgi->param('class_agg_break') eq 'breakdown' ) {
+
+ for (my $i = 0; $i < scalar @classnums; $i++) {
+ my $row_classnum = $classnums[$i];
+ my $row_classname = $classnames[$i];
+ my $not_row_classnum = '';
+ if ( $class_param eq 'report_optionnum' ) {
+ # if we're working with report options, @classnums here contains
+ # arrays of multiple classnums
+ $row_classnum = join(',', @$row_classnum);
+ $row_classname = join(', ', @$row_classname);
+ $not_row_classnum = join(',', @{ $not_classnums[$i] });
+ }
+ foreach my $component ( @components ) {
+
+ push @items, 'cust_bill_pkg';
+
+ push @labels,
+ ( $all_agent || $sel_agent ? '' : $agent->agent.' ' ).
+ ( $all_part_referral || $sel_part_referral ? '' : $part_referral->referral.' ' ).
+ $row_classname . ' ' . $charge_labels{$component};
+
+ my $row_agentnum = $all_agent || $agent->agentnum;
+ my $row_refnum = $all_part_referral || $part_referral->refnum;
+ my @row_params = (
+ @base_params,
+ $class_param => $row_classnum,
+ ($all_agent ? () : ('agentnum' => $row_agentnum) ),
+ ($all_part_referral ? () : ('refnum' => $row_refnum)),
+ 'charges' => $component,
+ );
+
+ my $row_link = "$link;".
+ "charges=$component;".
+ "distribute=$distribute;";
+
+ if ( $component eq 'D' ) {
+ # discounts ignore 'charges' and 'distribute'
+ $row_link ="${p}search/cust_bill_pkg_discount.html?";
+ } elsif ( $component eq 'T' ) {
+ $row_link = "${p}search/cust_bill_pkg.cgi?istax=1;";
+ }
+
+ $row_link .= ($all_agent ? '' : "agentnum=$row_agentnum;").
+ ($all_part_referral ? '' : "refnum=$row_refnum;").
+ (join('',map {"cust_classnum=$_;"} @cust_classnums)).
+ "$class_param=$row_classnum;".
+ "use_override=$use_override;";
+
+ if ( $class_param eq 'report_optionnum' ) {
+ push @row_params,
+ 'all_report_options' => 1,
+ 'not_report_optionnum' => $not_row_classnum,
+ ;
+ $row_link .= "all_report_options=1;".
+ "not_report_optionnum=$not_row_classnum;";
+ }
+ push @params, \@row_params;
+ push @links, $row_link;
+
+ @colorbuf = @agent_colors unless @colorbuf;
+ push @colors, shift @colorbuf;
+ push @no_graph, 0;
+
+ } #foreach $component
+ } #foreach $row_classnum
+
+ } #$cgi->param('class_agg_break')
+
+ } #foreach $part_referral
+
+ if ( $cgi->param('agent_totals') and !$all_agent ) {
+ my $row_agentnum = $agent->agentnum;
+ # Include all components that are anywhere on this report
+ my $component = join('', @components);
+
+ my @row_params = ( 'agentnum' => $row_agentnum,
+ 'cust_classnum' => \@cust_classnums,
+ 'use_override' => $use_override,
+ 'average_per_cust_pkg' => $average_per_cust_pkg,
+ 'distribute' => $distribute,
+ 'charges' => $component,
+ );
+ my $row_link = "$link;".
+ "agentnum=$row_agentnum;".
+ "distribute=$distribute;".
+ "charges=$component;";
+
+ # package class filters
+ if ( $cgi->param('class_agg_break') eq 'aggregate' ) {
+ push @row_params, $class_param => \@classnums;
+ $row_link .= "$class_param=$_;" foreach @classnums;
+ }