diff options
author | ivan <ivan> | 2004-01-28 01:39:07 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-01-28 01:39:07 +0000 |
commit | bb6dfc07af5c7fee85f2c76ee22a833b41e13c36 (patch) | |
tree | 46d2cd7598f71355dcd4c07fc77cf2d4d6ec25c3 /httemplate/browse | |
parent | ff15db0f2fa18e67498d0097797b667a81b51f71 (diff) |
add service definition browse by number of active services
Diffstat (limited to 'httemplate/browse')
-rwxr-xr-x | httemplate/browse/part_svc.cgi | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 3fece2925..ef0de13cc 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) { <TR> <TH COLSPAN=<%= $cgi->param('showdisabled') ? 2 : 3 %>>Service</TH> <TH>Table</TH> +<% if ( $cgi->param('active') ) { %> + <TH><FONT SIZE=-1>Customer<BR>Services</FONT></TH> +<% } %> <TH>Export</TH> <TH>Field</TH> <TH COLSPAN=2>Modifier</TH> @@ -75,6 +92,11 @@ function part_export_areyousure(href) { <%= $hashref->{svc} %></A></TD> <TD ROWSPAN=<%= $rowspan %>> <%= $hashref->{svcdb} %></TD> +<% if ( $cgi->param('active') ) { %> + <TD ROWSPAN=<%= $rowspan %>> + <FONT COLOR="#00CC00"><B><%= $num_active_cust_svc{$hashref->{svcpart}} %></B></FONT> <A HREF="<%=$p%>search/<%= $hashref->{svcdb} %>.cgi?svcpart=<%= $hashref->{svcpart} %>">active</A> + </TD> +<% } %> <TD ROWSPAN=<%= $rowspan %>><%= itable() %> <% # my @part_export = |