function write($_POST)
{
    extract($_POST);
    require_lib("validate");
    $v = new validate();
    $v->isOk($des, "string", 0, 100, "Invalid action description.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>" . $e["msg"];
        }
        return entererr($_POST, $confirm . "</li>");
    }
    db_conn('crm');
    $Sl = "INSERT INTO actions (action) VALUES ('{$des}')";
    $Ry = db_exec($Sl) or errDie("Unable to insert category into db.");
    $out = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t<tr><th>Action added to the system</th></tr>\r\n\t<tr class=datacell><td>New Action, has been successfully added to the system.</td></tr>\r\n\t</table>";
    return $out;
}
예제 #2
0
function write($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($accc, "string", 1, 50, "Invalid Account Creation Selection.");
    # display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "-" . $e["msg"] . "<br>";
        }
        $Errors = "<tr><td class=err colspan=2>{$theseErrors}</td></tr>\n\t\t<tr><td colspan=2><br></td></tr>";
        return entererr($accc, $Errors);
    }
    if ($accc == "cubit") {
        $acccv = "acc-new.php";
        $descript = "Use Cubit generated account numbers";
    } elseif ($accc == "user") {
        $acccv = "acc-new2.php";
        $descript = "Use user selected account numbers";
    }
    # connect to db
    db_connect();
    # check if setting exists
    $sql = "SELECT label FROM set WHERE label = 'ACCNEW_LNK'";
    $Rslt = db_exec($sql) or errDie("Unable to check database for existing settings.");
    if (pg_numrows($Rslt) > 0) {
        $Sql = "UPDATE set SET value = '{$acccv}', type = 'Account Creation' WHERE label = 'ACCNEW_LNK'";
    } else {
        $Sql = "INSERT INTO set(type, label, value, descript) VALUES('Account Creation', 'ACCNEW_LNK', '{$acccv}', '{$descript}')";
    }
    $setRslt = db_exec($Sql) or errDie("Unable to insert settings to Cubit.");
    # status report
    $write = "\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n\t\t<tr><th>Cubit Settings</th></tr>\n\t\t<tr class=datacell><td>Setting have been successfully added to Cubit.</td></tr>\n\t</table>\n\t<p>\n\t<tr>\n\t<table border=0 cellpadding='2' cellspacing='1'>\n\t\t<tr><th>Quick Links</th></tr>\n\t\t<tr bgcolor='#88BBFF'><td><a href='set-view.php'>View Settings</a></td></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
    return $write;
}
function write($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($app, "string", 1, 50, "Invalid Selection.");
    # Display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "-" . $e["msg"] . "<br>";
        }
        $Errors = "<tr><td class=err colspan=2>{$theseErrors}</td></tr>\n\t\t<tr><td colspan=2><br></td></tr>";
        return entererr($accc, $Errors);
    }
    if ($app == 'napprv') {
        $descript = "Don not Approve Purchases";
    } else {
        $descript = "Purchases Must Be Approved";
    }
    # Connect to db
    db_connect();
    # Check if setting exists
    $sql = "SELECT label FROM set WHERE label = 'PURCH_APPRV' AND div = '" . USER_DIV . "'";
    $Rslt = db_exec($sql) or errDie("Unable to check database for existing settings.");
    if (pg_numrows($Rslt) > 0) {
        $Sql = "UPDATE set SET value = '{$app}', descript = '{$descript}' WHERE label = 'PURCH_APPRV' AND div = '" . USER_DIV . "'";
    } else {
        $Sql = "INSERT INTO set(type, label, value, descript, div) VALUES('Stock Purchases Approval', 'PURCH_APPRV', '{$app}', '{$descript}', '" . USER_DIV . "')";
    }
    $setRslt = db_exec($Sql) or errDie("Unable to insert settings to Cubit.");
    # status report
    $write = "\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n\t\t<tr><th>Cubit Settings</th></tr>\n\t\t<tr class=datacell><td>Setting have been successfully added to Cubit.</td></tr>\n\t</table>\n\t<p>\n\t<tr>\n\t<table border=0 cellpadding='2' cellspacing='1'>\n\t\t<tr><th>Quick Links</th></tr>\n\t\t<tr bgcolor='#88BBFF'><td><a href='set-view.php'>View Settings</a></td></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
    return $write;
}
function write($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($typ, "string", 1, 50, "Invalid Interest Calculation selection.");
    $v->isOk($perc, "num", 0, 50, "Invalid interest percentage.");
    $v->isOk($dperc, "float", 0, 50, "Invalid Default interest percentage.");
    $v->isOk($accid, "num", 1, 70, "Invalid Account Number.");
    # display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "-" . $e["msg"] . "<br>";
        }
        $Errors = "\n\t\t\t<tr>\n\t\t\t\t<td class='err' colspan='2'>{$theseErrors}</td>\n\t\t\t</tr>\n\t\t\t<tr><td colspan='2'><br></td></tr>";
        return entererr($accc, $Errors);
    }
    if ($typ == "perc") {
        $descript = "Use Interest Percentage {$perc} %";
        $typ = $perc;
    } elseif ($typ == "rate") {
        $descript = "User Customer Specific rate | Default rate {$dperc} %";
        $typ = "r" . $dperc;
    } else {
        $descript = "Use Interest Brackets";
    }
    # Connect to db
    db_connect();
    # Check if setting exists
    $sql = "SELECT label FROM set WHERE label = 'INT_TYPE'";
    $Rslt = db_exec($sql) or errDie("Unable to check database for existing settings.");
    if (pg_numrows($Rslt) > 0) {
        $Sql = "UPDATE set SET value = '{$typ}', descript = '{$descript}' WHERE label = 'INT_TYPE' AND div = '" . USER_DIV . "'";
    } else {
        $Sql = "INSERT INTO set(type, label, value, descript, div) VALUES('Interest Calculation', 'INT_TYPE', '{$typ}', '{$descript}', '" . USER_DIV . "')";
    }
    $setRslt = db_exec($Sql) or errDie("Unable to insert settings to Cubit.");
    core_connect();
    $link = "DELETE FROM salesacc WHERE name = 'SalesInt' AND div = '" . USER_DIV . "';INSERT INTO salesacc(name, accnum, div) VALUES('SalesInt', '{$accid}', '" . USER_DIV . "')";
    $linkRslt = db_exec($link) or errDie("Unable to add Sales Account link to Database.", SELF);
    # status report
    $write = "\n\t\t<table " . TMPL_tblDflts . " width='50%'>\n\t\t\t<tr>\n\t\t\t\t<th>Cubit Settings</th>\n\t\t\t</tr>\n\t\t\t<tr class='datacell'>\n\t\t\t\t<td>Setting have been successfully added to Cubit.</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<p>\n\t\t<tr>\n\t\t<table border='0' cellpadding='2' cellspacing='1'>\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<tr bgcolor='#88BBFF'>\n\t\t\t\t<td><a href='set-view.php'>View Settings</a></td>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
    //	return $write;
    header("Location: calc-int.php");
}
function write($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($typ, "string", 1, 50, "Invalid Interest Calculation selection.");
    # display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "-" . $e["msg"] . "<br>";
        }
        $Errors = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='err' colspan='2'>{$theseErrors}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2'><br></td>\n\t\t\t\t\t</tr>";
        return entererr($accc, $Errors);
    }
    if ($typ == "use") {
        $descript = "Use Cost Centers";
    } else {
        $descript = "Don not Use Cost Centers";
    }
    # Connect to db
    db_connect();
    # Check if setting exists
    $sql = "SELECT label FROM set WHERE label = 'CC_USE'";
    $Rslt = db_exec($sql) or errDie("Unable to check database for existing settings.");
    if (pg_numrows($Rslt) > 0) {
        $Sql = "UPDATE set SET value = '{$typ}', descript = '{$descript}' WHERE label = 'CC_USE' AND div = '" . USER_DIV . "'";
    } else {
        $Sql = "INSERT INTO set(type, label, value, descript, div) VALUES('Cost Center Usage', 'CC_USE', '{$typ}', '{$descript}', '" . USER_DIV . "')";
    }
    $setRslt = db_exec($Sql) or errDie("Unable to insert settings to Cubit.");
    # status report
    $write = "\n\t\t\t\t<table " . TMPL_tblDflts . " width='50%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Cubit Settings</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t<td>Setting has been successfully added to Cubit.</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t<p>\n\t\t\t\t<tr>\n\t\t\t\t<table border=0 cellpadding='2' cellspacing='1'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr bgcolor='#88BBFF'>\n\t\t\t\t\t\t<td><a href='set-view.php'>View Settings</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t</table>";
    return $write;
}
예제 #6
0
function write($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($typ, "string", 1, 50, "Invalid Debtors age type Selection.");
    # display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "-" . $e["msg"] . "<br>";
        }
        $Errors = "<tr><td class=err colspan=2>{$theseErrors}</td></tr>\n\t\t<tr><td colspan=2><br></td></tr>";
        return entererr($accc, $Errors);
    }
    db_conn('cubit');
    $Sl = "DELETE FROM ms WHERE set='statement type'";
    $Ri = db_exec($Sl);
    if ($typ == "sys") {
        $descript = "Use open statement";
        $Sl = "INSERT INTO ms(set,val) VALUES('statement type','open')";
        $Ri = db_exec($Sl);
    } else {
        $descript = "Use running statement";
    }
    # Connect to db
    db_connect();
    # status report
    $write = "\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n\t\t<tr><th>Cubit Settings</th></tr>\n\t\t<tr class=datacell><td>Setting has been successfully saved.</td></tr>\n\t</table>\n\t<p>\n\t<tr>\n\t<table border=0 cellpadding='2' cellspacing='1'>\n\t\t<tr><th>Quick Links</th></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
    return $write;
}
예제 #7
0
function write($_POST)
{
    extract($_POST);
    $aid += 0;
    require_lib("validate");
    $v = new validate();
    $v->isOk($name, "string", 1, 100, "Invalid Team name.");
    $v->isOk($des, "string", 0, 100, "Invalid team description.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return entererr($_POST, $confirm . "</li>");
    }
    $id += 0;
    db_conn('crm');
    $Sl = "SELECT email FROM teams WHERE id='{$id}'";
    $Ry = db_exec($Sl) or errDie("Unable to get team data.");
    if (pg_numrows($Ry) < 1) {
        return "Invalid team.";
    }
    $tdata = pg_fetch_array($Ry);
    $tdata['email'] += 0;
    $Sl = "UPDATE teams SET name='{$name}',des='{$des}',email='{$aid}' WHERE id='{$id}' AND div='" . USER_DIV . "'";
    $Ry = db_exec($Sl) or errDie("Unable to insert team into db.");
    db_conn('cubit');
    $Sl = "UPDATE mail_accounts SET crmteam='{$id}' WHERE account_id='{$aid}'";
    $Ry = db_exec($Sl) or errDie("Unable to update mail account.");
    $Sl = "UPDATE mail_accounts SET crmteam='0' WHERE account_id='{$tdata['email']}'";
    $Ry = db_exec($Sl) or errDie("Unable to update mail account.");
    $out = "\r\n\t\t\t\t<table " . TMPL_tblDflts . " width='50%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Cubit Team Updated</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='datacell'>\r\n\t\t\t\t\t\t<td>Cubit Team <b>{$name}</b>, has been successfully edited in the system.</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>";
    return $out;
}
예제 #8
0
function write($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($whid, "num", 1, 50, "Invalid Warehouse.");
    # display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "-" . $e["msg"] . "<br>";
        }
        $Errors = "<tr><td class='err' colspan='2'>{$theseErrors}</td></tr>\n\t\t<tr><td colspan=2><br></td></tr>";
        return entererr($accc, $Errors);
    }
    # get warehouse name
    db_conn("exten");
    $sql = "SELECT whname,whno FROM warehouses WHERE whid = '{$whid}' AND div = '" . USER_DIV . "'";
    $whRslt = db_exec($sql);
    $wh = pg_fetch_array($whRslt);
    # connect to db
    db_connect();
    # check if setting exists
    $sql = "SELECT label FROM set WHERE label = 'DEF_WH' AND div = '" . USER_DIV . "'";
    $Rslt = db_exec($sql) or errDie("Unable to check database for existing settings.");
    if (pg_numrows($Rslt) > 0) {
        $Sql = "UPDATE set SET value = '{$whid}', type = 'Default Warehouse' WHERE label = 'DEF_WH' AND div = '" . USER_DIV . "'";
    } else {
        $Sql = "\n\t\t\tINSERT INTO set (\n\t\t\t\ttype, label, value, descript, div\n\t\t\t) VALUES (\n\t\t\t\t'Default Warehouse', 'DEF_WH', '{$whid}', '{$wh['whno']}&nbsp;&nbsp;&nbsp;{$wh['whname']}', '" . USER_DIV . "'\n\t\t\t)";
    }
    $setRslt = db_exec($Sql) or errDie("Unable to insert settings to Cubit.");
    # status report
    $write = "\n\t\t<table " . TMPL_tblDflts . " width='50%'>\n\t\t\t<tr>\n\t\t\t\t<th>Cubit Settings</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Setting has been successfully added to Cubit.</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<p>\n\t\t<tr>\n\t\t<table border=0 cellpadding='2' cellspacing='1'>\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
    return $write;
}
예제 #9
0
function write($_POST)
{
    extract($_POST);
    $aid += 0;
    require_lib("validate");
    $v = new validate();
    $v->isOk($name, "string", 1, 100, "Invalid Team name.");
    $v->isOk($des, "string", 0, 100, "Invalid team description.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>{$e['msg']}</li>";
        }
        return entererr($_POST, $confirm . "</li>");
    }
    db_conn('crm');
    $Sl = "INSERT INTO teams (name,des,email,div) VALUES ('{$name}','{$des}','{$aid}','" . USER_DIV . "')";
    $Ry = db_exec($Sl) or errDie("Unable to insert team into db.");
    $teamid = pglib_lastid("teams", "id");
    db_conn('cubit');
    $Sl = "UPDATE mail_accounts SET crmteam='{$teamid}' WHERE account_id='{$aid}'";
    $Ry = db_exec($Sl) or errDie("Unable to update mail account.");
    $out = "\r\n\t\t\t\t<table " . TMPL_tblDflts . " width='50%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Cubit Team added to the system</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='datacell'>\r\n\t\t\t\t\t\t<td>New Cubit Team <b>{$name}</b>, has been successfully added to the system.</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>";
    return $out;
}
function write($_POST)
{
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    // $v->isOk ($typ, "string", 1, 50, "Invalid Vat type Selection.");
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "-" . $e["msg"] . "<br>";
        }
        $Errors = "<tr><td class='err' colspan='2'>{$theseErrors}</td></tr>\n\t\t<tr><td colspan=2><br></td></tr>";
        return entererr($accc, $Errors);
    }
    # Connect to db
    db_connect();
    // ISO-8859-1
    // UTF-8
    // cp1251
    // Windows-1252
    //<td>(RSA) Rand - R</td>
    //<td>(USA) Dollar - $</td>
    //<td>(UK) Pound - &#163</td>
    //<td>(EU) Euro - &#8364</td>
    //<td><input type='text' size='4' name='ocur'></td>
    switch ($cur) {
        case "rand":
            $writecur = "R";
            break;
        case "dollar":
            $writecur = "\$";
            break;
        case "pound":
            $writecur = "&#163";
            break;
        case "euro":
            $writecur = "&#8364";
            break;
        default:
        case "other":
            $writecur = $ocur;
    }
    # Check if setting exists
    $sql = "SELECT constant FROM settings WHERE constant='CURRENCY'";
    $Rslt = db_exec($sql) or errDie("Unable to check database for existing settings.");
    if (pg_numrows($Rslt) > 0) {
        $Sql = "UPDATE settings SET value='{$writecur}' WHERE constant='CURRENCY'";
    } else {
        $Sql = "\n\t\t\tINSERT INTO settings (\n\t\t\t\tconstant, label, value, type, datatype, minlen, maxlen, div\n\t\t\t) VALUES (\n\t\t\t\t'CURRENCY', 'Currency symbol', '{$writecur}', 'accounting', 'allstring', 1, 100, 0\n\t\t\t)";
    }
    $setRslt = db_exec($Sql) or errDie("Unable to insert settings to Cubit.");
    # status report
    $write = "\n\t\t<table " . TMPL_tblDflts . " width='50%'>\n\t\t\t<tr>\n\t\t\t\t<th>Cubit Settings</th>\n\t\t\t</tr>\n\t\t\t<tr class='datacell'>\n\t\t\t\t<td>Setting have been successfully added to Cubit.</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<p>\n\t\t<tr>\n\t\t<table border=0 cellpadding='2' cellspacing='1'>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
    return $write;
}
예제 #11
0
function write($_POST)
{
    extract($_POST);
    require_lib("validate");
    $v = new validate();
    $v->isOk($name, "string", 1, 100, "Invalid category name.");
    $v->isOk($des, "string", 1, 100, "Invalid category description.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>" . $e["msg"];
        }
        return entererr($_POST, $confirm . "</li>");
    }
    $id += 0;
    db_conn('crm');
    $Sl = "UPDATE tcats SET name='{$name}',des='{$des}' WHERE id='{$id}' AND div='" . USER_DIV . "'";
    $Ry = db_exec($Sl) or errDie("Unable to insert cat into db.");
    $out = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t<tr><th>Category updated</th></tr>\r\n\t<tr class=datacell><td>Category <b>{$name}</b>, has been successfully edited in the system.</td></tr>\r\n\t</table>";
    return $out;
}
예제 #12
0
function write($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($linvid, "num", 1, 6, "Invalid Last Invoice nubmer.");
    $v->isOk($lnoteid, "num", 1, 6, "Invalid Last Credit Note Number.");
    $v->isOk($lpurnum, "num", 1, 6, "Invalid Purchase Number.");
    # display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "-" . $e["msg"] . "<br>";
        }
        $Errors = "<tr><td class=err colspan=2>{$theseErrors}</td></tr>\n\t\t<tr><td colspan=2><br></td></tr>";
        return entererr($accc, $Errors);
    }
    # connect to db
    db_connect();
    # change settings
    $rslt = db_exec("DELETE FROM seq WHERE type='inv'");
    if (pg_cmdtuples($rslt) <= 0) {
        return "<li class=err> Error updating sequences for invoice id </li><br>";
    }
    $rslt = db_exec("INSERT INTO seq (type, last_value) VALUES('inv', '{$linvid}')");
    $rslt = db_exec("DELETE FROM seq WHERE type='note'");
    if (pg_cmdtuples($rslt) <= 0) {
        return "<li class=err> Error updating sequences for credit note </li><br>";
    }
    $rslt = db_exec("INSERT INTO seq (type, last_value) VALUES('note', '{$lnoteid}')");
    $rslt = db_exec("DELETE FROM seq WHERE type='pur'");
    if (pg_cmdtuples($rslt) <= 0) {
        return "<li class=err> Error updating sequences for purchase id </li><br>";
    }
    $rslt = db_exec("INSERT INTO seq (type, last_value) VALUES('pur', '{$lpurnum}')");
    # status report
    $write = "\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n\t\t<tr><th>Cubit Settings</th></tr>\n\t\t<tr class=datacell><td>Setting have been successfully added to Cubit.</td></tr>\n\t</table>";
    return $write;
}