function remove_entry()
{
    extract($_REQUEST);
    $accid_arr = array_keys($remove);
    $accid = $accid_arr[0];
    db_connect();
    $rem_sql = "DELETE FROM non_purchases_account_list WHERE accid = '{$accid}'";
    $run_rem = db_exec($rem_sql) or errDie("Unable to remove account information.");
    unset($_REQUEST);
    return get_current_setting();
}
function save_new_setting()
{
    extract($_REQUEST);
    db_connect();
    $check_sql = "SELECT value FROM settings WHERE constant = 'ACCOUNT_SORT_ORDER' LIMIT 1";
    $run_check = db_exec($check_sql) or errDie("Unable to get current setting information.");
    if (pg_numrows($run_check) < 1) {
        $ins_sql = "\n\t\t\tINSERT INTO settings (\n\t\t\t\tconstant, label, value, type, datatype, minlen, maxlen, div, readonly\n\t\t\t) VALUES (\n\t\t\t\t'ACCOUNT_SORT_ORDER', 'Accounts Sort Order', '{$sort_order}', 'company', 'allstring', '1', '250', '0', 'f'\n\t\t\t)";
        $run_ins = db_exec($ins_sql) or errDie("Unable to record accounts sort order information.");
    } else {
        $upd_sql = "UPDATE settings SET value = '{$sort_order}' WHERE constant = 'ACCOUNT_SORT_ORDER'";
        $run_upd = db_exec($upd_sql) or errDie("Unable to update setting information.");
    }
    return get_current_setting();
}
function save_new_setting()
{
    extract($_REQUEST);
    db_connect();
    $check_sql = "SELECT value FROM settings WHERE constant = 'TRANSACTION_DATE' LIMIT 1";
    $run_check = db_exec($check_sql) or errDie("Unable to get current setting information.");
    if (pg_numrows($run_check) < 1) {
        $ins_sql = "\n\t\t\tINSERT INTO settings (\n\t\t\t\tconstant, label, value, type, datatype, minlen, maxlen, div, readonly\n\t\t\t) VALUES (\n\t\t\t\t'TRANSACTION_DATE', 'Transaction Date', '{$transaction_year}-{$transaction_month}-{$transaction_day}', 'company', 'allstring', '1', '250', '0', 'f'\n\t\t\t)";
        $run_ins = db_exec($ins_sql) or errDie("Unable to record transaction date setting information.");
    } else {
        $upd_sql = "UPDATE settings SET value = '{$transaction_year}-{$transaction_month}-{$transaction_day}' WHERE constant = 'TRANSACTION_DATE'";
        $run_upd = db_exec($upd_sql) or errDie("Unable to update setting information.");
    }
    $check_sql = "SELECT value FROM settings WHERE constant = 'USE_TRANSACTION_DATE' LIMIT 1";
    $run_check = db_exec($check_sql) or errDie("Unable to get current setting information.");
    if (pg_numrows($run_check) < 1) {
        $ins_sql = "\n\t\t\tINSERT INTO settings (\n\t\t\t\tconstant, label, value, type, datatype, minlen, maxlen, div, readonly\n\t\t\t) VALUES (\n\t\t\t\t'USE_TRANSACTION_DATE', 'Use Transaction Date', '{$use_date_setting}', 'company', 'allstring', '1', '250', '0', 'f'\n\t\t\t)";
        $run_ins = db_exec($ins_sql) or errDie("Unable to record transaction date setting information.");
    } else {
        $upd_sql = "UPDATE settings SET value = '{$use_date_setting}' WHERE constant = 'USE_TRANSACTION_DATE'";
        $run_upd = db_exec($upd_sql) or errDie("Unable to update setting information.");
    }
    return get_current_setting();
}