当前位置: 首页>>代码示例>>PHP>>正文


PHP create_dummy函数代码示例

本文整理汇总了PHP中create_dummy函数的典型用法代码示例。如果您正苦于以下问题:PHP create_dummy函数的具体用法?PHP create_dummy怎么用?PHP create_dummy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_dummy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: details

function details($_POST, $error = "")
{
    # Get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($invid)) {
        $v->isOk($invid, "num", 1, 20, "Invalid invoice number.");
    }
    if (isset($deptid)) {
        $v->isOk($deptid, "num", 1, 20, "Invalid department number.");
    }
    if (isset($letters)) {
        $v->isOk($letters, "string", 0, 5, "Invalid First 3 Letters.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>{$e['msg']}</li>";
        }
        $confirm .= "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($deptid)) {
        $deptid = 0;
    } else {
        if (isset($invid)) {
            db_conn("cubit");
            $sql = "UPDATE rec_invoices SET deptid='{$deptid}' WHERE invid='{$invid}' AND deptid<>'{$deptid}'";
            db_exec($sql) or errDie("Error updating invoice department.");
        }
    }
    if (!isset($invid)) {
        $invid = create_dummy($deptid);
        $stkerr = "0,0";
    }
    if (!isset($done)) {
        $done = "";
    }
    if (!isset($stkerr)) {
        $stkerr = "0,0";
    }
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM rec_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li class='err'>Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    # Get department
    db_conn("exten");
    $sql = "SELECT * FROM departments WHERE deptid = '{$inv['deptid']}' AND div = '" . USER_DIV . "'";
    $deptRslt = db_exec($sql);
    if (pg_numrows($deptRslt) < 1) {
        $dept['deptname'] = "<li class='err'>Department not Found.</li>";
    } else {
        $dept = pg_fetch_array($deptRslt);
    }
    # Get selected Customer info
    if (isset($letters)) {
        db_connect();
        $sql = "SELECT * FROM customers WHERE cusnum = '{$inv['cusnum']}' AND div = '" . USER_DIV . "'";
        $custRslt = db_exec($sql) or errDie("Unable to view customer");
        if (pg_numrows($custRslt) < 1) {
            db_connect();
            if ($inv['deptid'] == 0) {
                $searchdept = "";
            } else {
                $searchdept = "deptid = '{$inv['deptid']}' AND ";
            }
            # Query server for customer info
            $sql = "\n\t\t\t\tSELECT * FROM customers \n\t\t\t\tWHERE {$searchdept} location != 'int' AND lower(surname) LIKE lower('{$letters}%') AND blocked != 'yes' AND div = '" . USER_DIV . "' \n\t\t\t\tORDER BY surname";
            $custRslt = db_exec($sql) or errDie("Unable to view customers");
            if (pg_numrows($custRslt) < 1) {
                $ajax_err = "<li class='err'>No customer names starting with <b>{$letters}</b> in database.</li>";
                //return view_err($_POST, $err);
            } else {
                $customers = "<select name='cusnum' onChange='javascript:document.form.submit();'>";
                $customers .= "<option value='-S' selected>Select Customer</option>";
                while ($cust = pg_fetch_array($custRslt)) {
                    $customers .= "<option value='{$cust['cusnum']}'>{$cust['cusname']} {$cust['surname']}</option>";
                }
                $customers .= "</select>";
            }
            # Take care of the unset vars
            $cust['addr1'] = "";
            $cust['cusnum'] = "";
            $cust['vatnum'] = "";
            $cust['accno'] = "";
        } else {
            $cust = pg_fetch_array($custRslt);
            $sql = "SELECT * FROM customers WHERE deptid = '{$inv['deptid']}' AND location != 'int' AND lower(surname) LIKE lower('{$letters}%') AND blocked != 'yes' AND div = '" . USER_DIV . "' ORDER BY surname";
            $cusRslt = db_exec($sql) or errDie("Unable to view customers");
            # Moarn if customer account has been blocked
            if ($cust['blocked'] == 'yes') {
                $error .= "<li class='err'>Error : Selected customer account has been blocked.</li>";
            }
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:rec-invoice-new.php

示例2: details

#
#
#
#
#
#
# get settings
require "settings.php";
require "core-settings.php";
require "libs/ext.lib.php";
# decide what to do
if (isset($_GET["purid"]) && isset($_GET["cont"])) {
    $_GET["done"] = "";
    $OUTPUT = details($_GET);
} elseif (isset($_GET["assid"]) && isset($_GET["grpid"])) {
    $_GET["purid"] = create_dummy(0, $_GET["assid"], $_GET["grpid"]);
    $_GET["done"] = "";
    $OUTPUT = details($_GET);
} else {
    if (isset($_POST["key"])) {
        switch ($_POST["key"]) {
            case "search":
                $OUTPUT = search($_POST);
                break;
            case "update":
                $OUTPUT = write($_POST);
                break;
            default:
                $OUTPUT = details($_GET);
        }
    } else {
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:31,代码来源:nonsa-purchase-new.php

示例3: details

function details($_POST, $error = "")
{
    # Get vars
    extract($_POST);
    $v = new validate();
    if (isset($invid)) {
        $v->isOk($invid, "num", 1, 20, "Invalid invoice number.");
    } else {
        $client = "";
        $vatnum = "";
        $cordno = "";
        $deptid = 2;
        $v->isOk($deptid, "num", 1, 20, "Invalid department number.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    // Initial values
    if (!isset($invid)) {
        $invid = create_dummy($deptid);
        $stkerr = "0,0";
        $cusnum = 0;
    }
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM pinvoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li class='err'>Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    if (!isset($vatnum)) {
        $vatnum = $inv['vatnum'];
    }
    if (!isset($cordno)) {
        $cordno = $inv['cordno'];
    }
    # check if invoice has been printed
    if ($inv['printed'] == "y") {
        $error = "<li class='err'> Error : Invoice number <b>{$invid}</b> has already been printed.";
        $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    // get the ID of the first warehouse
    db_conn("exten");
    $sql = "SELECT whid FROM warehouses ORDER BY whid ASC LIMIT 1";
    $rslt = db_exec($sql) or errDie("Error reading warehouses (FWH).");
    if (pg_num_rows($rslt) > 0) {
        $FIRST_WH = pg_fetch_result($rslt, 0, 0);
    } else {
        $FIRST_WH = "-S";
    }
    # Get selected Customer info
    db_connect();
    $sql = "SELECT * FROM customers WHERE cusnum = '{$inv['cusnum']}' AND location != 'int' AND div = '" . USER_DIV . "'";
    $custRslt = db_exec($sql) or errDie("Unable to view customer");
    if (pg_numrows($custRslt) < 1) {
        db_connect();
        # Query server for customer info   AND lower(surname) LIKE lower('$letters%')
        $sql = "SELECT cusnum,cusname,surname FROM customers WHERE location != 'int' AND blocked != 'yes' AND div = '" . USER_DIV . "' ORDER BY surname";
        $custRslt = db_exec($sql) or errDie("Unable to view customers");
        if (pg_numrows($custRslt) < 1) {
            $customers = "<select name='cusnum' onChange='javascript:document.form.submit();'>";
            $customers .= "<option value='0' selected>Select Customer</option>";
            while ($cust = pg_fetch_array($custRslt)) {
                $customers .= "<option value='{$cust['cusnum']}'>{$cust['cusname']} {$cust['surname']}</option>";
            }
            $customers .= "</select>";
        } else {
            $customers = "<select name='cusnum' onChange='javascript:document.form.submit();'>";
            $customers .= "<option value='0' selected>Select Customer</option>";
            while ($cust = pg_fetch_array($custRslt)) {
                $customers .= "<option value='{$cust['cusnum']}'>{$cust['cusname']} {$cust['surname']}</option>";
            }
            $customers .= "</select>";
        }
        # Take care of the unset vars
        $cust['addr1'] = "";
        $cust['cusnum'] = "";
        $cust['vatnum'] = "";
        $cust['accno'] = "";
        $cust["bustel"] = $inv["telno"];
        $cust["tel"] = "";
        $cust["cellno"] = "";
    } else {
        $cust = pg_fetch_array($custRslt);
        $sql = "SELECT cusnum, cusname, surname FROM customers WHERE deptid = '{$inv['deptid']}' AND location != 'int' AND blocked != 'yes' AND div = '" . USER_DIV . "' ORDER BY surname";
        $cusRslt = db_exec($sql) or errDie("Unable to view customers");
        # Moarn if customer account has been blocked   AND lower(surname) LIKE lower('$letters%')
        if ($cust['blocked'] == 'yes') {
            $error .= "<li class=err>Error : Selected customer account has been blocked.";
        }
        // $customers = "<input type=hidden name=cusnum value='$cust[cusnum]'>$cust[cusname]  $cust[surname]";
        $cusnum = $cust['cusnum'];
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:pos-invoice-new-no-neg.php

示例4: details

function details($_POST, $error = "")
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($purid)) {
        $v->isOk($purid, "num", 1, 20, "Invalid Non-Stock Order number.");
    } else {
        $v->isOk($supid, "num", 1, 20, "Invalid Supplier number.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm = $error . slct();
        return $confirm;
    }
    if (!isset($purid)) {
        $purid = create_dummy(0, $supid);
    }
    # Get Order info
    db_connect();
    $sql = "SELECT * FROM nons_purch_int WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
    $purRslt = db_exec($sql) or errDie("Unable to get Order information");
    if (pg_numrows($purRslt) < 1) {
        return "<li class='err'>purchase Not Found</li>";
    }
    $pur = pg_fetch_array($purRslt);
    # check if Order has been printed
    if ($pur['received'] == "y") {
        $error = "<li class='err'> Error : Order number <b>{$purid}</b> has already been received.</li>";
        $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    if ($pur['xrate'] == 0) {
        $pur['xrate'] = 1;
    }
    # Get selected supplier info
    db_connect();
    $sql = "SELECT * FROM suppliers WHERE supid = '{$pur['supid']}' AND div = '" . USER_DIV . "'";
    $supRslt = db_exec($sql) or errDie("Unable to view Supplier");
    if (pg_numrows($supRslt) < 1) {
        db_connect();
        # Query server for supplier info
        $sql = "SELECT * FROM suppliers WHERE location = 'int' AND div = '" . USER_DIV . "' ORDER BY supname ASC";
        $supRslt = db_exec($sql) or errDie("Unable to view suppliers");
        if (pg_numrows($supRslt) < 1) {
            $err = "<li class='err'>No Supplier found in database.</li>";
            return view_err($_POST, $err);
        } else {
            $suppliers = "<select name='supid' onChange='javascript:document.form.submit();'>";
            $suppliers .= "<option value='-S' selected>Select Supplier</option>";
            while ($sup = pg_fetch_array($supRslt)) {
                $suppliers .= "<option value='{$sup['supid']}'>{$sup['supname']}</option>";
            }
            $suppliers .= "</select>";
        }
        # take care of the uset vars
        $supaddr = "";
        $accno = "";
        $fcid = $pur['fcid'];
    } else {
        db_connect();
        # Query server for supplier info
        $sql = "SELECT * FROM suppliers WHERE location = 'int' AND div = '" . USER_DIV . "' ORDER BY supname ASC";
        $supRslt = db_exec($sql) or errDie("Unable to view suppliers");
        if (pg_numrows($supRslt) < 1) {
            $err = "<li class='err'>No Supplier found in database.</li>";
            return view_err($_POST, $err);
        } else {
            $supid = $pur['supid'];
            $suppliers = "<select name='supid' onChange='javascript:document.form.submit();'>";
            $sel = "";
            $fcid = $pur['fcid'];
            while ($sup = pg_fetch_array($supRslt)) {
                if ($sup['supid'] == $supid) {
                    $sel = "selected";
                    $supaddr = "{$sup['supaddr']}";
                    $accno = $sup['supno'];
                    $fcid = $sup['fcid'];
                    $listid = $sup['listid'];
                } else {
                    $sel = "";
                    $supaddr = "";
                    $accno = "";
                }
                $suppliers .= "<option value='{$sup['supid']}' {$sel}>{$sup['supname']}</option>";
            }
            $suppliers .= "</select>";
        }
    }
    $currs = getSymbol($fcid);
    $curr = $currs['symbol'];
    $currsel = "{$currs['symbol']} - {$currs['descrip']}";
    if (!isset($ordernum)) {
        $ordernum = '';
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:nons-purch-int-new.php

示例5: details

function details($_POST, $error = "")
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($invid)) {
        $v->isOk($invid, "num", 1, 20, "Invalid invoice number.");
    } else {
        $client = "";
        $v->isOk($deptid, "num", 1, 20, "Invalid department number.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class=err>" . $e["msg"];
        }
        $confirm .= "{$error}<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($invid)) {
        $invid = create_dummy($deptid);
        $stkerr = "0,0";
    }
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM pinvoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li class=err>Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    $client = $inv['cusname'];
    # check if invoice has been printed
    if ($inv['printed'] == "y") {
        $error = "<li class=err> Error : Invoice number <b>{$invid}</b> has already been printed.";
        $error .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    # get department
    db_conn("exten");
    $sql = "SELECT * FROM departments WHERE deptid = '{$inv['deptid']}' AND div = '" . USER_DIV . "'";
    $deptRslt = db_exec($sql);
    if (pg_numrows($deptRslt) < 1) {
        $dept['deptname'] = "<li class=err>Department not Found.";
    } else {
        $dept = pg_fetch_array($deptRslt);
    }
    /* --- Start Drop Downs --- */
    # Select warehouse
    db_conn("exten");
    $whs = "<select name='whidss[]' onChange='javascript:document.form.submit();'>";
    $sql = "SELECT * FROM warehouses WHERE div = '" . USER_DIV . "' ORDER BY whname ASC";
    $whRslt = db_exec($sql);
    if (pg_numrows($whRslt) < 1) {
        return "<li class=err> There are no Stores found in Cubit.";
    } else {
        $whs .= "<option value='-S' disabled selected>Select Store</option>";
        while ($wh = pg_fetch_array($whRslt)) {
            $whs .= "<option value='{$wh['whid']}'>({$wh['whno']}) {$wh['whname']}</option>";
        }
    }
    $whs .= "</select>";
    # get sales people
    db_conn("exten");
    $sql = "SELECT * FROM salespeople WHERE div = '" . USER_DIV . "' ORDER BY salesp ASC";
    $salespRslt = db_exec($sql) or errDie("Unable to get sales people.");
    if (pg_numrows($salespRslt) < 1) {
        return "<li class=err> There are no Sales People found in Cubit.";
    } else {
        $salesps = "<select name='salespn'>";
        while ($salesp = pg_fetch_array($salespRslt)) {
            if ($salesp['salesp'] == $inv['salespn']) {
                $sel = "selected";
            } else {
                $sel = "";
            }
            $salesps .= "<option value='{$salesp['salesp']}' {$sel}>{$salesp['salesp']}</option>";
        }
        $salesps .= "</select>";
    }
    # keep the charge vat option stable
    if ($inv['chrgvat'] == "yes") {
        $chy = "checked=yes";
        $chn = "";
    } else {
        $chy = "";
        $chn = "checked=yes";
    }
    # format date
    list($oyear, $omon, $oday) = explode("-", $inv['odate']);
    /* --- End Drop Downs --- */
    /* --- Start Products Display --- */
    # select all products
    $products = "\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=100%>\n\t<tr><th>STORE</th><th>ITEM NUMBER</th><th>DESCRIPTION</th><th>QTY</th><th>UNIT PRICE</th><th>UNIT DISCOUNT</th><th>AMOUNT</th><th>Remove</th><tr>";
    # get selected stock in this invoice
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:pos-invoice-edit.php

示例6: details

function details($_POST, $error = "")
{
    # Get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($invid)) {
        $v->isOk($invid, "num", 1, 20, "Invalid invoice number.");
    } else {
        $v->isOk($deptid, "num", 1, 20, "Invalid department number.");
        $v->isOk($letters, "string", 0, 5, "Invalid First 3 Letters.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (isset($deptid)) {
        db_connect();
        # Query server for customer info
        $sql = "SELECT cusnum,cusname,surname FROM customers WHERE deptid = '{$deptid}' AND location = 'int' AND lower(surname) LIKE lower('{$letters}%') AND blocked != 'yes' AND div = '" . USER_DIV . "' ORDER BY surname";
        $custRslt = db_exec($sql) or errDie("Unable to view customers");
        if (pg_numrows($custRslt) < 1) {
            $err = "<li class='err'>No customer names starting with <b>{$letters}</b> in database.</li>";
            return view_err($_POST, $err);
        }
    }
    if (!isset($invid)) {
        $invid = create_dummy($deptid);
        $stkerr = "0,0";
    }
    if (!isset($done)) {
        $done = "";
    }
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li class='err'>Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    # Check if invoice has been printed
    if ($inv['printed'] == "y") {
        $error = "<li class='err'> Error : Invoice number <b>{$invid}</b> has already been printed.</li>";
        $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    $currs = getSymbol($inv['fcid']);
    # Get department
    db_conn("exten");
    $sql = "SELECT * FROM departments WHERE deptid = '{$inv['deptid']}' AND div = '" . USER_DIV . "'";
    $deptRslt = db_exec($sql);
    if (pg_numrows($deptRslt) < 1) {
        $dept['deptname'] = "<li class='err'>Department not Found.</li>";
    } else {
        $dept = pg_fetch_array($deptRslt);
    }
    # Get selected Customer info
    db_connect();
    $sql = "SELECT * FROM customers WHERE cusnum = '{$inv['cusnum']}'  AND location = 'int' AND div = '" . USER_DIV . "'";
    $custRslt = db_exec($sql) or errDie("Unable to view customer");
    if (pg_numrows($custRslt) < 1) {
        db_connect();
        # Query server for customer info
        $sql = "SELECT cusnum,cusname,surname FROM customers WHERE deptid = '{$inv['deptid']}' AND location = 'int' AND lower(surname) LIKE lower('{$letters}%') AND blocked != 'yes' AND div = '" . USER_DIV . "' ORDER BY surname";
        $custRslt = db_exec($sql) or errDie("Unable to view customers");
        if (pg_numrows($custRslt) < 1) {
            $err = "<li class='err'>No customer names starting with <b>{$letters}</b> in database.</li>";
            return view_err($_POST, $err);
        } else {
            $customers = "<select name='cusnum' onChange='javascript:document.form.submit();'>";
            $customers .= "<option value='-S' selected>Select Customer</option>";
            while ($cust = pg_fetch_array($custRslt)) {
                $customers .= "<option value='{$cust['cusnum']}'>{$cust['cusname']} {$cust['surname']}</option>";
            }
            $customers .= "</select>";
        }
        # Take care of the unset vars
        $cust['addr1'] = "";
        $cust['cusnum'] = "";
        $cust['vatnum'] = "";
        $cust['accno'] = "";
    } else {
        $cust = pg_fetch_array($custRslt);
        $sql = "SELECT cusnum, cusname, surname FROM customers WHERE deptid = '{$inv['deptid']}' AND location = 'int' AND lower(surname) LIKE lower('{$letters}%') AND blocked != 'yes' AND div = '" . USER_DIV . "' ORDER BY surname";
        $cusRslt = db_exec($sql) or errDie("Unable to view customers");
        # Moarn if customer account has been blocked
        if ($cust['blocked'] == 'yes') {
            $error .= "<li class='err'>Error : Selected customer account has been blocked.";
        }
        // $customers = "<input type=hidden name=cusnum value='$cust[cusnum]'>$cust[cusname]  $cust[surname]";
        $cusnum = $cust['cusnum'];
        $customers = "<select name='cusnum' onChange='javascript:document.form.submit();'>";
        // $customers .= "<option value='-S' selected>Select Customer</option>";
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:intinvoice-new.php

示例7: details

function details($_POST, $error = "")
{
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($invid)) {
        $v->isOk($invid, "num", 1, 20, "Invalid Non-Stock Invoice number.");
    } elseif (isset($cusnum)) {
        $v->isOk($cusnum, "num", 1, 20, "Invalid Customer number.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return slct($error);
        $confirm = "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($invid)) {
        $invid = create_dummy(0, $cusnum);
    }
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM nons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li class='err'>Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    # check if invoice has been printed
    if ($inv['done'] == "y") {
        $error = "<li class='err'> Error : invoice number <b>{$invid}</b> has already been printed</li>.";
        $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    $currs = getSymbol($inv['fcid']);
    /* --- Start Drop Downs --- */
    # format date
    list($s_year, $s_month, $s_day) = explode("-", $inv['sdate']);
    # keep the charge vat option stable
    if ($inv['chrgvat'] == "yes") {
        $chy = "checked=yes";
        $chn = "";
        $chnone = "";
    } elseif ($inv['chrgvat'] == "no") {
        $chy = "";
        $chn = "checked=yes";
        $chnone = "";
    } else {
        $chy = "";
        $chn = "";
        $chnone = "checked=yes";
    }
    /* --- End Drop Downs --- */
    /* --- Start Products Display --- */
    # Select all products
    $products = "\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\n\t\t\t\t<th>DESCRIPTION</th>\n\t\t\t\t<th>QTY</th>\n\t\t\t\t<th colspan='2'>UNIT PRICE</th>\n\t\t\t\t<th>AMOUNT</th>\n\t\t\t\t<th>VAT Code</th>\n\t\t\t\t<th>Remove</th>\n\t\t\t<tr>";
    # get selected stock in this purchase
    db_connect();
    $sql = "SELECT * FROM nons_inv_items  WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $stkdRslt = db_exec($sql);
    $i = 0;
    while ($stkd = pg_fetch_array($stkdRslt)) {
        # keep track of selected stock amounts
        $amts[$i] = $stkd['amt'];
        $stkd['amt'] = round($stkd['amt'], 2);
        $chk = "";
        if ($stkd['vatex'] == 'y') {
            $chk = "checked=yes";
        }
        db_conn('cubit');
        $Sl = "SELECT * FROM vatcodes ORDER BY code";
        $Ri = db_exec($Sl);
        $vats = "<select name='vatcodes[]'>";
        while ($vd = pg_fetch_array($Ri)) {
            if ($stkd['vatex'] == $vd['id']) {
                $sel = "selected";
            } else {
                $sel = "";
            }
            $vats .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
        }
        $vats .= "</option>";
        $stkd['amt'] = sprint($stkd['amt']);
        # put in product
        $products .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'><input type='text' size='50' name='des[]' value='{$stkd['description']}'></td>\n\t\t\t\t<td align='center'><input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'></td>\n\t\t\t\t<td align='center'> " . CUR . " <input type='text' size='8' name='cunitcost[]' value='{$stkd['cunitcost']}'></td>\n\t\t\t\t<td align='center'> {$inv['currency']} <input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'></td>\n\t\t\t\t<td><input type='hidden' name='amt[]' value='{$stkd['amt']}'> {$inv['currency']} {$stkd['amt']}</td>\n\t\t\t\t<td align='center'>{$vats}</td>\n\t\t\t\t<td align='center'><input type='checkbox' name='remprod[]' value='{$i}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t</tr>";
        $i++;
    }
    # Look above(remprod keys)
    $keyy = $i;
    # look above(if i = 0 then there are no products)
    if ($i == 0) {
        $done = "";
    }
    if ($i == 0 || isset($diffwhBtn)) {
        db_conn('cubit');
        $Sl = "SELECT * FROM vatcodes ORDER BY code";
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:nons-intinvoice-new.php

示例8: details

function details($_POST, $error = "")
{
    extract($_POST);
    # validate input
    include "libs/validate.lib.php";
    $v = new validate();
    if (isset($quoid)) {
        $v->isOk($quoid, "num", 1, 20, "Invalid quote number.");
    }
    if (isset($deptid)) {
        $v->isOk($deptid, "num", 1, 20, "Invalid department number.");
    }
    if (isset($letters)) {
        $v->isOk($letters, "string", 0, 5, "Invalid First 3 Letters.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>{$e['msg']}</li>";
        }
        $confirm .= "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($deptid)) {
        $deptid = 0;
    } else {
        if (isset($quoid)) {
            db_conn("cubit");
            $sql = "UPDATE quotes SET deptid='{$deptid}' WHERE quoid='{$quoid}' AND deptid<>'{$deptid}'";
            db_exec($sql) or errDie("Error updating invoice department.");
        }
    }
    if (!isset($quoid)) {
        $quoid = create_dummy($deptid);
    }
    if (!isset($stkerr)) {
        $stkerr = "0,0";
    }
    if (!isset($done)) {
        $done = "";
    }
    if (!isset($sel_frm)) {
        $sel_frm = "stkcod";
    }
    # Get quote info
    db_connect();
    $sql = "SELECT * FROM quotes WHERE quoid = '{$quoid}' AND div = '" . USER_DIV . "'";
    $quoRslt = db_exec($sql) or errDie("Unable to get quote information");
    if (pg_numrows($quoRslt) < 1) {
        return "<li class='err'>Quote Not Found</li>";
    }
    $quo = pg_fetch_array($quoRslt);
    # check if quote has been printed
    if ($quo['accepted'] == "y") {
        $error = "<li class='err'> Error : Quote number <b>{$quoid}</b> has already been printed.</li>";
        $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    if (!isset($lead)) {
        $lead = $quo["lead"];
    }
    //manual error handling
    if (!isset($quo['ncdate'])) {
        $quo['ncdate'] = "";
    }
    if (strlen($quo['ncdate']) < 1) {
        $ncdate_year = date("Y");
        $ncdate_month = date("m", mktime(0, 0, 0, date("m"), date("d") + 5, date("Y")));
        $ncdate_day = date("d", mktime(0, 0, 0, date("m"), date("d") + 5, date("Y")));
    } else {
        $darr = explode("-", $quo['ncdate']);
        $ncdate_year = $darr['0'];
        $ncdate_month = $darr['1'];
        $ncdate_day = $darr['2'];
    }
    # get department
    db_conn("exten");
    $sql = "SELECT * FROM departments WHERE deptid = '{$quo['deptid']}' AND div = '" . USER_DIV . "'";
    $deptRslt = db_exec($sql);
    if (pg_numrows($deptRslt) < 1) {
        $dept['deptname'] = "<li class='err'>Department not Found.</li>";
    } else {
        $dept = pg_fetch_array($deptRslt);
    }
    # Get selected customer info
    if (isset($letters)) {
        db_connect();
        $sql = "SELECT * FROM customers WHERE cusnum = '{$quo['cusnum']}' AND div = '" . USER_DIV . "'";
        $custRslt = db_exec($sql) or errDie("Unable to view customer");
        if (pg_numrows($custRslt) < 1) {
            db_connect();
            if ($inv['deptid'] == 0) {
                $searchdept = "";
            } else {
                $searchdept = "deptid = '{$quo['deptid']}' AND ";
            }
            # Query server for customer info
            $sql = "SELECT cusnum,cusname,surname FROM customers WHERE {$searchdept} location != 'int' AND lower(surname) LIKE lower('{$letters}%') AND div = '" . USER_DIV . "' ORDER BY surname";
            $custRslt = db_exec($sql) or errDie("Unable to view customers");
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:quote-new.php

示例9: details

function details($_POST, $error = "")
{
    # Get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    if (!isset($button) && isset($starting)) {
        return slct();
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($invid)) {
        $v->isOk($invid, "num", 1, 20, "Invalid Non-Stock Invoice number.");
    } elseif (isset($ctyp)) {
        $val = $ctyp . "val";
        if (isset(${$val})) {
            $tval = ${$val};
            $v->isOk($tval, "num", 1, 20, "Invalid Selection.");
        }
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class=err>" . $e["msg"];
        }
        return slct($error);
        $confirm = "{$error}<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($invid) && isset($ctyp)) {
        $val = $ctyp . "val";
        if (!isset(${$val})) {
            ${$val} = "";
        }
        $tval = ${$val};
        if (isset($bankid)) {
            $bankid += 0;
            $acc = $bankid;
        } else {
            $acc = 0;
        }
        $invid = create_dummy(0, $ctyp, $tval, $acc);
    }
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM nons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li class=err>Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    # check if invoice has been printed
    if ($inv['done'] == "y") {
        $error = "<li class=err> Error : invoice number <b>{$invid}</b> has already been printed.";
        $error .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    /* --- Start Drop Downs --- */
    # format date
    list($ninv_year, $ninv_month, $ninv_day) = explode("-", $inv['odate']);
    # keep the charge vat option stable
    if ($inv['chrgvat'] == "yes") {
        $chy = "checked=yes";
        $chn = "";
        $chnone = "";
    } elseif ($inv['chrgvat'] == "no") {
        $chy = "";
        $chn = "checked=yes";
        $chnone = "";
    } else {
        $chy = "";
        $chn = "";
        $chnone = "checked=yes";
    }
    # Days drop downs
    $days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
    $termssel = extlib_cpsel("terms", $days, $inv['terms']);
    /* --- End Drop Downs --- */
    /* --- Start Products Display --- */
    # Select all products
    $products = "\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=100%>\r\n\t<tr>\r\n\t\t<th>DESCRIPTION</th>\r\n\t\t<th>QTY</th>\r\n\t\t<th>AMOUNT</th>\r\n\t\t<th>VAT Code</th>\r\n\t\t<th>Remove</th>\r\n\t<tr>";
    # get selected stock in this purchase
    db_connect();
    $sql = "SELECT * FROM nons_inv_items  WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $stkdRslt = db_exec($sql);
    $i = 0;
    while ($stkd = pg_fetch_array($stkdRslt)) {
        # keep track of selected stock amounts
        $amts[$i] = $stkd['amt'];
        $stkd['amt'] = round($stkd['amt'], 2);
        $chk = "";
        if ($stkd['vatex'] == 'y') {
            $chk = "checked=yes";
        }
        db_conn('cubit');
        $Sl = "SELECT * FROM vatcodes ORDER BY code";
        $Ri = db_exec($Sl);
        $vats = "<select name=vatcodes[]>";
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:hireserv-invoice-new.php

示例10: search

function search($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($purnum, "string", 1, 20, "Invalid Purchase number.");
    # display errors, if any
    $error = "";
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class=err>" . $e["msg"];
        }
        return slct($_POST, $error);
    }
    $purs = explode(",", $purnum);
    foreach ($purs as $pur) {
        print $pur . "<br>";
    }
    # Send search squad
    db_connect();
    $sql = "SELECT * FROM purchases WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
    $srchRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
    if (pg_numrows($srchRslt) > 0) {
        $purid = create_dummy(0, $purnum, 'loc', 'cubit');
        $send['purid'] = $purid;
        return details($send);
    }
    $sql = "SELECT * FROM purch_int WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
    $srchRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
    if (pg_numrows($srchRslt) > 0) {
        $purid = create_dummy(0, $purnum, 'int', 'cubit');
        $send['purid'] = $purid;
        return details($send);
    }
    $sql = "SELECT * FROM movpurch WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
    $srchRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
    if (pg_numrows($srchRslt) > 0) {
        $res = pg_fetch_array($srchRslt);
        $purid = create_dummy(0, $purnum, $res['purtype'], $res['prd']);
        $send['purid'] = $purid;
        return details($send);
    }
    return slct($_POST, "<li class=err> - Purchase No. {$purnum} not found.");
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:49,代码来源:lnons-purch-new-b.php

示例11: details

function details($_POST, $error = "")
{
    # Get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($invid)) {
        $v->isOk($invid, "num", 1, 20, "Invalid invoice number.");
    } else {
        $client = "";
        $deptid = 2;
        $v->isOk($deptid, "num", 1, 20, "Invalid department number.");
    }
    $fil = "";
    if (!isset($fcode)) {
        $fcode = "";
    }
    if (!isset($fdes)) {
        $fdes = "";
    }
    if ($fcode != "") {
        $fil .= "AND lower(stkcod) LIKE lower('%{$fcode}%')";
    }
    if ($fdes != "") {
        $fil .= "AND lower(stkdes) LIKE lower('%{$fdes}%')";
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($invid)) {
        $invid = create_dummy($deptid);
        $stkerr = "0,0";
    }
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM pinvoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li class='err'>Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    if (!isset($pass)) {
        $pass = "";
    } else {
        $pass = remval($pass);
        db_conn('cubit');
        $Sl = "SELECT * FROM users WHERE password=md5('{$pass}') AND abo=1000";
        $Ri = db_exec($Sl);
        if (pg_num_rows($Ri) > 0) {
            $ped = true;
        } else {
            $ped = false;
        }
    }
    # check if invoice has been printed
    if ($inv['printed'] == "y") {
        $error = "<li class=err> Error : Invoice number <b>{$invid}</b> has already been printed.";
        $error .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    # Get selected Customer info
    db_connect();
    $sql = "SELECT * FROM customers WHERE cusnum = '{$inv['cusnum']}' AND location != 'int' AND div = '" . USER_DIV . "'";
    $custRslt = db_exec($sql) or errDie("Unable to view customer");
    if (pg_numrows($custRslt) < 1) {
        db_connect();
        # Query server for customer info   AND lower(surname) LIKE lower('$letters%')
        $sql = "SELECT cusnum,cusname,surname FROM customers WHERE location != 'int' AND blocked != 'yes' AND div = '" . USER_DIV . "' ORDER BY surname";
        $custRslt = db_exec($sql) or errDie("Unable to view customers");
        if (pg_numrows($custRslt) < 1) {
            $customers = "<select name='cusnum' onChange='javascript:document.form.submit();'>";
            $customers .= "<option value='0' selected>Select Customer</option>";
            while ($cust = pg_fetch_array($custRslt)) {
                $customers .= "<option value='{$cust['cusnum']}'>{$cust['cusname']} {$cust['surname']}</option>";
            }
            $customers .= "</select>";
        } else {
            $customers = "<select name='cusnum' onChange='javascript:document.form.submit();'>";
            $customers .= "<option value='0' selected>Select Customer</option>";
            while ($cust = pg_fetch_array($custRslt)) {
                $customers .= "<option value='{$cust['cusnum']}'>{$cust['cusname']} {$cust['surname']}</option>";
            }
            $customers .= "</select>";
        }
        # Take care of the unset vars
        $cust['addr1'] = "";
        $cust['cusnum'] = "";
        $cust['vatnum'] = "";
        $cust['accno'] = "";
    } else {
        $cust = pg_fetch_array($custRslt);
        $sql = "SELECT cusnum, cusname, surname FROM customers WHERE deptid = '{$inv['deptid']}' AND location != 'int' AND blocked != 'yes' AND div = '" . USER_DIV . "' ORDER BY surname";
        $cusRslt = db_exec($sql) or errDie("Unable to view customers");
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:pos-invoice-speed.php

示例12: details

function details($_POST, $error = "")
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($purid)) {
        $v->isOk($purid, "num", 1, 20, "Invalid Non-Stock Order number.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class=err>" . $e["msg"];
        }
        $confirm .= "{$error}<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($purid)) {
        $purid = create_dummy(0);
    }
    # Get Order info
    db_connect();
    $sql = "SELECT * FROM nons_purchases WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
    $purRslt = db_exec($sql) or errDie("Unable to get Order information");
    if (pg_numrows($purRslt) < 1) {
        return "<li class=err>purchase Not Found</li>";
    }
    $pur = pg_fetch_array($purRslt);
    # check if Order has been printed
    if ($pur['received'] == "y") {
        $error = "<li class=err> Error : Order number <b>{$purid}</b> has already been received.";
        $error .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    if (!isset($ordernum)) {
        $ordernum = '';
    }
    /* --- Start Drop Downs --- */
    # days drop downs
    $days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
    $termssel = extlib_cpsel("terms", $days, $pur['terms']);
    # format date
    list($pyear, $pmon, $pday) = explode("-", $pur['pdate']);
    # keep the charge vat option stable
    if ($pur['vatinc'] == "yes") {
        $chy = "checked=yes";
        $chn = "";
        $chnv = "";
    } else {
        if ($pur['vatinc'] == 'novat') {
            $chy = "";
            $chn = "";
            $chnv = "checked=yes";
        } else {
            $chy = "";
            $chn = "checked=yes";
            $chnv = "";
        }
    }
    /* --- End Drop Downs --- */
    /* --- Start Products Display --- */
    # Select all products
    $products = "\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=100%>\r\n\t<tr><th>ITEM NUMBER</th><th>DESCRIPTION</th><th>QTY</th><th>UNIT PRICE</th><th>DELIVERY DATE</th><th>AMOUNT</th><th>VAT</th><th>Remove</th><tr>";
    # get selected stock in this Order
    db_connect();
    $sql = "SELECT * FROM nons_pur_items  WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
    $stkdRslt = db_exec($sql);
    $i = 0;
    $key = 0;
    while ($stkd = pg_fetch_array($stkdRslt)) {
        # keep track of selected stock amounts
        $amts[$i] = $stkd['amt'];
        $i++;
        list($syear, $smon, $sday) = explode("-", $stkd['ddate']);
        $stkd['amt'] = round($stkd['amt'], 2);
        $tip = "&nbsp;&nbsp;&nbsp;";
        if (isset($vatc[$key])) {
            $tip = "<font color=red>#</font>";
            $error = "<div class=err> {$tip}&nbsp;&nbsp;=&nbsp;&nbsp; Vat amount is different from amount calculated by cubit. To allow cubit to recalculate the vat amount, please delete the vat amount from the input box.";
        }
        # put in product
        $products .= "<tr class='bg-odd'><td align=center><input type=text size=10 name=cod[] value='{$stkd['cod']}'></td><td align=center><input type=text size=20 name=des[] value='{$stkd['des']}'></td><td align=center><input type=text size=3 name=qtys[] value='{$stkd['qty']}'></td><td align=center><input type=text size=8 name=unitcost[] value='{$stkd['unitcost']}'></td><td align=center><input type=text size=2 name=dday[] maxlength=2 value='{$sday}'>-<input type=text size=2 name=dmon[] maxlength=2 value='{$smon}'>-<input type=text size=4 name=dyear[] maxlength=4 value='{$syear}'></td><td><input type=hidden name=amt[] value='{$stkd['amt']}'> " . CUR . " {$stkd['amt']}</td><td>{$tip} <input type=text name=vat[] size=9 value='{$stkd['svat']}'></td><td><input type=checkbox name=remprod[] value='{$key}'><input type=hidden name=SCROLL value=yes></td></tr>";
        $key++;
    }
    # Look above(remprod keys)
    $keyy = $key;
    # look above(if i = 0 then there are no products)
    if ($i == 0) {
        $done = "";
        list($year, $mon, $day) = explode("-", date("Y-m-d"));
        # add one
        $products .= "<tr class='bg-odd'><td align=center><input type=text size=10 name=cod[] value=''></td><td align=center><input type=text size=20 name=des[] value=''></td><td align=center><input type=text size=3 name=qtys[] value='1'></td><td align=center><input type=text size=8 name=unitcost[]></td><td align=center><input type=text size=2 name=dday[] maxlength=2 value='{$day}'>-<input type=text size=2 name=dmon[] maxlength=2 value='{$mon}'>-<input type=text size=4 name=dyear[] maxlength=4 value='{$year}'></td><td>" . CUR . " 0.00</td><td><input type=hidden name=novat[] value='1'></td><td> </td></tr>";
    }
    /* -- start Listeners -- */
    if (isset($diffwhBtn)) {
        list($year, $mon, $day) = explode("-", date("Y-m-d"));
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:nons-purchase-new-back.php

示例13: details

function details($_POST, $error = "")
{
    # Get vars
    extract($_POST);
    if (!isset($button) && isset($starting)) {
        return slct();
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($invid)) {
        $v->isOk($invid, "num", 1, 20, "Invalid Non-Stock Invoice number.");
    } elseif (isset($ctyp)) {
        $val = $ctyp . "val";
        if (isset(${$val})) {
            $tval = ${$val};
            $v->isOk($tval, "num", 1, 20, "Invalid Selection.");
        }
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return slct($error);
        $confirm = "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($invid) && isset($ctyp)) {
        $val = $ctyp . "val";
        if (!isset(${$val})) {
            ${$val} = "";
        }
        $tval = ${$val};
        if (isset($bankid)) {
            $bankid += 0;
            $acc = $bankid;
        } else {
            $acc = 0;
        }
        // Retrieve default comments
        db_conn("cubit");
        $sql = "SELECT value FROM settings WHERE constant='DEFAULT_COMMENTS'";
        $commRslt = db_exec($sql) or errDie("Unable to retrieve default comments from Cubit.");
        $comment = base64_decode(pg_fetch_result($commRslt, 0));
        $invid = create_dummy(0, $ctyp, $tval, $acc, $comment);
    }
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM rnons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li class='err'>Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    /* --- Start Drop Downs --- */
    # format date
    list($rinv_year, $rinv_month, $rinv_day) = explode("-", $inv['sdate']);
    # keep the charge vat option stable
    if ($inv['chrgvat'] == "yes") {
        $chy = "checked=yes";
        $chn = "";
        $chnone = "";
    } elseif ($inv['chrgvat'] == "no") {
        $chy = "";
        $chn = "checked=yes";
        $chnone = "";
    } else {
        $chy = "";
        $chn = "";
        $chnone = "checked=yes";
    }
    # Days drop downs
    $days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
    $termssel = extlib_cpsel("terms", $days, $inv['terms']);
    /* --- End Drop Downs --- */
    /* --- Start Products Display --- */
    # Select all products
    $products = "\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\n\t\t\t\t<th>DESCRIPTION</th>\n\t\t\t\t<th>QTY</th>\n\t\t\t\t<th>UNIT PRICE</th>\n\t\t\t\t<th>AMOUNT</th>\n\t\t\t\t<th>Account</th>\n\t\t\t\t<th>VAT Code</th>\n\t\t\t\t<th>Remove</th>\n\t\t\t<tr>";
    # get selected stock in this purchase
    db_connect();
    $sql = "SELECT * FROM rnons_inv_items  WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $stkdRslt = db_exec($sql);
    $i = 0;
    while ($stkd = pg_fetch_array($stkdRslt)) {
        # keep track of selected stock amounts
        $amts[$i] = $stkd['amt'];
        $stkd['amt'] = round($stkd['amt'], 2);
        $chk = "";
        if ($stkd['vatex'] == 'y') {
            $chk = "checked=yes";
        }
        db_conn('cubit');
        $Sl = "SELECT * FROM vatcodes ORDER BY code";
        $Ri = db_exec($Sl);
        $vats = "<select name='vatcodes[]'>";
        while ($vd = pg_fetch_array($Ri)) {
            if ($stkd['vatex'] == $vd['id']) {
                $sel = "selected";
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:rec-nons-invoice-new.php

示例14: details

function details($_POST, $error = "")
{
    # Get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($purid)) {
        $v->isOk($purid, "num", 1, 20, "Invalid Order number.");
    } else {
        $v->isOk($deptid, "num", 1, 20, "Invalid department number.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($purid)) {
        $purid = create_dummy($deptid);
    }
    # Get purchase info
    db_connect();
    $sql = "SELECT * FROM purchases WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
    $purRslt = db_exec($sql) or errDie("Unable to get purchase information");
    if (pg_numrows($purRslt) < 1) {
        return "<li class='err'>Order Not Found</li>";
    }
    $pur = pg_fetch_array($purRslt);
    $deptid = $pur['deptid'];
    # check if purchase has been printed
    if ($pur['received'] == "y") {
        $error = "<li class='err'> Error : Order no. {$pur['purnum']} has already been received.</li>";
        $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    if (!isset($ordernum)) {
        $ordernum = '';
    }
    if (!isset($supinv)) {
        $supinv = '';
    }
    # get department
    db_conn("exten");
    $sql = "SELECT * FROM departments WHERE deptid = '{$pur['deptid']}' AND div = '" . USER_DIV . "'";
    $deptRslt = db_exec($sql);
    if (pg_numrows($deptRslt) < 1) {
        $dept['deptname'] = "<li class='err'>Department not Found.</li>";
    } else {
        $dept = pg_fetch_array($deptRslt);
    }
    $supname = $pur['supname'];
    $supaddr = $pur['supaddr'];
    $supno = $pur['supno'];
    /* --- Start Drop Downs --- */
    # Select warehouse
    db_conn("exten");
    $whs = "<select name='whidss[]' onChange='javascript:document.form.submit();'>";
    $sql = "SELECT * FROM warehouses WHERE div = '" . USER_DIV . "' ORDER BY whname ASC";
    $whRslt = db_exec($sql);
    if (pg_numrows($whRslt) < 1) {
        return "<li class='err'> There are no Stores found in Cubit.</li>";
    } else {
        $whs .= "<option value='-S' disabled selected>Select Store</option>";
        while ($wh = pg_fetch_array($whRslt)) {
            $whs .= "<option value='{$wh['whid']}'>({$wh['whno']}) {$wh['whname']}</option>";
        }
    }
    $whs .= "</select>";
    # days drop downs
    $days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
    $termssel = extlib_cpsel("terms", $days, $pur['terms']);
    # format date
    list($p_year, $p_month, $p_day) = explode("-", $pur['pdate']);
    # keep the charge vat option stable
    if ($pur['vatinc'] == "yes") {
        $chy = "checked=yes";
        $chn = "";
        $chv = "";
    } elseif ($pur['vatinc'] == "no") {
        $chy = "";
        $chn = "checked=yes";
        $chv = "";
    } else {
        $chy = "";
        $chn = "";
        $chv = "checked=yes";
    }
    /* --- End Drop Downs --- */
    /* --- Start Products Display --- */
    # select all products
    $products = "\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>STORE</th>\n\t\t\t\t\t\t\t<th>ITEM NUMBER</th>\n\t\t\t\t\t\t\t<th>VAT CODE</th>\n\t\t\t\t\t\t\t<th>DESCRIPTION</th>\n\t\t\t\t\t\t\t<th>QTY</th>\n\t\t\t\t\t\t\t<th>PRICE PER UNIT</th>\n\t\t\t\t\t\t\t<th>DELIVERY DATE</th>\n\t\t\t\t\t\t\t<th>AMOUNT</th>\n\t\t\t\t\t\t\t<th>VAT</th>\n\t\t\t\t\t\t\t<th>Remove</th>\n\t\t\t\t\t\t<tr>";
    # get selected stock in this purchase
    db_connect();
    $sql = "SELECT * FROM pur_items  WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
    $stkdRslt = db_exec($sql);
    $i = 0;
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:purchase-new-cash.php

示例15: details

function details($_POST, $error = "")
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($purid)) {
        $v->isOk($purid, "num", 1, 20, "Invalid Non-Stock Order number.");
    } else {
        $v->isOk($ctyp, "string", 0, 20, "Invalid purchase type.");
    }
    # display errors, if any
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $error .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    if (!isset($purid)) {
        $purid = create_dummy(0);
    }
    # Get Order info
    db_connect();
    $sql = "SELECT * FROM nons_purchases WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
    $purRslt = db_exec($sql) or errDie("Unable to get Order information");
    if (pg_numrows($purRslt) < 1) {
        return "<li class='err'>Purchase Not Found</li>";
    }
    $pur = pg_fetch_array($purRslt);
    # check if Order has been printed
    if ($pur['received'] == "y") {
        $error = "<li class='err'> Error : Order number <b>{$purid}</b> has already been received.</li>";
        $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    if (!isset($ordernum)) {
        $ordernum = '';
    }
    /* --- Start Drop Downs --- */
    # days drop downs
    $days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
    $termssel = extlib_cpsel("terms", $days, $pur['terms']);
    # format date
    list($npur_year, $npur_month, $npur_day) = explode("-", $pur['pdate']);
    # keep the charge vat option stable
    if ($pur['vatinc'] == "yes") {
        $chy = "checked=yes";
        $chn = "";
        $chnv = "";
    } else {
        if ($pur['vatinc'] == 'novat') {
            $chy = "";
            $chn = "";
            $chnv = "checked=yes";
        } else {
            $chy = "";
            $chn = "checked=yes";
            $chnv = "";
        }
    }
    /* --- End Drop Downs --- */
    /* --- Start Products Display --- */
    # Select all products
    $products = "\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\n\t\t\t\t<th>ITEM NUMBER</th>\n\t\t\t\t<th>VAT CODE</th>\n\t\t\t\t<th>DESCRIPTION</th>\n\t\t\t\t<th>QTY</th>\n\t\t\t\t<th>UNIT PRICE</th>\n\t\t\t\t<th>DELIVERY DATE</th>\n\t\t\t\t<th>AMOUNT</th>\n\t\t\t\t<th>VAT</th>\n\t\t\t\t<th>Remove</th>\n\t\t\t<tr>";
    # get selected stock in this Order
    db_connect();
    $sql = "SELECT * FROM nons_pur_items  WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
    $stkdRslt = db_exec($sql);
    $i = 0;
    $key = 0;
    while ($stkd = pg_fetch_array($stkdRslt)) {
        # keep track of selected stock amounts
        $amts[$i] = $stkd['amt'];
        $i++;
        list($syear, $smon, $sday) = explode("-", $stkd['ddate']);
        $stkd['amt'] = round($stkd['amt'], 2);
        $tip = "&nbsp;&nbsp;&nbsp;";
        if (isset($vatc[$key])) {
            $tip = "<font color='red'>#</font>";
            $error = "<div class='err'> {$tip}&nbsp;&nbsp;=&nbsp;&nbsp; Vat amount is different from amount calculated by cubit. To allow cubit to recalculate the vat amount, please delete the vat amount from the input box.";
        }
        db_conn('cubit');
        $Sl = "SELECT * FROM vatcodes ORDER BY code";
        $Ri = db_exec($Sl) or errDie("Unable to get vat codes");
        $Vatcodes = "\n\t\t\t<select name='vatcodes[]'>\n\t\t\t\t<option value='0'>Select</option>";
        while ($vd = pg_fetch_array($Ri)) {
            if ($stkd['vatcode'] == $vd['id']) {
                $sel = "selected";
            } else {
                $sel = "";
            }
            $Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
        }
        $Vatcodes .= "</select>";
        $stkd['amt'] = sprint($stkd['amt']);
        # put in product
        $products .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'><input type='text' size='10' name='cod[]' value='{$stkd['cod']}'></td>\n\t\t\t\t<td>{$Vatcodes}</td>\n\t\t\t\t<td align='center'><input type='text' size='20' name='des[]' value='{$stkd['des']}'></td>\n\t\t\t\t<td align='center'><input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'></td>\n\t\t\t\t<td align='center'><input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'></td>\n\t\t\t\t<td align='center'>" . mkDateSelecta("d", array($i), $syear, $smon, $sday) . "</td>\n\t\t\t\t<td><input type='hidden' name='amt[]' value='{$stkd['amt']}'> " . CUR . " {$stkd['amt']}</td>\n\t\t\t\t<td>{$tip} <input type='text' name='vat[]' size='9' value='{$stkd['svat']}'></td>\n\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t</tr>";
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:nons-purchase-new.php


注:本文中的create_dummy函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。