X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_referral.html;h=27eb5454266f2d5c110a5c124f8187a7bf27dcac;hp=9cc32c4594a8b131a5f4136ff291feea447172c5;hb=ac8410cdb67639afeb84c84e975fffadf3e6cce1;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984 diff --git a/httemplate/browse/part_referral.html b/httemplate/browse/part_referral.html index 9cc32c459..27eb54542 100755 --- a/httemplate/browse/part_referral.html +++ b/httemplate/browse/part_referral.html @@ -1,4 +1,4 @@ -<% include("/elements/header.html","Advertising source Listing" ) %> +<& /elements/header.html, "Advertising source Listing" &> Where a customer heard about your service. Tracked for informational purposes.

@@ -6,19 +6,34 @@ Where a customer heard about your service. Tracked for informational purposes. Add a new advertising source

-<% include('/elements/table-grid.html') %> +<% $cgi->param('showdisabled') + ? do { $cgi->param('showdisabled', 0); + '( hide disabled advertising sources )'; } + : do { $cgi->param('showdisabled', 1); + '( show disabled advertising sources )'; } +%> + +% ### +% # Header +% ### + +<& /elements/table-grid.html &> % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; Advertising source -% if ( $show_agentnums ) { +% if ( ! $cgi->param('showdisabled') ) { + +% } + +% if ( $show_agentnums ) { Agent % } - >Customers and Packages + >Prospects, Customers and Packages % for my $period ( keys %after ) { @@ -27,7 +42,11 @@ Where a customer heard about your service. Tracked for informational purposes. -%foreach my $part_referral ( FS::part_referral->all_part_referral(1) ) { +% ### +% # Rows +% ### + +%foreach my $part_referral ( FS::part_referral->all_part_referral(1,!scalar($cgi->param('showdisabled'))) ) { % % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; @@ -55,6 +74,16 @@ Where a customer heard about your service. Tracked for informational purposes. % } <% $part_referral->referral %><% $a ? '' : '' %> + +% if ( ! $cgi->param('showdisabled') ) { + + <% $part_referral->disabled + ? 'DISABLED' + : 'Active' + %> + +% } + % if ( $show_agentnums ) { <% $part_referral->agentnum ? $part_referral->agent->agent : '(global)' %> @@ -64,6 +93,8 @@ Where a customer heard about your service. Tracked for informational purposes. % $today-$after{$period}, % $today+$before{$period}, % ); +% $prospect_sth->execute(@param) or die $prospect_sth->errstr; +% my $num_prospect = $prospect_sth->fetchrow_arrayref->[0]; % $cust_sth->execute(@param) or die $cust_sth->errstr; % my $num_cust = $cust_sth->fetchrow_arrayref->[0]; % $pkg_sth->execute(@param) or die $pkg_sth->errstr; @@ -72,12 +103,16 @@ Where a customer heard about your service. Tracked for informational purposes. + + + + - + - +
<% $num_prospect %> prospects 
<% $num_cust %>customers customers 
<% $num_pkg %>packages packages 
@@ -85,20 +120,32 @@ Where a customer heard about your service. Tracked for informational purposes. % } + + +% ### +% # Bottom Totals +% ### + +% $prospect_statement =~ s/AND refnum = \?//; +% $prospect_sth = dbh->prepare($prospect_statement) +% or die dbh->errstr; % % $cust_statement =~ s/AND refnum = \?//; % $cust_sth = dbh->prepare($cust_statement) % or die dbh->errstr; +% % $pkg_statement =~ s/AND h_pkg_referral\.refnum = \?//; % $pkg_sth = dbh->prepare($pkg_statement) % or die dbh->errstr; - Total + param('showdisabled') %>Total % for my $period ( keys %after ) { % my @param = ( $today-$after{$period}, % $today+$before{$period}, % ); +% $prospect_sth->execute(@param) or die $prospect_sth->errstr; +% my $num_prospect = $prospect_sth->fetchrow_arrayref->[0]; % $cust_sth->execute( @param ) or die $cust_sth->errstr; % my $num_cust = $cust_sth->fetchrow_arrayref->[0]; % $pkg_sth->execute(@param) or die $pkg_sth->errstr; @@ -107,12 +154,16 @@ Where a customer heard about your service. Tracked for informational purposes. + + + + - + - +
<% $num_prospect %> prospects 
<% $num_cust %>customers customers 
<% $num_pkg %>packages packages 
@@ -121,8 +172,8 @@ Where a customer heard about your service. Tracked for informational purposes. - - + +<& /elements/footer.html &> <%init> die "access denied" @@ -158,6 +209,15 @@ my $curuser = $FS::CurrentUser::CurrentUser; my $show_agentnums = ( scalar($curuser->agentnums) > 1 ); +my $prospect_statement = "SELECT COUNT(*) FROM h_prospect_main + WHERE history_action = 'insert' + AND refnum = ? + AND history_date >= ? + AND history_date < ? + AND ". $curuser->agentnums_sql; +my $prospect_sth = dbh->prepare($prospect_statement) + or die dbh->errstr; + my $cust_statement = "SELECT COUNT(*) FROM h_cust_main WHERE history_action = 'insert' AND refnum = ?