當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DB_error_no函數代碼示例

本文整理匯總了PHP中DB_error_no函數的典型用法代碼示例。如果您正苦於以下問題:PHP DB_error_no函數的具體用法?PHP DB_error_no怎麽用?PHP DB_error_no使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了DB_error_no函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: InsertGLAccountGroup

function InsertGLAccountGroup($AccountGroupDetails, $user, $password)
{
    $Errors = array();
    $db = db($user, $password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    foreach ($AccountGroupDetails as $key => $value) {
        $AccountGroupDetails[$key] = DB_escape_string($value);
    }
    $Errors = VerifyAccountGroup($AccountGroupDetails['groupname'], sizeof($Errors), $Errors, $db);
    $Errors = VerifyAccountSectionExists($AccountGroupDetails['sectioninaccounts'], sizeof($Errors), $Errors, $db);
    if (isset($AccountGroupDetails['pandl'])) {
        $Errors = VerifyPandL($AccountGroupDetails['pandl'], sizeof($Errors), $Errors);
    }
    $Errors = VerifyParentGroupExists($AccountGroupDetails['parentgroupname'], sizeof($Errors), $Errors, $db);
    $FieldNames = '';
    $FieldValues = '';
    foreach ($AccountGroupDetails as $key => $value) {
        $FieldNames .= $key . ', ';
        $FieldValues .= '"' . $value . '", ';
    }
    if (sizeof($Errors) == 0) {
        $sql = 'INSERT INTO accountgroups (' . substr($FieldNames, 0, -2) . ') ' . 'VALUES (' . substr($FieldValues, 0, -2) . ') ';
        $result = DB_Query($sql, $db);
        if (DB_error_no($db) != 0) {
            $Errors[0] = DatabaseUpdateFailed;
        } else {
            $Errors[0] = 0;
        }
    }
    return $Errors;
}
開發者ID:stateless,項目名稱:weberp-cvs,代碼行數:34,代碼來源:api_glgroups.php

示例2: InsertSalesArea

function InsertSalesArea($AreaDetails, $User, $Password)
{
    $Errors = array();
    $db = db($User, $Password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    $Errors = VerifyAreaCodeDoesntExist($AreaDetails['areacode'], 0, $Errors, $db);
    if (sizeof($Errors > 0)) {
        //			return $Errors;
    }
    $FieldNames = '';
    $FieldValues = '';
    foreach ($AreaDetails as $key => $value) {
        $FieldNames .= $key . ', ';
        $FieldValues .= '"' . $value . '", ';
    }
    $sql = 'INSERT INTO areas (' . mb_substr($FieldNames, 0, -2) . ")\n\t\t\t\tVALUES ('" . mb_substr($FieldValues, 0, -2) . "') ";
    if (sizeof($Errors) == 0) {
        $result = DB_Query($sql, $db);
        if (DB_error_no() != 0) {
            $Errors[0] = DatabaseUpdateFailed;
        } else {
            $Errors[0] = 0;
        }
    }
    return $Errors;
}
開發者ID:fgaudenzi,項目名稱:webERP-bootstrap,代碼行數:29,代碼來源:api_salesareas.php

示例3: InsertSalesType

function InsertSalesType($SalesTypeDetails, $user, $password)
{
    $Errors = array();
    $db = db($user, $password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    $FieldNames = '';
    $FieldValues = '';
    foreach ($SalesTypeDetails as $key => $value) {
        $FieldNames .= $key . ', ';
        $FieldValues .= '"' . $value . '", ';
    }
    $sql = 'INSERT INTO salestypes (' . substr($FieldNames, 0, -2) . ') ' . 'VALUES (' . substr($FieldValues, 0, -2) . ') ';
    if (sizeof($Errors) == 0) {
        $result = DB_Query($sql, $db);
        if (DB_error_no($db) != 0) {
            $Errors[0] = DatabaseUpdateFailed;
        } else {
            $Errors[0] = 0;
        }
    }
    return $Errors;
}
開發者ID:stateless,項目名稱:weberp-cvs,代碼行數:25,代碼來源:api_salestypes.php

示例4: DB_query_oc

function DB_query_oc($SQL, $ErrorMessage = '', $DebugMessage = '', $Transaction = false, $TrapErrors = true)
{
    global $db_oc;
    global $PathPrefix;
    $Result = mysqli_query($db_oc, $SQL);
    if ($DebugMessage == '') {
        $DebugMessage = _('The SQL that failed was');
    }
    if (DB_error_no($db_oc) != 0 and $TrapErrors == true) {
        if ($TrapErrors) {
            require_once $PathPrefix . 'includes/header.inc';
        }
        prnMsg($ErrorMessage . '<br />' . DB_error_msg($db_oc), 'error', _('Database Error') . ' ' . DB_error_no($db_oc));
        if ($Debug == 1) {
            prnMsg($DebugMessage . '<br />' . $SQL . '<br />', 'error', _('Database SQL Failure'));
        }
        if ($Transaction) {
            $SQL = 'rollback';
            $Result = DB_query_oc($SQL);
            if (DB_error_no() != 0) {
                prnMsg(_('Error Rolling Back Transaction'), 'error', _('Database Rollback Error') . ' ' . DB_error_no($db_oc));
            } else {
                prnMsg(_('Rolling Back Transaction OK'), 'error', _('Database Rollback Due to Error Above'));
            }
        }
        if ($TrapErrors) {
            include $PathPrefix . 'includes/footer.inc';
            exit;
        }
    }
    return $Result;
}
開發者ID:ewintec,項目名稱:OpenCartBridge,代碼行數:32,代碼來源:OpenCartConnectDB.php

示例5: InsertGLAccount

function InsertGLAccount($AccountDetails, $user, $password)
{
    $Errors = array();
    $db = db($user, $password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    foreach ($AccountDetails as $key => $value) {
        $AccountDetails[$key] = DB_escape_string($value);
    }
    $Errors = VerifyAccountCode($AccountDetails['accountcode'], sizeof($Errors), $Errors, $db);
    if (isset($AccountDetails['accountname'])) {
        $Errors = VerifyAccountName($AccountDetails['accountname'], sizeof($Errors), $Errors);
    }
    $Errors = VerifyAccountGroupExists($AccountDetails['group_'], sizeof($Errors), $Errors, $db);
    $FieldNames = '';
    $FieldValues = '';
    foreach ($AccountDetails as $key => $value) {
        $FieldNames .= $key . ', ';
        $FieldValues .= '"' . $value . '", ';
    }
    if (sizeof($Errors) == 0) {
        $sql = "INSERT INTO chartmaster (" . mb_substr($FieldNames, 0, -2) . ") " . "VALUES ('" . mb_substr($FieldValues, 0, -2) . "') ";
        $result = DB_Query($sql, $db);
        $sql = "INSERT INTO chartdetails (accountcode,\n\t\t\t\t\t\t\tperiod)\n\t\t\t\tSELECT " . $AccountDetails['accountcode'] . ",\n\t\t\t\t\tperiodno\n\t\t\t\tFROM periods";
        $result = DB_query($sql, $db, '', '', '', false);
        if (DB_error_no($db) != 0) {
            $Errors[0] = DatabaseUpdateFailed;
        } else {
            $Errors[0] = 0;
        }
    }
    return $Errors;
}
開發者ID:patmark,項目名稱:weberp-elct,代碼行數:35,代碼來源:api_glaccounts.php

示例6: InsertGLAccountSection

function InsertGLAccountSection($AccountSectionDetails, $user, $password)
{
    $Errors = array();
    $db = db($user, $password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    foreach ($AccountSectionDetails as $key => $value) {
        $AccountSectionDetails[$key] = DB_escape_string($value);
    }
    $Errors = VerifyAccountSection($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors, $db);
    if (isset($AccountSectionDetails['accountname'])) {
        $Errors = VerifySectionName($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors);
    }
    $FieldNames = '';
    $FieldValues = '';
    foreach ($AccountSectionDetails as $key => $value) {
        $FieldNames .= $key . ', ';
        $FieldValues .= '"' . $value . '", ';
    }
    if (sizeof($Errors) == 0) {
        $sql = "INSERT INTO accountsection ('" . mb_substr($FieldNames, 0, -2) . "')\n\t\t\t\t\tVALUES ('" . mb_substr($FieldValues, 0, -2) . "')";
        $result = DB_Query($sql, $db);
        if (DB_error_no($db) != 0) {
            $Errors[0] = DatabaseUpdateFailed;
        } else {
            $Errors[0] = 0;
        }
    }
    return $Errors;
}
開發者ID:patmark,項目名稱:weberp-elct,代碼行數:32,代碼來源:api_glsections.php

示例7: executeSQL

function executeSQL($sql, $db, $TrapErrors = False)
{
    global $SQLFile;
    /* Run an sql statement and return an error code */
    if (!isset($SQLFile)) {
        $result = DB_query($sql, $db, '', '', false, $TrapErrors);
        return DB_error_no($db);
    } else {
        fwrite($SQLFile, $sql . ";\n");
    }
}
開發者ID:sunilburli,項目名稱:webERP-Medical,代碼行數:11,代碼來源:Z_UpgradeDatabase.php

示例8: executeSQL

function executeSQL($sql, $db, $TrapErrors = False)
{
    global $SQLFile;
    /* Run an sql statement and return an error code */
    if (!isset($SQLFile)) {
        DB_IgnoreForeignKeys($db);
        $result = DB_query($sql, $db, '', '', false, $TrapErrors);
        $ErrorNumber = DB_error_no($db);
        DB_ReinstateForeignKeys($db);
        return $ErrorNumber;
    } else {
        fwrite($SQLFile, $sql . ";\n");
    }
}
開發者ID:rrsc,項目名稱:KwaMoja,代碼行數:14,代碼來源:Z_UpgradeDatabase.php

示例9: _

                            echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('contracts referring to this branch/customer');
                        } else {
                            //check if this it the last customer branch - don't allow deletion of the last branch
                            $SQL = "SELECT COUNT(*) FROM custbranch WHERE debtorno='" . $DebtorNo . "'";
                            $result = DB_query($SQL);
                            $myrow = DB_fetch_row($result);
                            if ($myrow[0] == 1) {
                                prnMsg(_('Cannot delete this branch because it is the only branch defined for this customer.'), 'warn');
                            } else {
                                $SQL = "DELETE FROM custbranch WHERE branchcode='" . $SelectedBranch . "' AND debtorno='" . $DebtorNo . "'";
                                if ($_SESSION['SalesmanLogin'] != '') {
                                    $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'";
                                }
                                $ErrMsg = _('The branch record could not be deleted') . ' - ' . _('the SQL server returned the following message');
                                $result = DB_query($SQL, $ErrMsg);
                                if (DB_error_no() == 0) {
                                    prnMsg(_('Branch Deleted'), 'success');
                                }
                            }
                        }
                    }
                }
            }
        }
        //end ifs to test if the branch can be deleted
    }
}
if (!isset($SelectedBranch)) {
    /* It could still be the second time the page has been run and a record has been selected for modification - SelectedBranch will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of branches will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/
    $SQL = "SELECT debtorsmaster.name,\n\t\t\t\t\tcustbranch.branchcode,\n\t\t\t\t\tbrname,\n\t\t\t\t\tsalesman.salesmanname,\n\t\t\t\t\tareas.areadescription,\n\t\t\t\t\tcontactname,\n\t\t\t\t\tphoneno,\n\t\t\t\t\tfaxno,\n\t\t\t\t\tcustbranch.email,\n\t\t\t\t\ttaxgroups.taxgroupdescription,\n\t\t\t\t\tcustbranch.disabletrans\n\t\t\t\tFROM custbranch INNER JOIN debtorsmaster\n\t\t\t\tON custbranch.debtorno=debtorsmaster.debtorno\n\t\t\t\tINNER JOIN areas\n\t\t\t\tON custbranch.area=areas.areacode\n\t\t\t\tINNER JOIN salesman\n\t\t\t\tON custbranch.salesman=salesman.salesmancode\n\t\t\t\tINNER JOIN taxgroups\n\t\t\t\tON custbranch.taxgroupid=taxgroups.taxgroupid\n\t\t\t\tWHERE custbranch.debtorno = '" . $DebtorNo . "'";
    if ($_SESSION['SalesmanLogin'] != '') {
開發者ID:sjhelios,項目名稱:trikemindo,代碼行數:31,代碼來源:CustomerBranches.php

示例10: InvoiceSalesOrder

function InvoiceSalesOrder($OrderNo, $User, $Password)
{
    $Errors = array();
    $db = db($User, $Password);
    if (gettype($db) == 'integer') {
        $Errors[] = NoAuthorisation;
        return $Errors;
    }
    $Errors = VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors, $db);
    if (sizeof($Errors) != 0) {
        return $Errors;
    }
    /*Does not deal with assembly items or serialise/lot track items - for use by POS */
    /*Get Company Defaults */
    $ReadCoyResult = api_DB_query("SELECT debtorsact,\n\t\t\t\t\t\t\t\t\t\t\t\tfreightact,\n\t\t\t\t\t\t\t\t\t\t\t\tgllink_debtors,\n\t\t\t\t\t\t\t\t\t\t\t\tgllink_stock\n\t\t\t\t\t\t\t\t\t\tFROM companies\n\t\t\t\t\t\t\t\t\t\tWHERE coycode=1", $db);
    $CompanyRecord = DB_fetch_array($ReadCoyResult);
    if (DB_error_no($db) != 0) {
        $Errors[] = NoCompanyRecord;
    }
    $OrderHeaderSQL = "SELECT salesorders.debtorno,\n\t\t\t\t \t\t\t\t  debtorsmaster.name,\n\t\t\t\t\t\t\t\t  salesorders.branchcode,\n\t\t\t\t\t\t\t\t  salesorders.customerref,\n\t\t\t\t\t\t\t\t  salesorders.orddate,\n\t\t\t\t\t\t\t\t  salesorders.ordertype,\n\t\t\t\t\t\t\t\t  salesorders.shipvia,\n\t\t\t\t\t\t\t\t  custbranch.area,\n\t\t\t\t\t\t\t\t  custbranch.taxgroupid,\n\t\t\t\t\t\t\t\t  debtorsmaster.currcode,\n\t\t\t\t\t\t\t\t  currencies.rate,\n\t\t\t\t\t\t\t\t  salesorders.fromstkloc,\n\t\t\t\t\t\t\t\t  custbranch.salesman\n\t\t\t\t\t\t\tFROM salesorders\n\t\t\t\t\t\t\tINNER JOIN debtorsmaster\n\t\t\t\t\t\t\tON salesorders.debtorno = debtorsmaster.debtorno\n\t\t\t\t\t\t\tINNER JOIN custbranch\n\t\t\t\t\t\t\tON salesorders.debtorno = custbranch.debtorno\n\t\t\t\t\t\t\tAND salesorders.branchcode = custbranch.branchcode\n\t\t\t\t\t\t\tINNER JOIN locations\n\t\t\t\t\t\t\tON locations.loccode=salesorders.fromstkloc\n\t\t\t\t\t\t\tINNER JOIN currencies\n\t\t\t\t\t\t\tON debtorsmaster.currcode=currencies.currabrev\n\t\t\t\t\t\t\tWHERE salesorders.orderno = '" . $OrderNo . "'";
    $OrderHeaderResult = api_DB_query($OrderHeaderSQL, $db);
    if (DB_error_no($db) != 0) {
        $Errors[] = NoReadOrder;
    }
    $OrderHeader = DB_fetch_array($OrderHeaderResult);
    $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $OrderHeader['fromstkloc'] . "'", $db);
    if (DB_error_no($db) != 0) {
        $Errors[] = NoTaxProvince;
    }
    $myrow = DB_fetch_row($TaxProvResult);
    $DispTaxProvinceID = $myrow[0];
    $LineItemsSQL = "SELECT stkcode,\n\t\t\t\t\t\t\t\tunitprice,\n\t\t\t\t\t\t\t\tquantity,\n\t\t\t\t\t\t\t\tdiscountpercent,\n\t\t\t\t\t\t\t\ttaxcatid,\n\t\t\t\t\t\t\t\tmbflag,\n\t\t\t\t\t\t\t\tmaterialcost+labourcost+overheadcost AS standardcost\n\t\t\t\t\t\tFROM salesorderdetails INNER JOIN stockmaster\n\t\t\t\t\t\tON salesorderdetails.stkcode = stockmaster.stockid\n\t\t\t\t\t\tWHERE orderno ='" . $OrderNo . "'\n\t\t\t\t\t\tAND completed=0";
    $LineItemsResult = api_DB_query($LineItemsSQL, $db);
    if (DB_error_no($db) != 0 or DB_num_rows($LineItemsResult) == 0) {
        $Errors[] = NoReadOrderLines;
        return $Errors;
    }
    /*Start an SQL transaction */
    $result = DB_Txn_Begin($db);
    /*Now Get the next invoice number - function in SQL_CommonFunctions*/
    $InvoiceNo = GetNextTransNo(10, $db);
    $PeriodNo = GetCurrentPeriod($db);
    $TaxTotals = array();
    $TotalFXNetInvoice = 0;
    $TotalFXTax = 0;
    $LineCounter = 0;
    while ($OrderLineRow = DB_fetch_array($LineItemsResult)) {
        $StandardCost = $OrderLineRow['standardcost'];
        $LocalCurrencyPrice = $OrderLineRow['unitprice'] * (1 - floatval($OrderLineRow['discountpercent'])) / $OrderHeader['rate'];
        $LineNetAmount = $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] * (1 - floatval($OrderLineRow['discountpercent']));
        /*Gets the Taxes and rates applicable to this line from the TaxGroup of the branch and TaxCategory of the item
        		and the taxprovince of the dispatch location */
        $SQL = "SELECT taxgrouptaxes.calculationorder,\n\t\t\t\t\t\t\ttaxauthorities.description,\n\t\t\t\t\t\t\ttaxgrouptaxes.taxauthid,\n\t\t\t\t\t\t\ttaxauthorities.taxglcode,\n\t\t\t\t\t\t\ttaxgrouptaxes.taxontax,\n\t\t\t\t\t\t\ttaxauthrates.taxrate\n\t\t\t\t\tFROM taxauthrates INNER JOIN taxgrouptaxes ON\n\t\t\t\t\t\ttaxauthrates.taxauthority=taxgrouptaxes.taxauthid\n\t\t\t\t\t\tINNER JOIN taxauthorities ON\n\t\t\t\t\t\ttaxauthrates.taxauthority=taxauthorities.taxid\n\t\t\t\t\tWHERE taxgrouptaxes.taxgroupid='" . $OrderHeader['taxgroupid'] . "'\n\t\t\t\t\tAND taxauthrates.dispatchtaxprovince='" . $DispTaxProvinceID . "'\n\t\t\t\t\tAND taxauthrates.taxcatid = '" . $OrderLineRow['taxcatid'] . "'\n\t\t\t\t\tORDER BY taxgrouptaxes.calculationorder";
        $GetTaxRatesResult = api_DB_query($SQL, $db);
        if (DB_error_no($db) != 0) {
            $Errors[] = TaxRatesFailed;
        }
        $LineTaxAmount = 0;
        while ($myrow = DB_fetch_array($GetTaxRatesResult)) {
            if (!isset($TaxTotals[$myrow['taxauthid']]['FXAmount'])) {
                $TaxTotals[$myrow['taxauthid']]['FXAmount'] = 0;
            }
            $TaxAuthID = $myrow['taxauthid'];
            $TaxTotals[$myrow['taxauthid']]['GLCode'] = $myrow['taxglcode'];
            $TaxTotals[$myrow['taxauthid']]['TaxRate'] = $myrow['taxrate'];
            $TaxTotals[$myrow['taxauthid']]['TaxAuthDescription'] = $myrow['description'];
            if ($myrow['taxontax'] == 1) {
                $TaxAuthAmount = ($LineNetAmount + $LineTaxAmount) * $myrow['taxrate'];
            } else {
                $TaxAuthAmount = $LineNetAmount * $myrow['taxrate'];
            }
            $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $TaxAuthAmount;
            /*Make an array of the taxes and amounts including GLcodes for later posting - need debtortransid
            		so can only post once the debtor trans is posted - can only post debtor trans when all tax is calculated */
            $LineTaxes[$LineCounter][$myrow['calculationorder']] = array('TaxCalculationOrder' => $myrow['calculationorder'], 'TaxAuthID' => $myrow['taxauthid'], 'TaxAuthDescription' => $myrow['description'], 'TaxRate' => $myrow['taxrate'], 'TaxOnTax' => $myrow['taxontax'], 'TaxAuthAmount' => $TaxAuthAmount);
            $LineTaxAmount += $TaxAuthAmount;
        }
        //end loop around Taxes
        $TotalFXNetInvoice += $LineNetAmount;
        $TotalFXTax += $LineTaxAmount;
        /*Now update SalesOrderDetails for the quantity invoiced and the actual dispatch dates. */
        $SQL = "UPDATE salesorderdetails\n\t\t\t\t\tSET qtyinvoiced = qtyinvoiced + " . $OrderLineRow['quantity'] . ",\n\t\t\t\t\t\tactualdispatchdate = '" . $OrderHeader['orddate'] . "',\n\t\t\t\t\t\tcompleted='1'\n\t\t\t\t\tWHERE orderno = '" . $OrderNo . "'\n\t\t\t\t\tAND stkcode = '" . $OrderLineRow['stkcode'] . "'";
        $Result = api_DB_query($SQL, $db, '', '', true);
        if ($OrderLineRow['mbflag'] == 'B' or $OrderLineRow['mbflag'] == 'M') {
            $Assembly = False;
            /* Need to get the current location quantity
            			will need it later for the stock movement */
            $SQL = "SELECT locstock.quantity\n\t\t\t\t\t\tFROM locstock\n\t\t\t\t\t\tWHERE locstock.stockid='" . $OrderLineRow['stkcode'] . "'\n\t\t\t\t\t\tAND loccode= '" . $OrderHeader['fromstkloc'] . "'";
            $Result = api_DB_query($SQL, $db);
            if (DB_num_rows($Result) == 1) {
                $LocQtyRow = DB_fetch_row($Result);
                $QtyOnHandPrior = $LocQtyRow[0];
            } else {
                /* There must be some error this should never happen */
                $QtyOnHandPrior = 0;
            }
            $SQL = "UPDATE locstock\n\t\t\t\t\t\tSET quantity = locstock.quantity - " . $OrderLineRow['quantity'] . "\n\t\t\t\t\t\tWHERE locstock.stockid = '" . $OrderLineRow['stkcode'] . "'\n\t\t\t\t\t\tAND loccode = '" . $OrderHeader['fromstkloc'] . "'";
            $Result = api_DB_query($SQL, $db, '', '', true);
            $SQL = "INSERT INTO stockmoves (stockid,\n\t\t\t\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\t\t\t\ttransno,\n\t\t\t\t\t\t\t\t\t\t\t\tloccode,\n\t\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\t\tdebtorno,\n\t\t\t\t\t\t\t\t\t\t\t\tbranchcode,\n\t\t\t\t\t\t\t\t\t\t\t\tprice,\n\t\t\t\t\t\t\t\t\t\t\t\tprd,\n\t\t\t\t\t\t\t\t\t\t\t\treference,\n\t\t\t\t\t\t\t\t\t\t\t\tqty,\n\t\t\t\t\t\t\t\t\t\t\t\tdiscountpercent,\n\t\t\t\t\t\t\t\t\t\t\t\tstandardcost,\n\t\t\t\t\t\t\t\t\t\t\t\tnewqoh)\n\t\t\t\t\t\tVALUES ('" . $OrderLineRow['stkcode'] . "',\n\t\t\t\t\t\t\t\t'10',\n\t\t\t\t\t\t\t\t'" . $InvoiceNo . "',\n\t\t\t\t\t\t\t\t'" . $OrderHeader['fromstkloc'] . "',\n\t\t\t\t\t\t\t\t'" . $OrderHeader['orddate'] . "',\n\t\t\t\t\t\t\t\t'" . $OrderHeader['debtorno'] . "',\n\t\t\t\t\t\t\t\t'" . $OrderHeader['branchcode'] . "',\n\t\t\t\t\t\t\t\t'" . $LocalCurrencyPrice . "',\n\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t'" . $OrderNo . "',\n\t\t\t\t\t\t\t\t'" . -$OrderLineRow['quantity'] . "',\n\t\t\t\t\t\t\t\t'" . $OrderLineRow['discountpercent'] . "',\n\t\t\t\t\t\t\t\t'" . $StandardCost . "',\n\t\t\t\t\t\t\t\t'" . ($QtyOnHandPrior - $OrderLineRow['quantity']) . "' )";
            $Result = api_DB_query($SQL, $db, '', '', true);
//.........這裏部分代碼省略.........
開發者ID:BackupTheBerlios,項目名稱:kwamoja,代碼行數:101,代碼來源:api_salesorders.php

示例11: StockAdjustment

function StockAdjustment($StockID, $Location, $Quantity, $TranDate, $user, $password)
{
    $Errors = array();
    $db = db($user, $password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    $Errors = VerifyStockCodeExists($StockID, sizeof($Errors), $Errors, $db);
    $balances = GetStockBalance($StockID, $user, $password);
    $balance = 0;
    for ($i = 0; $i < sizeof($balances); $i++) {
        $balance = $balance + $balances[$i]['quantity'];
    }
    $newqoh = $Quantity + $balance;
    $itemdetails = GetStockItem($StockID, $user, $password);
    $adjglact = GetCategoryGLCode($itemdetails[1]['categoryid'], 'adjglact', $db);
    $stockact = GetCategoryGLCode($itemdetails[1]['categoryid'], 'stockact', $db);
    $stockmovesql = "INSERT INTO stockmoves (stockid,\n                                               type,\n                                               transno,\n                                               loccode,\n                                               trandate,\n                                               prd,\n                                               reference,\n                                               qty,\n                                               newqoh)\n                               VALUES ('" . $StockID . "',\n                                       '17',\n                                       '" . GetNextTransactionNo(17, $db) . "',\n                                       '" . $Location . "',\n                                       '" . $TranDate . "',\n                                       '" . GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db) . "',\n                                       'api adjustment',\n                                       '" . $Quantity . "',\n                                       '" . $newqoh . "')";
    $locstocksql = 'UPDATE locstock SET quantity = quantity + ' . $Quantity . "\n                             WHERE loccode='" . $Location . "'\n                             AND stockid='" . $StockID . "'";
    $glupdatesql1 = "INSERT INTO gltrans (type,\n                                            typeno,\n                                            trandate,\n                                            periodno,\n                                            account,\n                                            amount,\n                                            narrative)\n                                    VALUES ('17',\n                                           '" . GetNextTransactionNo(17, $db) . "',\n                                           '" . $TranDate . "',\n                                           '" . GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db) . "',\n                                           '" . $adjglact . "',\n                                           '" . $itemdetails['materialcost'] * -$Quantity . "',\n                                           '" . $StockID . ' x ' . $Quantity . ' @ ' . $itemdetails['materialcost'] . "')";
    $glupdatesql2 = "INSERT INTO gltrans (type,\n                                            typeno,\n                                            trandate,\n                                            periodno,\n                                            account,\n                                            amount,\n                                            narrative)\n\t\t\t\t\t\tVALUES ('17',\n                        '" . GetNextTransactionNo(17, $db) . "',\n                        '" . $TranDate . "',\n                        '" . GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db) . "',\n                        '" . $stockact . "',\n                        '" . $itemdetails['materialcost'] * $Quantity . "',\n                        '" . $StockID . ' x ' . $Quantity . ' @ ' . $itemdetails['materialcost'] . "')";
    $systypessql = "UPDATE systypes set typeno='" . GetNextTransactionNo(17, $db) . "' where typeid='17'";
    DB_Txn_Begin($db);
    DB_query($stockmovesql, $db);
    DB_query($locstocksql, $db);
    DB_query($glupdatesql1, $db);
    DB_query($glupdatesql2, $db);
    DB_query($systypessql, $db);
    DB_Txn_Commit($db);
    if (DB_error_no($db) != 0) {
        $Errors[0] = DatabaseUpdateFailed;
        return $Errors;
    } else {
        return 0;
    }
}
開發者ID:strollClouds,項目名稱:snkStudy,代碼行數:37,代碼來源:api_stock.php

示例12: ModifyBranch


//.........這裏部分代碼省略.........
        $Errors = VerifyBranchAddressLine($BranchDetails['address4'], 50, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['address5'])) {
        $Errors = VerifyBranchAddressLine($BranchDetails['address5'], 20, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['address6'])) {
        $Errors = VerifyBranchAddressLine($BranchDetails['address6'], 15, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['lat'])) {
        $Errors = VerifyLatitude($BranchDetails['lat'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['lng'])) {
        $Errors = VerifyLongitude($BranchDetails['lng'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['estdeliverydays'])) {
        $Errors = VerifyEstDeliveryDays($BranchDetails['estdeliverydays'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['area'])) {
        $Errors = VerifyAreaCode($BranchDetails['area'], sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['salesman'])) {
        $Errors = VerifySalesmanCode($BranchDetails['salesman'], sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['fwddate'])) {
        $Errors = VerifyFwdDate($BranchDetails['fwddate'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['phoneno'])) {
        $Errors = VerifyPhoneNumber($BranchDetails['phoneno'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['faxno'])) {
        $Errors = VerifyFaxNumber($BranchDetails['faxno'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['contactname'])) {
        $Errors = VerifyContactName($BranchDetails['contactname'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['email'])) {
        $Errors = VerifyEmailAddress($BranchDetails['email'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['defaultlocation'])) {
        $Errors = VerifyDefaultLocation($BranchDetails['defaultlocation'], sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['taxgroupid'])) {
        $Errors = VerifyTaxGroupId($BranchDetails['taxgroupid'], sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['defaultshipvia'])) {
        $Errors = VerifyDefaultShipVia($BranchDetails['defaultshipvia'], sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['deliverblind'])) {
        $Errors = VerifyDeliverBlind($BranchDetails['deliverblind'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['disabletrans'])) {
        $Errors = VerifyDisableTrans($BranchDetails['disabletrans'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['brpostaddr1'])) {
        $Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr1'], 40, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['brpostaddr2'])) {
        $Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr2'], 40, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['brpostaddr3'])) {
        $Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr3'], 30, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['brpostaddr4'])) {
        $Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr4'], 20, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['brpostaddr5'])) {
        $Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr5'], 20, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['brpostaddr6'])) {
        $Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr6'], 15, sizeof($Errors), $Errors, $db);
    }
    if (isset($BranchDetails['specialinstructions'])) {
        $Errors = VerifySpecialInstructions($BranchDetails['specialinstructions'], sizeof($Errors), $Errors);
    }
    if (isset($BranchDetails['custbranchcode'])) {
        $Errors = VerifyCustBranchCode($BranchDetails['custbranchcode'], sizeof($Errors), $Errors);
    }
    $FieldNames = '';
    $FieldValues = '';
    foreach ($BranchDetails as $key => $value) {
        $FieldNames .= $key . ', ';
        $FieldValues .= '"' . $value . '", ';
    }
    $sql = 'UPDATE custbranch SET ';
    foreach ($BranchDetails as $key => $value) {
        $sql .= $key . '="' . $value . '", ';
    }
    $sql = substr($sql, 0, -2) . ' WHERE debtorno="' . $BranchDetails['debtorno'] . '" and
				 branchcode="' . $BranchDetails['branchcode'] . '"';
    if (sizeof($Errors) == 0) {
        $result = DB_Query($sql, $db);
        echo DB_error_no($db);
        if (DB_error_no($db) != 0) {
            $Errors[0] = DatabaseUpdateFailed;
        } else {
            $Errors[0] = 0;
        }
    }
    return $Errors;
}
開發者ID:xuxudodo,項目名稱:weberp-cvs,代碼行數:101,代碼來源:api_branches.php

示例13: ModifyStockCategory

function ModifyStockCategory($CategoryDetails, $user, $password)
{
    $Errors = array();
    $db = db($user, $password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    foreach ($CategoryDetails as $key => $value) {
        $CategoryDetails[$key] = DB_escape_string($value);
    }
    $Errors = VerifyStockCategoryExists($CategoryDetails['categoryid'], sizeof($Errors), $Errors, $db);
    $Errors = VerifyCategoryID($CategoryDetails['categoryid'], sizeof($Errors), $Errors);
    $Errors = VerifyCategoryDescription($CategoryDetails['categorydescription'], sizeof($Errors), $Errors);
    $Errors = VerifyStockType($CategoryDetails['stocktype'], sizeof($Errors), $Errors);
    $Errors = VerifyAccountCodeExists($CategoryDetails['stockact'], sizeof($Errors), $Errors, $db);
    $Errors = VerifyAccountCodeExists($CategoryDetails['adjglact'], sizeof($Errors), $Errors, $db);
    $Errors = VerifyAccountCodeExists($CategoryDetails['purchpricevaract'], sizeof($Errors), $Errors, $db);
    $Errors = VerifyAccountCodeExists($CategoryDetails['materialuseagevarac'], sizeof($Errors), $Errors, $db);
    $Errors = VerifyAccountCodeExists($CategoryDetails['wipact'], sizeof($Errors), $Errors, $db);
    $FieldNames = '';
    $FieldValues = '';
    foreach ($CategoryDetails as $key => $value) {
        $FieldNames .= $key . ', ';
        $FieldValues .= '"' . $value . '", ';
    }
    $sql = "UPDATE stockcategory SET ";
    foreach ($CategoryDetails as $key => $value) {
        $sql .= $key . "='" . $value . "', ";
    }
    $sql = mb_substr($sql, 0, -2) . " WHERE categoryid='" . $CategoryDetails['categoryid'] . "'";
    if (sizeof($Errors) == 0) {
        $result = DB_Query($sql, $db);
        echo DB_error_no($db);
        if (DB_error_no($db) != 0) {
            $Errors[0] = DatabaseUpdateFailed;
        } else {
            $Errors[0] = 0;
        }
    }
    return $Errors;
}
開發者ID:patmark,項目名稱:weberp-elct,代碼行數:42,代碼來源:api_stockcategories.php

示例14: StockAdjustment

function StockAdjustment($StockID, $Location, $Quantity, $TranDate, $user, $password)
{
    $Errors = array();
    $db = db($user, $password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    $Errors = VerifyStockCodeExists($StockID, sizeof($Errors), $Errors, $db);
    $balances = GetStockBalance($StockID, $user, $password);
    $balance = 0;
    for ($i = 0; $i < sizeof($balances); $i++) {
        $balance = $balance + $balances[$i]['quantity'];
    }
    $newqoh = $Quantity + $balance;
    $itemdetails = GetStockItem($StockID, $user, $password);
    $adjglact = GetCategoryGLCode($itemdetails['categoryid'], 'adjglact', $db);
    $stockact = GetCategoryGLCode($itemdetails['categoryid'], 'stockact', $db);
    $stockmovesql = 'INSERT INTO stockmoves (stockid, type, transno, loccode, trandate, prd, reference, qty, newqoh)
				VALUES ("' . $StockID . '", 17,' . GetNextTransactionNo(17, $db) . ',"' . $Location . '","' . $TranDate . '",' . GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db) . ',"api adjustment",' . $Quantity . ',' . $newqoh . ')';
    $locstocksql = 'UPDATE locstock SET quantity = quantity + ' . $Quantity . ' WHERE loccode="' . $Location . '" AND stockid="' . $StockID . '"';
    $glupdatesql1 = 'INSERT INTO gltrans (type, typeno, trandate, periodno, account, amount, narrative)
						VALUES (17,' . GetNextTransactionNo(17, $db) . ',"' . $TranDate . '",' . GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db) . ',' . $adjglact . ',' . $itemdetails['materialcost'] * -$Quantity . ',"' . $StockID . ' x ' . $Quantity . ' @ ' . $itemdetails['materialcost'] . '")';
    $glupdatesql2 = 'INSERT INTO gltrans (type, typeno, trandate, periodno, account, amount, narrative)
						VALUES (17,' . GetNextTransactionNo(17, $db) . ',"' . $TranDate . '",' . GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db) . ',' . $stockact . ',' . $itemdetails['materialcost'] * $Quantity . ',"' . $StockID . ' x ' . $Quantity . ' @ ' . $itemdetails['materialcost'] . '")';
    $systypessql = 'UPDATE systypes set typeno=' . GetNextTransactionNo(17, $db) . ' where typeid=17';
    DB_Txn_Begin($db);
    DB_query($stockmovesql, $db);
    DB_query($locstocksql, $db);
    DB_query($glupdatesql1, $db);
    DB_query($glupdatesql2, $db);
    DB_query($systypessql, $db);
    DB_Txn_Commit($db);
    if (DB_error_no($db) != 0) {
        $Errors[0] = DatabaseUpdateFailed;
        return $Errors;
    } else {
        return 0;
    }
}
開發者ID:xuxudodo,項目名稱:weberp-cvs,代碼行數:40,代碼來源:api_stock.php

示例15: _

                        break;
                    case 1050:
                        echo '<tr><td>' . $comment . '</td><td style="background-color:yellow">' . _('Note') . ' - ' . _('Table has already been created') . '</td></tr>';
                        break;
                    case 1060:
                        echo '<tr><td>' . $comment . '</td><td style="background-color:yellow">' . _('Note') . ' - ' . _('Column has already been created') . '</td></tr>';
                        break;
                    case 1061:
                        echo '<tr><td>' . $comment . '</td><td style="background-color:yellow">' . _('Note') . ' - ' . _('Index already exists') . '</td></tr>';
                        break;
                    case 1062:
                        echo '<tr><td>' . $comment . '</td><td style="background-color:yellow">' . _('Note') . ' - ' . _('Entry has already been done') . '</td></tr>';
                        break;
                    case 1068:
                        echo '<tr><td>' . $comment . '</td><td style="background-color:yellow">' . _('Note') . ' - ' . _('Primary key already exists') . '</td></tr>';
                        break;
                    default:
                        echo '<tr><td>' . $comment . '</td><td style="background-color:red">' . _('Failure') . ' - ' . _('Error number') . ' - ' . DB_error_no() . '</td></tr>';
                        break;
                }
                unset($sql);
            }
        }
        //end if its a valid sql line not a comment
    }
    //end of for loop around the lines of the sql script
    echo '</table>';
    /*Now run the data conversions required. */
}
/*Dont do upgrade */
include 'includes/footer.inc';
開發者ID:fgaudenzi,項目名稱:webERP-bootstrap,代碼行數:31,代碼來源:Z_Upgrade_3.11-4.00.php


注:本文中的DB_error_no函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。