1.7.0? why not!
[freeside.git] / httemplate / index.html
1 <% my $conf = new FS::Conf; %>
2 <%= include('/elements/header.html', 'Billing Main' ) %>
3
4 <%
5
6   my $sth = dbh->prepare(
7     #"SELECT DISTINCT custnum FROM h_cust_main JOIN cust_main USING ( custnum )
8     "SELECT custnum FROM h_cust_main JOIN cust_main USING ( custnum )
9        WHERE ( history_action = 'insert' OR history_action = 'replace_new' ) 
10          AND history_user = ?
11        ORDER BY history_date desc" # LIMIT 10
12     ) or die dbh->errstr;
13
14   $sth->execute( getotaker() ) or die $sth->errstr;
15
16   my %saw = ();
17   my @custnums = grep { !$saw{$_}++ } map $_->[0], @{ $sth->fetchall_arrayref };
18
19   @custnums = splice(@custnums, 0, 10);
20
21   if ( @custnums ) {
22
23 %>
24
25   <%= include('/elements/table-grid.html') %>
26
27   <% my $bgcolor1 = '#eeeeee';
28      my $bgcolor2 = '#ffffff';
29      my $bgcolor;
30   %>
31
32   <TR>
33     <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=1>Customers I recently added or modified</TH>
34   </TR>
35
36   <% foreach my $custnum ( @custnums ) { %> 
37   <% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); %>
38   <% next unless $cust_main; %>
39
40     <TR>
41       <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="view/cust_main.cgi?<%= $custnum %>"><%= $custnum %>: <%= $cust_main->name %></A></TD>
42     </TR>
43
44     <%
45        if ( $bgcolor eq $bgcolor1 ) {
46           $bgcolor = $bgcolor2;
47         } else {
48           $bgcolor = $bgcolor1;
49         }
50     %>
51
52   <% } %>
53
54   </TABLE>
55
56 <% } %>
57
58 <%= include('/elements/footer.html') %>
59