- <TH>Package</TH>
- <TH>Status</TH>
- <TH COLSPAN=2>Services</TH>
-</TR>
-
-<%
-foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
- my $rowspan = 0;
-
- if ($pkg->{cancel}) {
- $rowspan = 0;
- } else {
- foreach my $svcpart (@{$pkg->{svcparts}}) {
- $rowspan += $svcpart->{count};
- $rowspan++ if ($svcpart->{count} < $svcpart->{quantity});
- }
- }
-%>
-
-<!--pkgnum: <%=$pkg->{pkgnum}%>-->
-<TR>
- <TD ROWSPAN=<%=$rowspan%>>
- <A NAME="cust_pkg<%=$pkg->{pkgnum}%>"><%=$pkg->{pkgnum}%></A>:
- <%=$pkg->{pkg}%> - <%=$pkg->{comment}%><BR>
-<% unless ($pkg->{cancel}) { %>
- ( <%=pkg_change_link($pkg)%> )
- ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> )
-<% } %>
- </TD>
-<%
- #foreach (qw(setup last_bill next_bill susp expire cancel)) {
- # print qq! <TD ROWSPAN=$rowspan>! . pkg_datestr($pkg,$_,$conf) . qq!</TD>\n!;
- #}
- print "<TD ROWSPAN=$rowspan>". &itable('');
-
- sub myfreq {
- my $part_pkg = shift;
- my $freq = $part_pkg->freq_pretty;
- $freq =~ s/ / /g;
- $freq;
- }
-
- if ( $pkg->{cancel} ) { #status: cancelled
-
- print '<TR><TD><FONT COLOR="#ff0000"><B>Cancelled </B></FONT></TD>'.
- '<TD>'. pkg_datestr($pkg,'cancel',$conf). '</TD></TR>';
- unless ( $pkg->{setup} ) {
- print '<TR><TD COLSPAN=2>Never billed</TD></TR>';
- } else {
- print "<TR><TD>Setup </TD><TD>".
- pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
- print "<TR><TD>Last bill </TD><TD>".
- pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
- if $pkg->{'last_bill'};
- print "<TR><TD>Suspended </TD><TD>".
- pkg_datestr($pkg, 'susp',$conf). '</TD></TR>'
- if $pkg->{'susp'};
- }
-
- } else {
-
- if ( $pkg->{susp} ) { #status: suspended
- print '<TR><TD><FONT COLOR="#FF9900"><B>Suspended</B> </FONT></TD>'.
- '<TD>'. pkg_datestr($pkg,'susp',$conf). '</TD></TR>';
- unless ( $pkg->{setup} ) {
- print '<TR><TD COLSPAN=2>Never billed</TD></TR>';
- } else {
- print "<TR><TD>Setup </TD><TD>".
- pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
- }
- print "<TR><TD>Last bill </TD><TD>".
- pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
- if $pkg->{'last_bill'};
- # next bill ??
- print "<TR><TD>Expires </TD><TD>".
- pkg_datestr($pkg, 'expire',$conf). '</TD></TR>'
- if $pkg->{'expire'};
- print '<TR><TD COLSPAN=2>( '. pkg_unsuspend_link($pkg).
- ' | '. pkg_cancel_link($pkg). ' )</TD></TR>';
-
- } else { #status: active
-
- unless ( $pkg->{setup} ) { #not setup
-
- print '<TR><TD COLSPAN=2>Not yet billed (';
- unless ( $pkg->{freq} ) {
- print 'one-time charge)</TD></TR>';
- print '<TR><TD COLSPAN=2>( '. pkg_cancel_link($pkg).
- ' )</TD</TR>';
- } else {
- print 'billed '. myfreq($pkg->{part_pkg}). ')</TD></TR>';
- }
-
- } else { #setup
-
- unless ( $pkg->{freq} ) {
- print "<TR><TD COLSPAN=2>One-time charge</TD></TR>".
- '<TR><TD>Billed </TD><TD>'.
- pkg_datestr($pkg,'setup',$conf). '</TD></TR>';
- } else {
- print '<TR><TD COLSPAN=2><FONT COLOR="#00CC00"><B>Active</B></FONT>'.
- ', billed '. myfreq($pkg->{part_pkg}). '</TD></TR>'.
- '<TR><TD>Setup </TD><TD>'.
- pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
- }
-
- }
-
- print "<TR><TD>Last bill </TD><TD>".
- pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
- if $pkg->{'last_bill'};
- print "<TR><TD>Next bill </TD><TD>".
- pkg_datestr($pkg, 'next_bill',$conf). '</TD></TR>'
- if $pkg->{'next_bill'};
- print "<TR><TD>Expires </TD><TD>".
- pkg_datestr($pkg, 'expire',$conf). '</TD></TR>'
- if $pkg->{'expire'};
- if ( $pkg->{freq} ) {
- print '<TR><TD COLSPAN=2>( '. pkg_suspend_link($pkg).
- ' | '. pkg_cancel_link($pkg). ' )</TD></TR>';
- }
-
- }
-
- }
-
- print "</TABLE></TD>\n";
-
- if ($rowspan == 0) { print qq!</TR>\n!; next; }
-
- my $cnt = 0;
- foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) {
- foreach my $service (@{$svcpart->{services}}) {
- print '<TR>' if ($cnt > 0);
-%>
- <TD><%=svc_link($svcpart,$service)%></TD>
- <TD><%=svc_label_link($svcpart,$service)%><BR>( <%=svc_unprovision_link($service)%> )</TD>