X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pkg.cgi;h=8b2fd0ca090e220a65c91181e0a7099d32f1c46a;hb=e283ab567e6890727e4d8e35c1d8097398678753;hp=78a5bb3bb1b9daf97c1da5e5b3178e81df64e1db;hpb=61e25db54f2da624a79ecedb6bf3d678c7fdefc5;p=freeside.git diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 78a5bb3bb..8b2fd0ca0 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -19,6 +19,8 @@ my @cust_pkg; if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $sortby=\*bill_sort; + + #false laziness with cust_pay.cgi my $range = ''; if ( $cgi->param('beginning') && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) { @@ -44,7 +46,19 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { } else { my $qual = ''; - if ( $query eq 'pkgnum' ) { + if ( $cgi->param('magic') && $cgi->param('magic') eq 'active' ) { + + $qual = 'WHERE ( susp IS NULL OR susp = 0 )'. + ' AND ( cancel IS NULL OR cancel = 0)'; + + $sortby = \*pkgnum_sort; + + if ( $cgi->param('pkgpart') =~ /^(\d+)$/ ) { + $qual .= " AND pkgpart = $1"; + } + + } elsif ( $query eq 'pkgnum' ) { + $sortby=\*pkgnum_sort; } elsif ( $query eq 'SUSP_pkgnum' ) { @@ -93,7 +107,7 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { AND cust_svc.svcpart = pkg_svc.svcpart AND cust_pkg.pkgpart = pkg_svc.pkgpart GROUP BY cust_svc.pkgnum,cust_svc.svcpart"; - $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; + my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; $sth->execute or die "Error executing \"$query\": ". $sth->errstr; @@ -194,6 +208,12 @@ if ( scalar(@cust_pkg) == 1 ) { Package Setup +END + + print 'Last
bill
' + if defined dbdef->table('cust_pkg')->column('last_bill'); + + print <Next
bill
Susp. Expire @@ -203,17 +223,10 @@ if ( scalar(@cust_pkg) == 1 ) { company END -if ( defined dbdef->table('cust_main')->column('ship_last') ) { - print <(service) name - company -END -} + print '(service) namecompany' + if defined dbdef->table('cust_main')->column('ship_last'); -print <Services - -END + print 'Services'; my $n1 = ''; my(%saw,$cust_pkg); @@ -244,6 +257,12 @@ END $cust_main ? $cust_main->first : '', $cust_main ? $cust_main->company : '', ); + + my $last_bill = $cust_pkg->getfield('last_bill') + ? time2str("%D", $cust_pkg->getfield('last_bill') ) + : '' + if defined dbdef->table('cust_pkg')->column('last_bill'); + my($ship_last, $ship_first, $ship_company); if ( defined dbdef->table('cust_main')->column('ship_last') ) { ($ship_last, $ship_first, $ship_company) = ( @@ -270,6 +289,12 @@ END print $n1, <$pkgnum - $pkg $setup +END + + print "$last_bill" + if defined dbdef->table('cust_pkg')->column('last_bill'); + + print <$bill $susp $expire