function printDep()
{
    # Set up table to display in
    $printDep = "\n\t\t<h3>View Employee Departments</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Department</th>\n\t\t\t\t<th colspan='2'>Options</th>\n\t\t\t</tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM departments ORDER BY department ASC";
    $depRslt = db_exec($sql) or errDie("Unable to retrieve employee departments from database.");
    if (pg_numrows($depRslt) < 1) {
        return "<li>There are no employee departments in Cubit.</li>";
    }
    while ($dep = pg_fetch_array($depRslt)) {
        $printDep .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'>{$dep['department']}</td>\n\t\t\t\t<td><a href='empdepartment-edit.php?id={$dep['id']}'>Edit</a></td>";
        $sql = "SELECT * FROM employees WHERE department='{$dep['id']}'";
        $depRslt = db_exec($sql) or ereDie("Unable to retrieve employee departments from database.");
        if (pg_numrows($depRslt) < 1) {
            $printDep .= "<td><a href='empdepartment-rem.php?id={$dep['id']}'>Remove</a></td></tr>";
        } else {
            $printDep .= "</tr>";
        }
        $i++;
    }
    $printDep .= "\n\t\t</table>\n\t\t<p>\n\t\t<table " . TMPL_tblDflts . " width='15%'>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><a href='empdepartment-add.php'>Add Employee Department</a></td>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
    return $printDep;
}
function printCat()
{
    # Set up table to display in
    $printCat = "\n\t\t\t\t\t<h3>View Stock Category</h3>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Category Code</th>\n\t\t\t\t\t\t\t<th>Category Name</th>\n\t\t\t\t\t\t\t<th>Stock Description</th>\n\t\t\t\t\t\t\t<th colspan='3'>Options</th>\n\t\t\t\t\t\t</tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM stockcat WHERE div = '" . USER_DIV . "' ORDER BY cat ASC";
    $catRslt = db_exec($sql) or errDie("Unable to retrieve stock categories from database.");
    if (pg_numrows($catRslt) < 1) {
        return "<li>There are no stock categories in Cubit.";
    }
    while ($cat = pg_fetch_array($catRslt)) {
        $printCat .= "\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td>{$cat['catcod']}</td>\n\t\t\t\t\t\t\t\t<td align='center'>{$cat['cat']}</td>\n\t\t\t\t\t\t\t\t<td>{$cat['descript']}</td>\n\t\t\t\t\t\t\t\t<td><a href='stockcat-det.php?catid={$cat['catid']}'>Details</a></td>\n\t\t\t\t\t\t\t\t<td><a href='stockcat-edit.php?catid={$cat['catid']}'>Edit</a></td>";
        $sql = "SELECT * FROM stock WHERE catid='{$cat['catid']}'";
        $catsRslt = db_exec($sql) or ereDie("Unable to retrieve stock categories from database.");
        if (pg_numrows($catsRslt) < 1) {
            $printCat .= "\n\t\t\t\t\t\t\t\t<td><a href='stockcat-rem.php?catid={$cat['catid']}'>Remove</a></td>\n\t\t\t\t\t\t\t</tr>";
        } else {
            $printCat .= "\n\t\t\t\t\t\t\t</tr>";
        }
        $i++;
    }
    $printCat .= "\n\t\t\t\t\t</table>\n\t\t\t\t\t<p>\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='15%'>\n\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><a href='stockcat-add.php'>Add Stock Category</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t</table>";
    return $printCat;
}