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";
24 use lib "$FindBin::Bin/../../lib";
31 use CGI qw (:standard *table start_Tr end_Tr start_div end_div);
32 use CGI::Carp 'fatalsToBrowser';
34 my $nbr_days = param('nbr_days');
35 my $date = param('date');
37 my $table_name = 'stats';
39 $date = defined $date ? $date : Today2SQLDatetime;
44 print start_div {-id => 'highlightrow'};
46 print start_table ({-align => 'center',
53 print start_Tr {-valign => 'bottom'};
54 print th {-class => 'tableleftend'}, 'Date';
57 print th {-class => 'tableheader'}, ucfirst;
60 print th {-class => 'tablerightend'}, 'Total';
69 for my $date (sort {$b cmp $a} (keys (%dates))) {
71 print td {-class => 'tablerightleftdata',
72 -align => 'center'}, FormatDate $date, 1;
77 my $value = $dates{$date}{$_};
79 print td {-class => 'tabledata'}, ' ';
81 print td {-class => 'tabledata',
83 a {-href => "detail.cgi?type=$_;date=$date"},
86 $totals{$_} += $value;
90 if ($day_total == 0) {
91 print td {-class => 'tableleftrightdata'}, ' ';
93 print td {-class => 'tableleftrightdata',
94 -align => 'center'}, $day_total;
103 print th {-class => 'tablebottomlefttotal'}, 'Totals';
106 if ($totals{$_} == 0) {
107 print td {-class => 'tablebottomtotal'}, ' ';
109 print td {-class => 'tablebottomtotal',
111 a {-href => "detail.cgi?type=$_"}, $totals{$_};
114 $grand_total += $totals{$_};
117 print td {-class => 'tablebottomrighttotal',
118 -align => 'center'}, $grand_total;
128 my $userid = Heading (
137 $userid //= $ENV{USER};
142 my %options = GetUserOptions $userid;
143 $nbr_days = $options{Dates};
146 NavigationBar($userid);
150 Footing($table_name);