From: ivan Date: Wed, 28 Jan 2004 01:39:10 +0000 (+0000) Subject: add service definition browse by number of active services X-Git-Tag: freeside_1_4_2beta1~284 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=db210c00141ef9cef0b0a5802f800abee54b5748;p=freeside.git add service definition browse by number of active services --- diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 7c83924a2..fd9ef3cf3 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -13,6 +13,20 @@ my @part_svc = qsearch('part_svc', \%search ); my $total = scalar(@part_svc); +my %num_active_cust_svc = (); +if ( $cgi->param('active') ) { + my $active_sth = dbh->prepare( + 'SELECT COUNT(*) FROM cust_svc WHERE svcpart = ?' + ) or die dbh->errstr; + foreach my $part_svc ( @part_svc ) { + $active_sth->execute($part_svc->svcpart) or die $active_sth->errstr; + $num_active_cust_svc{$part_svc->svcpart} = + $active_sth->fetchrow_arrayref->[0]; + } + @part_svc = sort { $num_active_cust_svc{$b->svcpart} <=> + $num_active_cust_svc{$a->svcpart} } @part_svc; +} + %> <%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %> @@ -45,6 +59,9 @@ function part_export_areyousure(href) { param('showdisabled') ? 2 : 3 %>>Service Table +<% if ( $cgi->param('active') ) { %> + Customer
Services
+<% } %> Export Field Modifier @@ -74,6 +91,11 @@ function part_export_areyousure(href) { <%= $hashref->{svc} %> > <%= $hashref->{svcdb} %> +<% if ( $cgi->param('active') ) { %> + > + <%= $num_active_cust_svc{$hashref->{svcpart}} %> active + +<% } %> ><%= itable() %> <% # my @part_export = diff --git a/httemplate/index.html b/httemplate/index.html index d101bc228..44c81dd80 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -128,6 +128,7 @@
  • packages (by next bill date range) Package definitions (by number of active packages)

    + Service definitions (by number of active services)

    Customers