X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=180f18263c6e793a3bcfa6a5f1ad1bcce286d473;hp=2a167e8d6eb057263ec647003dd4193c053114e8;hb=a800fde5d31fb9b9cfe46b1ce2f68ea8e56bff53;hpb=117a674a7e37ff2f4f90fcf34710dfad288ac8a9 diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 2a167e8d6..180f18263 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -12,7 +12,8 @@ my @part_pkg = qsearch('part_pkg', \%search ); my $total = scalar(@part_pkg); my $sortby; -my %num_active_cust_pkg; +my %num_active_cust_pkg = (); +my( $suspended_sth, $canceled_sth ) = ( '', '' ); if ( $cgi->param('active') ) { my $active_sth = dbh->prepare( 'SELECT COUNT(*) FROM cust_pkg WHERE pkgpart = ?'. @@ -27,6 +28,18 @@ if ( $cgi->param('active') ) { $sortby = sub { $num_active_cust_pkg{$b->pkgpart} <=> $num_active_cust_pkg{$a->pkgpart}; }; + + $suspended_sth = dbh->prepare( + 'SELECT COUNT(*) FROM cust_pkg WHERE pkgpart = ?'. + ' AND ( cancel IS NULL OR cancel = 0 )'. + ' AND susp IS NOT NULL AND susp != 0' + ) or die dbh->errstr; + + $canceled_sth = dbh->prepare( + 'SELECT COUNT(*) FROM cust_pkg WHERE pkgpart = ?'. + ' AND cancel IS NOT NULL AND cancel != 0' + ) or die dbh->errstr; + } else { $sortby = \*pkgpart_sort; } @@ -65,8 +78,10 @@ print <Data Service Quan. - END +print 'Primary' + if dbdef->table('pkg_svc')->column('primary_svc'); +print ''; foreach my $part_pkg ( sort $sortby @part_pkg ) { my($hashref)=$part_pkg->hashref; @@ -102,8 +117,19 @@ END print " "; print ''. $num_active_cust_pkg{$hashref->{'pkgpart'}}. - qq! active!; - # suspended/cancelled + qq! active
!; + + $suspended_sth->execute( $part_pkg->pkgpart ) or die $suspended_sth->errstr; + my $num_suspended = $suspended_sth->fetchrow_arrayref->[0]; + print ''. $num_suspended. + qq! suspended
!; + + $canceled_sth->execute( $part_pkg->pkgpart ) or die $canceled_sth->errstr; + my $num_canceled = $canceled_sth->fetchrow_arrayref->[0]; + print ''. $num_canceled. + qq! canceled!; + + print ''; } print < $svcpart }); print $n,qq!!, $part_svc->getfield('svc'),"", - $pkg_svc->getfield('quantity'),"\n"; + $pkg_svc->getfield('quantity'),""; + if ( dbdef->table('pkg_svc')->column('primary_svc') ) { + print ''; + print 'PRIMARY' if $pkg_svc->primary_svc =~ /^Y/i; + print ''; + } + print "\n"; $n=""; }