function create_dummy($deptid)
{
    db_connect();
    # Dummy Vars
    $cusnum = 0;
    $salespn = "";
    $comm = "";
    $salespn = "";
    $chrgvat = getSetting("SELAMT_VAT");
    $odate = date("Y-m-d");
    $ordno = "";
    $delchrg = "0.00";
    $cordno = "";
    $terms = 0;
    $traddisc = 0;
    $SUBTOT = 0;
    $vat = 0;
    $total = 0;
    $fcid = getDef_fcid();
    $curr = getSymbol($fcid);
    $xrate = getRate($fcid);
    # insert invoice to DB
    $sql = "\n\t\tINSERT INTO invoices (\n\t\t\tdeptid, cusnum, cordno, ordno, chrgvat, fcid, currency, xrate, terms, \n\t\t\ttraddisc, salespn, odate, delchrg, subtot, vat, total, balance, comm, \n\t\t\tusername, location, printed, done, prd, div\n\t\t) VALUES (\n\t\t\t'{$deptid}', '{$cusnum}', '{$cordno}', '{$ordno}', '{$chrgvat}', '{$fcid}', '{$curr['symbol']}', '{$xrate}', '{$terms}', \n\t\t\t'{$traddisc}', '{$salespn}', '{$odate}', '{$delchrg}', '{$SUBTOT}', '{$vat}' , '{$total}', '{$total}', '{$comm}', \n\t\t\t'" . USER_NAME . "', 'int', 'n', 'n', '" . PRD_DB . "', '" . USER_DIV . "'\n\t\t)";
    $rslt = db_exec($sql) or errDie("Unable to insert invoice to Cubit.", SELF);
    # get next ordnum
    $invid = lastinvid();
    return $invid;
}
function create_dummy($deptid)
{
    db_connect();
    # Dummy Vars
    $supid = 0;
    $remarks = "";
    $supaddr = "";
    $terms = "0";
    $total = 0;
    $subtot = 0;
    //	$pdate = date("Y-m-d");
    $ddate = date("Y-m-d");
    $shipchrg = "0.00";
    $fcid = getDef_fcid();
    $curr = "R";
    $xrate = 1;
    $tax = 0;
    $duty = 0;
    $purnum = divlastid("pur", USER_DIV);
    $fcid = getDef_fcid();
    $curr = getSymbol($fcid);
    $xrate = getRate($fcid);
    $trans_date_setting = getCSetting("USE_TRANSACTION_DATE");
    if (isset($trans_date_setting) and $trans_date_setting == "yes") {
        $trans_date_value = getCSetting("TRANSACTION_DATE");
        $date_arr = explode("-", $trans_date_value);
        $date_year = $date_arr[0];
        $date_month = $date_arr[1];
        $date_day = $date_arr[2];
    } else {
        $date_year = date("Y");
        $date_month = date("m");
        $date_day = date("d");
    }
    $pdate = "{$date_year}-{$date_month}-{$date_day}";
    # Insert Order to DB
    $sql = "\n\t\tINSERT INTO purch_int (\n\t\t\tdeptid, supid, supaddr, terms, pdate, ddate, xrate, fcid, curr, tax, \n\t\t\tshipchrg, duty, subtot, total, balance, remarks, received, done, prd, div, \n\t\t\tpurnum\n\t\t) VALUES (\n\t\t\t'{$deptid}', '{$supid}',  '{$supaddr}', '{$terms}', '{$pdate}', '{$ddate}', '{$xrate}', '{$fcid}', '{$curr['symbol']}', '{$tax}', \n\t\t\t'{$shipchrg}', '{$duty}', '{$subtot}', '{$total}', '{$total}', '{$remarks}', 'n', 'n', '" . PRD_DB . "', '" . USER_DIV . "', \n\t\t\t'{$purnum}'\n\t\t)";
    $rslt = db_exec($sql) or errDie("Unable to insert Order to Cubit.", SELF);
    # Get next ordnum
    $purid = pglib_lastid("purch_int", "purid");
    return $purid;
}
function create_dummy($deptid)
{
    db_connect();
    # Dummy Vars
    $cusnum = 0;
    $salespn = "";
    $comm = "";
    $salespn = "";
    $chrgvat = getSetting("SELAMT_VAT");
    //	$odate = date("Y-m-d");
    $ordno = "";
    $delchrg = "0.00";
    $cordno = "";
    $terms = 0;
    $traddisc = 0;
    $SUBTOT = 0;
    $vat = 0;
    $total = 0;
    $branch = 0;
    $del_addr = "";
    $bankid = cust_bank_id($cusnum);
    $trans_date_setting = getCSetting("USE_TRANSACTION_DATE");
    if (isset($trans_date_setting) and $trans_date_setting == "yes") {
        $trans_date_value = getCSetting("TRANSACTION_DATE");
        $date_arr = explode("-", $trans_date_value);
        $date_year = $date_arr[0];
        $date_month = $date_arr[1];
        $date_day = $date_arr[2];
    } else {
        $date_year = date("Y");
        $date_month = date("m");
        $date_day = date("d");
    }
    $odate = "{$date_year}-{$date_month}-{$date_day}";
    //lock(1);
    $fcid = getDef_fcid();
    # Insert invoice to DB
    $sql = "\n\t\tINSERT INTO invoices (\n\t\t\tdeptid, cusnum, cordno, ordno, chrgvat, terms, traddisc, salespn, odate, \n\t\t\tdelchrg, subtot, vat, total, balance, comm, username, printed, done, prd, \n\t\t\tbranch, fcid, del_addr, bankid, div\n\t\t) VALUES (\n\t\t\t'{$deptid}', '{$cusnum}',  '{$cordno}', '{$ordno}', '{$chrgvat}', '{$terms}', '{$traddisc}', '{$salespn}', '{$odate}', \n\t\t\t'{$delchrg}', '{$SUBTOT}', '{$vat}', '{$total}', '{$total}', '{$comm}', '" . USER_NAME . "', 'n', 'n', '" . PRD_DB . "', \n\t\t\t'{$branch}', '{$fcid}', '{$del_addr}', '{$bankid}', '" . USER_DIV . "'\n\t\t)";
    $rslt = db_exec($sql) or errDie("Unable to insert invoice to Cubit.", SELF);
    return lastinvid();
}
function create_dummy($deptid)
{
    db_connect();
    # Dummy Vars
    $cusnum = 0;
    $salespn = "";
    $comm = "";
    $salespn = "";
    $chrgvat = getSetting("SELAMT_VAT");
    $odate = date("Y-m-d");
    $ordno = "";
    $delchrg = "0.00";
    $cordno = "";
    $terms = 0;
    $traddisc = 0;
    $SUBTOT = 0;
    $vat = 0;
    $total = 0;
    $branch = 0;
    $del_addr = "";
    $bankid = cust_bank_id($cusnum);
    //lock(1);
    $fcid = getDef_fcid();
    # Insert invoice to DB
    $sql = "\n\t\tINSERT INTO invoices (\n\t\t\tdeptid, cusnum, cordno, ordno, chrgvat, terms, \n\t\t\ttraddisc, salespn, odate, delchrg, subtot, vat, \n\t\t\ttotal, balance, comm, username, printed, done, \n\t\t\tprd, branch, fcid, del_addr, bankid, div\n\t\t) VALUES (\n\t\t\t'{$deptid}', '{$cusnum}',  '{$cordno}', '{$ordno}', '{$chrgvat}', '{$terms}', \n\t\t\t'{$traddisc}', '{$salespn}', '{$odate}', '{$delchrg}', '{$SUBTOT}', '{$vat}', \n\t\t\t'{$total}', '{$total}', '{$comm}', '" . USER_NAME . "', 'n', 'n', \n\t\t\t'" . PRD_DB . "','{$branch}', '{$fcid}', '{$del_addr}', '{$bankid}', '" . USER_DIV . "'\n\t\t)";
    $rslt = db_exec($sql) or errDie("Unable to insert invoice to Cubit.", SELF);
    return lastinvid();
}