suspension and cancellation reasons
[freeside.git] / httemplate / browse / part_bill_event.cgi
1
2 %my %search;
3 %if ( $cgi->param('showdisabled') ) {
4 %  %search = ();
5 %} else {
6 %  %search = ( 'disabled' => '' );
7 %}
8 %
9 %my @part_bill_event = qsearch('part_bill_event', \%search );
10 %my $total = scalar(@part_bill_event);
11 %
12
13
14 <% include("/elements/header.html",'Invoice Event Listing', menubar( 'Main Menu' => $p) ) %>
15
16     Invoice events are actions taken on open invoices.<BR><BR>
17
18 <A HREF="<% $p %>edit/part_bill_event.cgi"><I>Add a new invoice event</I></A>
19 <BR><BR>
20
21 <% $total %> events
22 <% $cgi->param('showdisabled')
23       ? do { $cgi->param('showdisabled', 0);
24              '( <a href="'. $cgi->self_url. '">hide disabled events</a> )'; }
25       : do { $cgi->param('showdisabled', 1);
26              '( <a href="'. $cgi->self_url. '">show disabled events</a> )'; }
27 %>
28 <BR><BR>
29 % tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname;
30 %   tie my %freq, 'Tie::IxHash', '1d' => 'daily', '1m' => 'monthly';
31 %   foreach my $payby ( keys %payby ) {
32 %     my $oldfreq = '';
33 %
34 %     my @payby_part_bill_event =
35 %       grep { $payby eq $_->payby }
36 %       sort {    ( $a->freq || '1d') cmp ( $b->freq || '1d' ) # for now
37 %              ||   $a->seconds       <=>   $b->seconds
38 %              ||   $a->weight        <=>   $b->weight
39 %              ||   $a->eventpart     <=>   $b->eventpart
40 %            }
41 %       @part_bill_event;
42 %
43 %
44 % if ( @payby_part_bill_event ) { 
45
46
47     <% include('/elements/table-grid.html') %>
48 % my $bgcolor1 = '#eeeeee';
49 %       my $bgcolor2 = '#ffffff';
50 %       my $bgcolor;
51 %    
52 %
53 %       foreach my $part_bill_event ( @payby_part_bill_event ) {
54 %         my $url = "${p}edit/part_bill_event.cgi?". $part_bill_event->eventpart;
55 %         my $delay = duration_exact($part_bill_event->seconds);
56 %         ( my $plandata = $part_bill_event->plandata ) =~ s/\n/<BR>/go;
57 %         my $freq = $part_bill_event->freq || '1d';
58 %         my $reason = $part_bill_event->reasontext ;
59 %    
60 % if ( $oldfreq ne $freq ) { 
61
62   
63         <TR>
64           <TH CLASS="grid" BGCOLOR="#999999" COLSPAN=<% $cgi->param('showdisabled') ? 7 : 8 %>><% ucfirst($freq{$freq}) %> event tests for <FONT SIZE="+1"><I><% $payby{$payby} %> customers</I></FONT></TH>
65         </TR>
66       
67         <TR>
68           <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<% $cgi->param('showdisabled') ? 2 : 3 %>>Event</TH>
69           <TH CLASS="grid" BGCOLOR="#cccccc">After</TH>
70           <TH CLASS="grid" BGCOLOR="#cccccc">Action</TH>
71           <TH CLASS="grid" BGCOLOR="#cccccc">Reason</TH>
72           <TH CLASS="grid" BGCOLOR="#cccccc">Options</TH>
73           <TH CLASS="grid" BGCOLOR="#cccccc">Code</TH>
74         </TR>
75 %
76 %           $oldfreq = $freq;
77 %           $bgcolor = '';
78 %        
79 % } 
80 %
81 %         if ( $bgcolor eq $bgcolor1 ) {
82 %            $bgcolor = $bgcolor2;
83 %          } else {
84 %            $bgcolor = $bgcolor1;
85 %          }
86 %      
87
88   
89       <TR>
90         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<% $url %>">
91           <% $part_bill_event->eventpart %></A></TD>
92 % unless ( $cgi->param('showdisabled') ) { 
93
94         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
95           <% $part_bill_event->disabled ? 'DISABLED' : '' %></TD>
96 % } 
97
98         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<% $url %>">
99           <% $part_bill_event->event %></A></TD>
100         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
101           <% $delay %></TD>
102         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
103           <% $part_bill_event->plan %></TD>
104         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
105           <% $reason %></TD>
106         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
107           <% $plandata %></TD>
108         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><FONT SIZE="-1">
109           <% $part_bill_event->eventcode %></FONT></TD>
110       </TR>
111 % } 
112
113     </TABLE>
114     <BR><BR>
115 % } 
116 % } 
117
118
119 </BODY>
120 </HTML>