<%= sub ws_pkglink { my($cat,$count,$link) = (shift,shift,shift); return "0 $cat
" unless $count->{$cat}; return qq! $count->{$cat} $cat
!; } sub ws_pkgstatus { my $pkg = shift; $status = "unbilled"; $status = "active" if ( $pkg->{setup} && !$pkg->{cancel} && !$pkg->{susp} ); $status = "suspended" if ( $pkg->{susp} && !$pkg->{cancel} ); $status = "cancelled" if $pkg->{cancel}; $status; } sub pdate { my($field,$date_format) = (shift,shift); return "".Date::Format::time2str($date_format,$field)."" if $field > 0; ''; } if ( $pkgpart ) { $OUT .= qq! !; $OUT .= ""; $OUT .= ""; $OUT .= ""; foreach my $pkg ( @cust_pkg ) { my $part_pkg = $pkg->{part_pkg}[0]; $status = ws_pkgstatus($pkg); if($pkg->{pkgpart} == $pkgpart && ($filter eq $status || !$filter) ) { $OUT .= ""; $OUT .= pdate($pkg->{setup},$date_format); $OUT .= pdate($pkg->{last_bill},$date_format); $OUT .= pdate($pkg->{bill},$date_format); $OUT .= pdate($pkg->{adjourn},$date_format); $OUT .= pdate($pkg->{susp},$date_format); $OUT .= pdate($pkg->{expire},$date_format); $OUT .= pdate($pkg->{contract_end},$date_format); $OUT .= pdate($pkg->{cancel},$date_format); $OUT .= ""; } } $OUT .= "
PackageStatusSetupLast BillNext BillAdjournSuspendExpireContract EndCancel
$part_pkg->{pkg}$status
"; } else { my %pkgparts; foreach my $pkg ( @cust_pkg ) { my $status = ws_pkgstatus($pkg); $pkgparts{$pkg->{pkgpart}}{$status}++; my $part_pkg = $pkg->{part_pkg}[0]; $pkgparts{$pkg->{pkgpart}}{pkg} = $part_pkg->{pkg}; } $OUT .= qq! !; my($pkgpart,$counts); while(($pkgpart,$count) = each %pkgparts){ my $link = "${url}provision;pkgpart=$pkgpart"; $OUT .= qq! "; } $OUT .= "
PackageStatus
$count->{pkg} !; $OUT .= ws_pkglink("unbilled",$count,$link); $OUT .= ws_pkglink("active",$count,$link); $OUT .= ws_pkglink("suspended",$count,$link); $OUT .= ws_pkglink("cancelled",$count,$link); $OUT .= "
"; } %>