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 ################################################################################
20 $0 = $FindBin::Script;
22 use lib $FindBin::Bin;
29 use CGI qw (:standard *table start_Tr end_Tr);
30 use CGI::Carp "fatalsToBrowser";
32 my $nbr_days = param ("nbr_days");
33 my $date = param ("date");
35 my $table_name = "stats";
37 $date = defined $date ? $date : Today2SQLDatetime;
40 print start_table ({-align => "center",
47 print start_Tr {-valign => "bottom"};
48 print th {-class => "tableleftend"}, "Date";
51 print th {-class => "tableheader"}, ucfirst;
54 print th {-class => "tablerightend"}, "Total";
56 my %dates = GetStats $nbr_days, $date;
59 foreach my $date (sort {$b cmp $a} (keys (%dates))) {
61 print td {-class => "tablerightleftdata",
62 -align => "center"}, FormatDate $date;
67 my $value = $dates{$date}{$_};
69 print td {-class => "tabledata"}, " ";
71 print td {-class => "tabledata",
73 a {-href => "detail.cgi?type=$_;date=$date"},
76 $totals{$_} += $value;
80 if ($day_total eq 0) {
81 print td {-class => "tableleftrightdata"}, " ";
83 print td {-class => "tableleftrightdata",
84 -align => "center"}, $day_total;
93 print th {-class => "tablebottomlefttotal"}, "Totals";
96 if ($totals{$_} eq 0) {
97 print td {-class => "tablebottomtotal"}, " ";
99 print td {-class => "tablebottomtotal",
101 a {-href => "detail.cgi?type=$_"}, $totals{$_};
104 $grand_total += $totals{$_};
107 print td {-class => "tablebottomrighttotal",
108 -align => "center"}, $grand_total;
115 my $userid = Heading (
126 if (!defined $nbr_days) {
127 my %options = GetUserOptions $userid;
128 $nbr_days = $options{"Dates"};
131 NavigationBar $userid;