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);
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_table ({-align => 'center',
51 print start_Tr {-valign => 'bottom'};
52 print th {-class => 'tableleftend'}, 'Date';
55 print th {-class => 'tableheader'}, ucfirst;
58 print th {-class => 'tablerightend'}, 'Total';
67 for my $date (sort {$b cmp $a} (keys (%dates))) {
69 print td {-class => 'tablerightleftdata',
70 -align => 'center'}, FormatDate $date, 1;
75 my $value = $dates{$date}{$_};
77 print td {-class => 'tabledata'}, ' ';
79 print td {-class => 'tabledata',
81 a {-href => "detail.cgi?type=$_;date=$date"},
84 $totals{$_} += $value;
88 if ($day_total == 0) {
89 print td {-class => 'tableleftrightdata'}, ' ';
91 print td {-class => 'tableleftrightdata',
92 -align => 'center'}, $day_total;
101 print th {-class => 'tablebottomlefttotal'}, 'Totals';
104 if ($totals{$_} == 0) {
105 print td {-class => 'tablebottomtotal'}, ' ';
107 print td {-class => 'tablebottomtotal',
109 a {-href => "detail.cgi?type=$_"}, $totals{$_};
112 $grand_total += $totals{$_};
115 print td {-class => 'tablebottomrighttotal',
116 -align => 'center'}, $grand_total;
125 my $userid = Heading (
134 $userid //= $ENV{USER};
139 my %options = GetUserOptions $userid;
140 $nbr_days = $options{Dates};
143 NavigationBar($userid);
147 Footing($table_name);