示例#1
0
    } else {
        if (isset($_POST['start_date']) && isset($_POST['end_date']) && $_POST['start_date'] != $_POST['end_date'] && $_POST['start_date'] != "" && $_POST['end_date'] != "") {
            $title .= " from " . $_POST['start_date'] . " to " . $_POST['end_date'];
        } else {
            if (isset($_POST['start_date']) && $_POST['start_date'] != "") {
                $title .= " after " . $_POST['start_date'];
            } else {
                if (isset($_POST['end_date']) && $_POST['end_date'] != "") {
                    $title .= " before " . $_POST['end_date'];
                }
            }
        }
    }
}
page_header($title);
begin_form("jobstats.php");
virtual_system_chooser();
date_fields();
// by month
jobstats_input_header();
jobstats_input_metric("Job Count by Month", "jobcount_vs_month");
jobstats_input_metric("CPU Time by Month", "cpuhours_vs_month");
jobstats_input_metric("Job Length by Month", "walltime_vs_month");
jobstats_input_metric("Queue Time by Month", "qtime_vs_month");
jobstats_input_metric("Backlog by Month", "backlog_vs_month");
jobstats_input_metric("Expansion Factor by Month", "xfactor_vs_month");
jobstats_input_metric("Active Users by Month", "users_vs_month");
jobstats_input_metric("Active Groups/Projects by Month", "groups_vs_month");
jobstats_input_footer();
end_form();
page_footer();
                $sql .= $pkgmatch[$key];
            } else {
                $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
            }
            $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " ) GROUP BY month;";
            #echo "<PRE>".htmlspecialchars($sql)."</PRE>";
            $result = db_query($db, $sql);
            echo "<TABLE border=1>\n";
            echo "<TR><TH>month</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH><TH>users</TH><TH>groups</TH></TR>\n";
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    $data[$rkey] = array_shift($row);
                    echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage-by-month.php");
    system_chooser();
    date_fields();
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();
                $sql .= $pkgmatch[$key];
            } else {
                $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
            }
            $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " ) GROUP BY week;";
            #echo "<PRE>".htmlspecialchars($sql)."</PRE>";
            $result = db_query($db, $sql);
            echo "<TABLE border=1>\n";
            echo "<TR><TH>week</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH><TH>users</TH><TH>groups</TH></TR>\n";
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    $data[$rkey] = array_shift($row);
                    echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage-by-week.php");
    system_chooser();
    date_fields();
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();
示例#4
0
$keys = array_keys($_POST);
if (isset($_POST['system'])) {
    $db = db_connect();
    $sql = "SELECT username, groupname, COUNT(jobid) AS jobcount, SUM(nproc*TIME_TO_SEC(walltime))/3600 AS cpuhrs FROM Jobs WHERE system LIKE '" . $_POST['system'] . "' AND ( " . dateselect("submit", $_POST['start_date'], $_POST['end_date']) . " ) GROUP BY username ORDER BY " . $_POST['order'] . " DESC LIMIT " . $_POST['limit'];
    #    echo "<PRE>".$sql."</PRE>\n";
    $result = db_query($db, $sql);
    echo "<TABLE border=\"1\">\n";
    echo "<TR><TH>user</TH><TH>group</TH><TH>job count</TH><TH>CPU-hours</TH></TR>\n";
    while ($result->fetchInto($row)) {
        echo "<TR>";
        $rkeys = array_keys($row);
        foreach ($rkeys as $key) {
            $data[$key] = array_shift($row);
            echo "<TD align=\"right\"><PRE>" . htmlspecialchars($data[$key]) . "</PRE></TD>";
        }
        echo "</TR>\n";
    }
    echo "</TABLE>\n";
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("active-users.php");
    system_chooser();
    date_fields();
    $choices = array("cpuhrs", "jobcount");
    $defaultchoice = "cpuhrs";
    pulldown("order", "Order by", $choices, $defaultchoice);
    textfield("limit", "Max shown", "10", 4);
    end_form();
}
page_footer();
                $sql .= $pkgmatch[$key];
            } else {
                $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
            }
            $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " )";
            #echo "<PRE>".htmlspecialchars($sql)."</PRE>";
            $result = db_query($db, $sql);
            echo "<TABLE border=1>\n";
            echo "<TR><TH>username</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH></TR>\n";
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    $data[$rkey] = array_shift($row);
                    echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage-by-user.php");
    system_chooser();
    date_fields();
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();
                $sql .= $pkgmatch[$key];
            } else {
                $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
            }
            $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " ) GROUP BY quarter;";
            #echo "<PRE>".htmlspecialchars($sql)."</PRE>";
            $result = db_query($db, $sql);
            echo "<TABLE border=1>\n";
            echo "<TR><TH>quarter</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH><TH>users</TH><TH>groups</TH></TR>\n";
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    $data[$rkey] = array_shift($row);
                    echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage-by-quarter.php");
    system_chooser();
    date_fields();
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();
示例#7
0
                } else {
                    $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
                }
                $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " )";
            }
            #echo "<PRE>".htmlspecialchars($sql)."</PRE>";
            $result = db_query($db, $sql);
            echo "<TABLE border=1>\n";
            echo "<TR><TH>system</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH><TH>users</TH><TH>groups</TH></TR>\n";
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    $data[$rkey] = array_shift($row);
                    echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage.php");
    system_chooser();
    date_fields();
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();
示例#8
0
            echo "</TR>\n";
            ob_flush();
            flush();
        }
        echo "</TABLE>\n";
        if (isset($_POST['xls'])) {
            $xlsresult = db_query($db, $sql);
            $columns = array("package", "jobcount", "cpuhours", "users", "groups");
            result_as_xls($xlsresult, $columns, $_POST['system'] . "-software_usage-" . $_POST['start_date'] . "-" . $_POST['end_date']);
        }
        if (isset($_POST['ods'])) {
            $odsresult = db_query($db, $sql);
            $columns = array("package", "jobcount", "cpuhours", "users", "groups");
            result_as_ods($odsresult, $columns, $_POST['system'] . "-software_usage-" . $_POST['start_date'] . "-" . $_POST['end_date']);
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("usage-summary.php");
    system_chooser();
    date_fields();
    $orders = array("jobcount", "cpuhours", "users", "groups");
    checkboxes_from_array("Supplemental reports", array("institution", "software"));
    $defaultorder = "cpuhours";
    pulldown("order", "Order results by", $orders, $defaultorder);
    checkbox("Generate Excel files for supplemental reports", "xls");
    checkbox("Generate ODF files for supplemental reports", "ods");
    end_form();
}
page_footer();
示例#9
0
$keys = array_keys($_POST);
if (isset($_POST['system'])) {
    $db = db_connect();
    $sql = "SELECT groupname, COUNT(DISTINCT(username)) AS users, COUNT(jobid) AS jobcount, SUM(nproc*TIME_TO_SEC(walltime))/3600 AS cpuhrs FROM Jobs WHERE system LIKE '" . $_POST['system'] . "' AND ( " . dateselect("submit", $_POST['start_date'], $_POST['end_date']) . " ) GROUP BY groupname ORDER BY " . $_POST['order'] . " DESC LIMIT " . $_POST['limit'];
    #    echo "<PRE>".$sql."</PRE>\n";
    $result = db_query($db, $sql);
    echo "<TABLE border=\"1\">\n";
    echo "<TR><TH>group</TH><TH>users</TH><TH>job count</TH><TH>CPU-hours</TH></TR>\n";
    while ($result->fetchInto($row)) {
        echo "<TR>";
        $rkeys = array_keys($row);
        foreach ($rkeys as $key) {
            $data[$key] = array_shift($row);
            echo "<TD align=\"right\"><PRE>" . htmlspecialchars($data[$key]) . "</PRE></TD>";
        }
        echo "</TR>\n";
    }
    echo "</TABLE>\n";
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("active-groups.php");
    system_chooser();
    date_fields();
    $choices = array("cpuhrs", "jobcount", "users");
    $defaultchoice = "cpuhrs";
    pulldown("order", "Order by", $choices, $defaultchoice);
    textfield("limit", "Max shown", "10", 4);
    end_form();
}
page_footer();
示例#10
0
                $sql .= $pkgmatch[$key];
            } else {
                $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
            }
            $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " )";
            #echo "<PRE>".htmlspecialchars($sql)."</PRE>";
            $result = db_query($db, $sql);
            echo "<TABLE border=1>\n";
            echo "<TR><TH>groupname</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH></TR>\n";
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    $data[$rkey] = array_shift($row);
                    echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage-by-group.php");
    system_chooser();
    date_fields();
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();
示例#11
0
    while ($result->fetchInto($row)) {
        echo "<TR>";
        $rkeys = array_keys($row);
        foreach ($rkeys as $key) {
            $data[$key] = array_shift($row);
            if ($col[$key] == "submit_ts" || $col[$key] == "start_ts" || $col[$key] == "end_ts") {
                echo "<TD><PRE>" . date("Y-m-d H:i:s", $data[$key]) . "</PRE></TD>\n";
            } else {
                if ($col[$key] == "jobid") {
                    $jobid_nodot = ereg_replace('\\..*', '', $data[$key]);
                    echo "<TD><PRE><A HREF=\"", "jobinfo.php?jobid={$jobid_nodot}", "&system={$_POST['system']}&all=1\"\\>", htmlspecialchars($jobid_nodot), "</A></PRE></TD>";
                } else {
                    echo "<TD><PRE>" . htmlspecialchars($data[$key]) . "</PRE></TD>";
                }
            }
        }
        echo "</TR>\n";
    }
    echo "</TABLE>\n";
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("jobs-by-node.php");
    text_field("Node RegExp", "node", 16);
    system_chooser();
    date_fields();
    $props = array("username", "groupname", "jobname", "nproc", "mppe", "mppssp", "nodes", "queue", "submit_ts", "start_ts", "end_ts", "cput_req", "cput", "walltime_req", "walltime", "mem_req", "mem_kb", "vmem_req", "vmem_kb", "software", "hostlist", "exit_status", "script");
    checkboxes_from_array("Properties", $props);
    end_form();
}
page_footer();
示例#12
0
            $col[$ncols] = $key;
            $ncols++;
        }
    }
    echo "</TR>\n";
    while ($result->fetchInto($row)) {
        $rkeys = array_keys($row);
        echo "<TR>";
        foreach ($rkeys as $key) {
            $data[$key] = array_shift($row);
            if ($col[$key] == "submit_ts" || $col[$key] == "start_ts" || $col[$key] == "end_ts") {
                echo "<TD><PRE>" . date("Y-m-d H:i:s", $data[$key]) . "</PRE></TD>\n";
            } else {
                echo "<TD><PRE>" . htmlspecialchars($data[$key]) . "</PRE></TD>";
            }
        }
        echo "</TR>\n";
    }
    echo "</TABLE>\n";
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("jobs-by-group.php");
    text_field("Group", "groupname", 16);
    system_chooser();
    date_fields();
    $props = array("jobname", "nproc", "mppe", "mppssp", "nodes", "queue", "submit_ts", "start_ts", "end_ts", "cput_req", "cput", "walltime_req", "walltime", "mem_req", "mem_kb", "vmem_req", "vmem_kb", "software", "hostlist", "exit_status", "script");
    checkboxes_from_array("Properties", $props);
    end_form();
}
page_footer();
                $sql .= $pkgmatch[$key];
            } else {
                $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
            }
            $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " )";
            $result = db_query($db, $sql);
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    $data[$rkey] = array_shift($row);
                    echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage-by-institution.php");
    system_chooser();
    date_fields();
    $orders = array("jobcount", "cpuhours", "users", "groups");
    $defaultorder = "cpuhours";
    pulldown("order", "Order by", $orders, $defaultorder);
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();
示例#14
0
            $sql = $sql . "," . $key;
        }
    }
    $sql = $sql . " FROM Jobs WHERE jobid LIKE '" . $_POST['jobid'] . ".%' AND system LIKE '" . $_POST['system'] . "';";
    $result = db_query($db, $sql);
    while ($result->fetchInto($row)) {
        echo "<TABLE border=\"1\">\n";
        foreach ($keys as $key) {
            if (isset($_POST[$key])) {
                $data[$key] = array_shift($row);
                echo "<TR><TD width=\"10%\"><PRE>" . $key . "</PRE></TD><TD width=\"90%\"><PRE>";
                if ($key == "submit_ts" || $key == "start_ts" || $key == "end_ts") {
                    echo date("Y-m-d H:i:s", $data[$key]);
                } else {
                    echo htmlspecialchars($data[$key]);
                }
                echo "</PRE></TD></TR>\n";
            }
        }
        echo "</TABLE>\n";
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("jobinfo.php");
    text_field("Job id", "jobid", 8);
    system_chooser();
    checkboxes_from_array("Properties", $props);
    end_form();
}
page_footer();
示例#15
0
            $col[$ncols] = $key;
            $ncols++;
        }
    }
    echo "</TR>\n";
    while ($result->fetchInto($row)) {
        $rkeys = array_keys($row);
        echo "<TR>";
        foreach ($rkeys as $key) {
            $data[$key] = array_shift($row);
            if ($col[$key] == "submit_ts" || $col[$key] == "start_ts" || $col[$key] == "end_ts") {
                echo "<TD><PRE>" . date("Y-m-d H:i:s", $data[$key]) . "</PRE></TD>\n";
            } else {
                echo "<TD><PRE>" . htmlspecialchars($data[$key]) . "</PRE></TD>";
            }
        }
        echo "</TR>\n";
    }
    echo "</TABLE>\n";
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("jobs-by-user.php");
    text_field("User", "username", 16);
    system_chooser();
    date_fields();
    $props = array("groupname", "jobname", "nproc", "mppe", "mppssp", "nodes", "queue", "submit_ts", "start_ts", "end_ts", "cput_req", "cput", "walltime_req", "walltime", "mem_req", "mem_kb", "vmem_req", "vmem_kb", "software", "hostlist", "exit_status", "script");
    checkboxes_from_array("Properties", $props);
    end_form();
}
page_footer();
示例#16
0
    echo "</TR>\n";
    while ($result->fetchInto($row)) {
        echo "<TR>";
        $rkeys = array_keys($row);
        foreach ($rkeys as $key) {
            $data[$key] = array_shift($row);
            if ($col[$key] == "submit_ts" || $col[$key] == "start_ts" || $col[$key] == "end_ts") {
                echo "<TD><PRE>" . date("Y-m-d H:i:s", $data[$key]) . "</PRE></TD>\n";
            } else {
                if ($col[$key] == "jobid") {
                    $jobid_nodot = ereg_replace('\\..*', '', $data[$key]);
                    echo "<TD><PRE><A HREF=\"", "jobinfo.php?jobid={$jobid_nodot}", "&system={$_POST['system']}&all=1\"\\>", htmlspecialchars($jobid_nodot), "</A></PRE></TD>";
                } else {
                    echo "<TD><PRE>" . htmlspecialchars($data[$key]) . "</PRE></TD>";
                }
            }
        }
        echo "</TR>\n";
    }
    echo "</TABLE>\n";
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("problem-jobs.php");
    system_chooser();
    date_fields();
    $props = array("username", "groupname", "jobname", "nproc", "mppe", "mppssp", "nodes", "queue", "submit_ts", "start_ts", "end_ts", "cput_req", "cput", "walltime_req", "walltime", "mem_req", "mem_kb", "vmem_req", "vmem_kb", "hostlist", "exit_status", "script");
    checkboxes_from_array("Properties", $props);
    end_form();
}
page_footer();
                $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
            }
            $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " ) ORDER BY hidden;";
            #echo "<PRE>".htmlspecialchars($sql)."</PRE>";
            $result = db_query($db, $sql);
            echo "<TABLE border=1>\n";
            echo "<TR><TH>walltime</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH></TR>\n";
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    if ($rkey != "hidden") {
                        $data[$rkey] = array_shift($row);
                        echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                    }
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage-by-walltime.php");
    system_chooser();
    date_fields();
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();
示例#18
0
    $draft = mysql_result($res, 0);
    $res = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE `sender` = " . $CURUSER["id"] . " AND `location` = 'template'");
    $template = mysql_result($res, 0);
    tr2('<a href="mailbox.php?inbox">' . T_("INBOX") . ' </a> ', " {$inbox} " . P_("message", $inbox) . " ({$unread} " . T_("unread") . ")");
    tr2('<a href="mailbox.php?outbox">' . T_("OUTBOX") . ' </a> ', " {$outbox} " . P_("message", $outbox));
    tr2('<a href="mailbox.php?draft">' . T_("DRAFT") . ' </a> ', " {$draft} " . P_("message", $draft));
    tr2('<a href="mailbox.php?templates">' . T_("TEMPLATES") . ' </a> ', " {$template} " . P_("message", $template));
    end_table();
    echo "<br /><br />";
} elseif ($type == "Mail") {
    $order = order("added,sender,sendto,subject", "added", true);
    $res = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE {$where}");
    $count = mysql_result($res, 0);
    list($pagertop, $pagerbottom, $limit) = pager2(20, $count);
    print $pagertop;
    begin_form();
    begin_table(0, "list");
    $table['&nbsp;'] = th("<input type=\"checkbox\" onclick=\"toggleChecked(this.checked);this.form.remove.disabled=true;\" />", 1);
    $table['Sender'] = th_left("Sender", 'sender');
    $table['Sent_to'] = th_left("Sent To", 'receiver');
    $table['Subject'] = th_left("Subject", 'subject');
    $table['Date'] = th_left("Date", 'added');
    table($table, $tablefmt);
    $res = SQL_Query_exec("SELECT * FROM messages WHERE {$where} {$order} {$limit}");
    while ($arr = mysql_fetch_assoc($res)) {
        unset($table);
        $userid = 0;
        $format = '';
        $reading = false;
        if ($arr["sender"] == $CURUSER['id']) {
            $sender = "Yourself";
示例#19
0
                $sql .= $pkgmatch[$key];
            } else {
                $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'";
            }
            $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " )";
            #echo "<PRE>".htmlspecialchars($sql)."</PRE>";
            $result = db_query($db, $sql);
            echo "<TABLE border=1>\n";
            echo "<TR><TH>username</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH></TR>\n";
            while ($result->fetchInto($row)) {
                $rkeys = array_keys($row);
                echo "<TR>";
                foreach ($rkeys as $rkey) {
                    $data[$rkey] = array_shift($row);
                    echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>";
                }
                echo "</TR>\n";
            }
            echo "</TABLE>\n";
        }
    }
    db_disconnect($db);
    bookmarkable_url();
} else {
    begin_form("software-usage-by-queue.php");
    system_chooser();
    date_fields();
    checkboxes_from_array("Packages", $packages);
    end_form();
}
page_footer();