2 ################################################################################
4 # File: $RCSfile: stats.cgi,v $
5 # Revision: $Revision: 1.1 $
6 # Description: This script produces a table of statistics of mail processed for
8 # Author: Andrew@DeFaria.com
9 # Created: Fri Nov 29 14:17:21 2002
10 # Modified: $Date: 2013/06/12 14:05:47 $
13 # (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
15 ################################################################################
21 local $0 = $FindBin::Script;
23 use lib "$FindBin::Bin/../lib";
30 use CGI qw (:standard *table start_Tr end_Tr);
31 use CGI::Carp 'fatalsToBrowser';
33 my $nbr_days = param('nbr_days');
34 my $date = param('date');
36 my $table_name = 'stats';
38 $date = defined $date ? $date : Today2SQLDatetime;
43 print start_table ({-align => 'center',
50 print start_Tr {-valign => 'bottom'};
51 print th {-class => 'tableleftend'}, 'Date';
54 print th {-class => 'tableheader'}, ucfirst;
57 print th {-class => 'tablerightend'}, 'Total';
66 for my $date (sort {$b cmp $a} (keys (%dates))) {
68 print td {-class => 'tablerightleftdata',
69 -align => 'center'}, FormatDate $date, 1;
74 my $value = $dates{$date}{$_};
76 print td {-class => 'tabledata'}, ' ';
78 print td {-class => 'tabledata',
80 a {-href => "detail.cgi?type=$_;date=$date"},
83 $totals{$_} += $value;
87 if ($day_total == 0) {
88 print td {-class => 'tableleftrightdata'}, ' ';
90 print td {-class => 'tableleftrightdata',
91 -align => 'center'}, $day_total;
100 print th {-class => 'tablebottomlefttotal'}, 'Totals';
103 if ($totals{$_} == 0) {
104 print td {-class => 'tablebottomtotal'}, ' ';
106 print td {-class => 'tablebottomtotal',
108 a {-href => "detail.cgi?type=$_"}, $totals{$_};
111 $grand_total += $totals{$_};
114 print td {-class => 'tablebottomrighttotal',
115 -align => 'center'}, $grand_total;
124 my $userid = Heading (
133 $userid //= $ENV{USER};
138 my %options = GetUserOptions $userid;
139 $nbr_days = $options{Dates};
142 NavigationBar($userid);
146 Footing($table_name);