1 <& elements/monthly.html,
5 'graph_labels' => \@labels,
9 'agentnum' => $agentnum,
12 'bottom_total' => (scalar @items > 1 && !$indirect ? 1 : 0),
13 'bottom_link' => $bottom_link,
14 'link_fromparam' => 'signupdate_begin',
15 'link_toparam' => 'signupdate_end',
16 'chart_options' => { precision => 0 },
20 #XXX use a different ACL for package churn?
22 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
24 #false laziness w/money_time.cgi, cust_bill_pkg.cgi
25 my $title = 'Customer Signup',
28 my( $agentnum, $agent ) = ('', '');
29 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
31 $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
32 die "agentnum $agentnum not found!" unless $agent;
35 my $agentname = $agent ? $agent->agent.' ' : '';
36 $title = "$agentname $title" if $agentname;
38 my $link = $p.'search/cust_main.html?';
39 $link .= "agentnum=$agentnum;" if $agentnum;
41 my $bottom_link = $link;
45 if ( $cgi->param('refnum') eq 'all' ) {
49 elsif ( $cgi->param('refnum') =~ /^(\d*)$/ ) {
51 @referral = ( qsearchs('part_referral', { 'refnum' => $1 } ) );
52 die "refnum $1 not found!" unless @referral;
53 $title .= ' - '.$referral[0]->referral;
54 $bottom_link .= ";refnum=$1";
57 @referral = qsearch('part_referral', {});
58 $title .= ' by Advertising Source';
62 my $indirect = ($cgi->param('indirect') eq 'Y' ? 1 : 0);
64 my (@items, @labels, @colors, @params, @links);
67 my $hue_increment = 75;
70 foreach my $referral (@referral) {
71 my %params = ('refnum' => $referral->refnum) unless $all_referral;
73 push @items, 'signups';
74 push @labels, ( $all_referral ? 'Signups' : $referral->referral );
75 push @params, [ %params ];
76 push @links, $link . ($all_referral ? '' : "refnum=".$referral->refnum.';');
77 # rotate hue for each referral type
78 @signup_colors = Color::Scheme->new->from_hue($hue)->colors;
79 $hue += $hue_increment;
80 push @colors, $signup_colors[0];
82 push @items, 'signups';
83 push @labels, $all_referral ?
85 $referral->referral . ' referrals';
86 push @params, [ %params, 'indirect' => 1 ];
88 push @colors, $signup_colors[1];