+% if ( $cust_pkg->num_cust_event
+% && ( $curuser->access_right('Billing event reports')
+% || $curuser->access_right('View customer billing events')
+% )
+% ) {
+ ( <%pkg_event_link($cust_pkg)%> )
+% }
+
+ </FONT>
+
+ </TD>
+
+ <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
+ <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
+%
+% sub myfreq {
+% my $part_pkg = shift;
+% my $freq = $part_pkg->freq_pretty;
+% $freq =~ s/ / /g;
+% $freq;
+% }
+%
+% #this should use cust_pkg->status and cust_pkg->statuscolor eventually
+%
+% my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4;
+% my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%';
+%
+% #false laziness w/edit/REAL_cust_pkg.cgi
+% my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until );
+% unless ( $part_pkg->is_prepaid ) {
+% $billed_or_prepaid = 'billed';
+% $last_bill_or_renewed = 'Last bill';
+% $next_bill_or_prepaid_until = 'Next bill';
+% } else {
+% $billed_or_prepaid = 'prepaid';
+% $last_bill_or_renewed = 'Renewed';
+% $next_bill_or_prepaid_until = 'Prepaid until';
+% }
+%
+%
+% if ( $cust_pkg->get('cancel') ) {
+ <!-- #status: cancelled -->
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right"><FONT COLOR="#ff0000"><B>Cancelled </B></FONT></TD>
+ <% pkg_datestr($cust_pkg, 'cancel', $conf) %>
+ </TR>
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right"><FONT COLOR="#ff0000" SIZE="-2">
+ <% $cust_pkg->last_reason ? $cust_pkg->last_reason->reason : '' %>
+ </FONT></TD>
+ </TR>
+% unless ( $cust_pkg->get('setup') ) {
+
+
+ <TR>
+ <TD COLSPAN=<%$colspan%>>Never billed</TD>
+ </TR>
+% } else {
+
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right">Setup </TD>
+ <% pkg_datestr($cust_pkg, 'setup', $conf) %>
+ </TR>
+% if ( $cust_pkg->get('last_bill') ) {
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right"><% $last_bill_or_renewed %> </TD>
+ <% pkg_datestr($cust_pkg, 'last_bill',$conf) %>
+ </TR>
+% }
+% if ( $cust_pkg->get('susp') ) {
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right">Suspended </TD>
+ <% pkg_datestr($cust_pkg, 'susp', $conf) %>
+ </TR>
+% }
+% }
+% } else {
+% if ( $cust_pkg->get('susp') ) {
+ <!-- #status: suspended -->
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right"><FONT COLOR="#FF9900"><B>Suspended</B> </FONT></TD>
+ <% pkg_datestr($cust_pkg, 'susp', $conf) %>
+ </TR>
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right"><FONT COLOR="#FF9900" SIZE="-2">
+ <% $cust_pkg->last_reason ? $cust_pkg->last_reason->reason : '' %>
+ </FONT></TD>
+ </TR>
+% unless ( $cust_pkg->get('setup') ) {
+
+
+ <TR>
+ <TD COLSPAN=<%$colspan%>>Never billed</TD>
+ </TR>
+% } else {
+
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right">Setup </TD>
+ <% pkg_datestr($cust_pkg, 'setup', $conf) %>
+ </TR>
+% }
+% if ( $cust_pkg->get('last_bill') ) {
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right"><% $last_bill_or_renewed %> </TD>
+ <% pkg_datestr($cust_pkg, 'last_bill', $conf) %>
+ </TR>
+% }
+
+
+ <!-- # next bill ?? -->
+% if ( $cust_pkg->get('expire') ) {
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right">Expires </TD>
+ <% pkg_datestr($cust_pkg, 'expire', $conf) %>
+ </TR>
+% }
+
+
+ <TR>
+ <TD COLSPAN=<%$colspan%>>
+ <FONT SIZE=-1>
+% if ( $curuser->access_right('Unsuspend customer package') ) {
+
+ ( <% pkg_unsuspend_link($cust_pkg) %> )
+% }
+% if ( $curuser->access_right('Cancel customer package immediately') ) {
+
+ ( <% pkg_cancel_link($cust_pkg) %> )
+% }
+
+ </FONT>
+ </TD>
+ </TR>
+% } else {
+ <!-- #status: active -->
+% unless ( $cust_pkg->get('setup') ) {
+ <!-- #not setup -->
+% unless ( $part_pkg->freq ) {
+
+
+ <TR>
+ <TD COLSPAN=<%$colspan%>>Not yet billed (one-time charge)</TD>
+ </TR>
+
+ <TR>
+ <TD COLSPAN=<%$colspan%>>
+ <FONT SIZE=-1>
+% if ( $curuser->access_right('Cancel customer package immediately') ) {
+
+ ( <% pkg_cancel_link($cust_pkg) %> )
+% }
+
+ </FONT>
+ </TD>
+ </TR>
+% } else {
+
+
+ <TR>
+ <TD COLSPAN=<%$colspan%>>Not yet billed (<% $billed_or_prepaid %> <% myfreq($part_pkg) %>)</TD>
+ </TR>
+% }
+% } else {
+ <!-- #setup -->
+% unless ( $part_pkg->freq ) {
+
+
+ <TR>
+ <TD COLSPAN=<%$colspan%>>One-time charge</TD>
+ </TR>
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right">Billed </TD>
+ <% pkg_datestr($cust_pkg, 'setup', $conf) %>
+ </TR>
+% } else {
+% if (scalar($cust_pkg->overlimit)) {
+ <TR>
+ <TD COLSPAN=<%$colspan%>><FONT COLOR="#FFD000"><B>Overlimit</B></FONT>, <% $billed_or_prepaid %> <% myfreq($part_pkg) %></TD>
+ </TR>
+%}else{
+ <TR>
+ <TD COLSPAN=<%$colspan%>><FONT COLOR="#00CC00"><B>Active</B></FONT>, <% $billed_or_prepaid %> <% myfreq($part_pkg) %></TD>
+ </TR>
+% }
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right">Setup </TD>
+ <% pkg_datestr($cust_pkg, 'setup', $conf) %>
+ </TR>
+% }
+% }
+% if ( $cust_pkg->get('last_bill') ) {
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right"><% $last_bill_or_renewed %> </TD>
+ <% pkg_datestr($cust_pkg, 'last_bill', $conf) %>
+ </TR>
+% }
+% if ( $cust_pkg->get('bill') ) { #next bill
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right"><% $next_bill_or_prepaid_until %> </TD>
+ <% pkg_datestr($cust_pkg, 'bill', $conf) %>
+ </TR>
+% }
+% if ( $cust_pkg->get('adjourn') ) {
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right">Adjourns </TD>
+ <% pkg_datestr($cust_pkg, 'adjourn', $conf) %>
+ </TR>
+% }
+% if ( $cust_pkg->get('expire') ) {
+
+ <TR>
+ <TD WIDTH="<%$width%>" ALIGN="right">Expires </TD>
+ <% pkg_datestr($cust_pkg, 'expire', $conf) %>
+ </TR>
+% }
+% if ( $part_pkg->freq ) {
+
+ <TR>
+ <TD COLSPAN=<%$colspan%>>
+ <FONT SIZE=-1>
+% if ( $curuser->access_right('Suspend customer package') ) {
+
+ ( <% pkg_suspend_link($cust_pkg) %> )
+% }
+% if ( $curuser->access_right('Suspend customer package later') ) {
+
+ ( <% pkg_adjourn_link($cust_pkg) %> )
+% }
+% if ( $curuser->access_right('Cancel customer package immediately') ) {
+
+ ( <% pkg_cancel_link($cust_pkg) %> )
+% }
+% if ( $curuser->access_right('Cancel customer package later') ) {
+
+ ( <% pkg_expire_link($cust_pkg) %> )
+% }
+
+ <FONT>
+ </TD>
+ </TR>
+% }
+% }
+% }
+
+
+</TABLE>
+</TD>
+
+<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
+ <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
+
+% #foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) {
+% foreach my $part_svc ( $cust_pkg->part_svc ) {
+
+% #foreach my $service (@{$svcpart->{services}}) {
+% foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) {
+
+ <TR>
+ <TD ALIGN="right" VALIGN="top"><% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %></TD>
+ <TD STYLE="padding-bottom:0px"><B><% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %></B></TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN="right" COLSPAN="2" VALIGN="top" STYLE="padding-bottom:1px;padding-top:0px"><FONT SIZE="-2" COLOR="#FFD000">
+
+ <% $cust_svc->overlimit ? "Overlimit: ". time2str('%b %o %Y' . ($conf->exists('cust_pkg-display_times') ? ' %l:%M %P' : ''), $cust_svc->overlimit) : '' %>
+ </FONT></TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px;padding-top:0px"><FONT SIZE="-2">
+
+% if ( $curuser->access_right('Recharge customer service')
+% && $part_svc->svcdb eq 'svc_acct'
+% && ( $cust_svc->svc_x->seconds ne ''
+% || $cust_svc->svc_x->upbytes ne ''
+% || $cust_svc->svc_x->downbytes ne ''
+% || $cust_svc->svc_x->totalbytes ne ''
+% )
+% ) {
+ ( <%svc_recharge_link($cust_svc)%> )
+% }
+ </FONT></TD>
+
+ <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px;padding-top:0px"><FONT SIZE="-2">
+
+% if ( $curuser->access_right('Unprovision customer service') ) {
+ ( <%svc_unprovision_link($cust_svc)%> )
+% }
+ </FONT></TD>
+ </TR>
+% }
+
+% if ( ! $cust_pkg->get('cancel')
+% && $curuser->access_right('Provision customer service')
+% && $part_svc->num_avail
+% ) {
+
+ <TR>
+ <TD COLSPAN=2 ALIGN="center" STYLE="padding-bottom:4px;padding-top:0px">
+ <B><% svc_provision_link($cust_pkg, $part_svc, $conf, $curuser) %></B>
+ </TD>
+ </TR>
+
+% }
+
+% }
+
+</TABLE>
+</TD>
+% } #end display packages
+%
+
+
+</TABLE>
+% } else {
+
+<BR>
+% }
+% if ( $cgi->param('fragment') =~ /^cust_pkg(\d+)$/ ) {
+ <SCRIPT>
+ // IE-specific hack. other browsers listen to #fragments
+ // is this even working? or is the #target redirection just working cause
+ // we set the URL params differently?
+ var el = document.getElementById( 'cust_pkg<% $1 %>' );
+ if ( el ) el.scrollIntoView(true);
+ </SCRIPT>
+% }
+<%init>
+
+my( $cust_main ) = @_;
+my $conf = new FS::Conf;