342d88c773deff44020da5f34bc20750855078ab
[freeside.git] / httemplate / index.html
1 <%init>my $debug = $cgi->param('debug');</%init>
2 % warn time.": header.html\n" if $debug;
3 %
4 <& /elements/header.html, mt('Billing Main') &>
5
6 % warn time.": dashboard-install_welcome.html\n" if $debug;
7 %
8 <& /elements/dashboard-install_welcome.html &>
9
10 % warn time.": dashboard-toplist.html\n" if $debug;
11 %
12 <& /elements/dashboard-toplist.html &>
13
14 % warn time.": fetching recently changed customers\n" if $debug;
15 %
16 %  my $sth = dbh->prepare(
17 %    #"SELECT DISTINCT custnum FROM h_cust_main JOIN cust_main USING ( custnum )
18 %    "SELECT custnum FROM h_cust_main JOIN cust_main USING ( custnum )
19 %       WHERE ( history_action = 'insert' OR history_action = 'replace_new' ) 
20 %         AND ( history_usernum = ? OR history_user = ? )
21 %       ORDER BY history_date desc" # LIMIT 10
22 %    ) or die dbh->errstr;
23 %
24 %  my $curuser = $FS::CurrentUser::CurrentUser;
25 %
26 %  $sth->execute( $curuser->usernum, $curuser->username ) or die $sth->errstr;
27 %
28 %  my %saw = ();
29 %  my @custnums = grep { !$saw{$_}++ } map $_->[0], @{ $sth->fetchall_arrayref };
30 %
31 %  @custnums = splice(@custnums, 0, 10);
32 %
33 %  if ( @custnums ) {
34 %    warn time.": displaying recently changed customers\n" if $debug;
35
36   <& /elements/table-grid.html &>
37
38 % my $bgcolor1 = '#eeeeee';
39 %     my $bgcolor2 = '#ffffff';
40 %     my $bgcolor = $bgcolor2;
41
42   <TR>
43     <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=1><% mt('Customers I recently added or modified') |h %></TH>
44   </TR>
45
46 % foreach my $custnum ( @custnums ) { 
47 % my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); 
48 % next unless $cust_main; 
49
50     <TR>
51       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="view/cust_main.cgi?<% $custnum %>"><% $cust_main->display_custnum %>: <% $cust_main->name |h %></A></TD>
52     </TR>
53
54 %       if ( $bgcolor eq $bgcolor1 ) {
55 %          $bgcolor = $bgcolor2;
56 %        } else {
57 %          $bgcolor = $bgcolor1;
58 %        }
59 %    
60 % } 
61
62   </TABLE>
63
64 % } 
65
66 <& /elements/footer.html &>