From 15f50d071b6cb7f534e93783043e45fd498f4309 Mon Sep 17 00:00:00 2001 From: Callum Massey <kais58@sucs.org> Date: Tue, 11 Dec 2012 18:08:14 +0000 Subject: [PATCH] Added start date for printer shame script --- components/printer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/printer.php b/components/printer.php index 95792c0..a362c41 100644 --- a/components/printer.php +++ b/components/printer.php @@ -6,6 +6,8 @@ */ $max=10; //Set this to number of users to display in chart +$timestamp = '2012-09-01 00:00:00+00'; //display printer stats since this time + $smarty->assign('title',"Printer Statistics"); $sucsDB = NewADOConnection('postgres8'); $sucsDB->Connect('dbname=sucs user=apache'); @@ -15,7 +17,7 @@ $sucsDB->SetFetchMode(ADODB_FETCH_ASSOC); $table="<table border=1 cellpadding=3>\n<tr>\n<th>Username</th>\n<th>Pages</th>\n<th>Projected Monthly Usage</th>\n<th>Printed This Month</th>\n<th>What it would cost in the library</th></tr>\n"; //pull in all the current users (ie not old) who have printed stuff -$res = $sucsDB->Execute("select username, sum(pages) as pages from printer where username != 'old' group by username order by sum(pages) desc"); +$res = $sucsDB->Execute("select username, sum(pages) as pages from printer where username != 'old' AND start > '".$timestamp."' group by username order by sum(pages) desc"); $num = $res->RecordCount(); //for each row stuff the infomation into an array, then free up the database resorces for ($i=0;$i<$num;$i++) { -- GitLab