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


PHP DB_Txn_Commit函数代码示例

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


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

示例1: OpenCartToWeberpSync

function OpenCartToWeberpSync($ShowMessages, $db, $db_oc, $oc_tableprefix, $EmailText = '')
{
    $begintime = time_start();
    // connect to opencart DB
    DB_Txn_Begin($db);
    // check last time we run this script, so we know which records need to update from OC to webERP
    $LastTimeRun = CheckLastTimeRun('OpenCartToWeberp', $db);
    $TimeDifference = Get_SQL_to_PHP_time_difference($db);
    if ($ShowMessages) {
        prnMsg('This script was last run on: ' . $LastTimeRun . ' Server time difference: ' . $TimeDifference, 'success');
        prnMsg('Server time now: ' . GetServerTimeNow($TimeDifference), 'success');
    }
    if ($EmailText != '') {
        $EmailText = $EmailText . 'OpenCart to webERP Sync was last run on: ' . $LastTimeRun . "\n" . PrintTimeInformation($db);
    }
    // update order information
    $EmailText = SyncOrderInformation($TimeDifference, $ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // update payment information
    $EmailText = SyncPaypalPaymentInformation($TimeDifference, $ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // We are done!
    SetLastTimeRun('OpenCartToWeberp', $db);
    DB_Txn_Commit($db);
    if ($ShowMessages) {
        time_finish($begintime);
    }
    return $EmailText;
}
开发者ID:ewintec,项目名称:OpenCartBridge,代码行数:27,代码来源:OpenCartToWeberpSync.php

示例2: ProcessSupplier

function ProcessSupplier($oldCode, $newCode)
{
    global $db;
    $table_key = array('grns' => 'supplierid', 'offers' => 'supplierid', 'purchdata' => 'supplierno', 'purchorders' => 'supplierno', 'shipments' => 'supplierid', 'suppliercontacts' => 'supplierid', 'supptrans' => 'supplierno', 'www_users' => 'supplierid');
    // First check the Supplier code exists
    if (!checkSupplierExist($oldCode)) {
        prnMsg('<br /><br />' . _('The Supplier code') . ': ' . $oldCode . ' ' . _('does not currently exist as a supplier code in the system'), 'error');
        return;
    }
    $newCode = trim($newCode);
    if (checkNewCode($newCode)) {
        // Now check that the new code doesn't already exist
        if (checkSupplierExist($newCode)) {
            prnMsg(_('The replacement supplier code') . ': ' . $newCode . ' ' . _('already exists as a supplier code in the system') . ' - ' . _('a unique supplier code must be entered for the new code'), 'error');
            return;
        }
    } else {
        return;
    }
    $result = DB_Txn_Begin($db);
    prnMsg(_('Inserting the new supplier record'), 'info');
    $sql = "INSERT INTO suppliers (`supplierid`,\n\t\t`suppname`,  `address1`, `address2`, `address3`,\n\t\t`address4`,  `address5`,  `address6`, `supptype`, `lat`, `lng`,\n\t\t`currcode`,  `suppliersince`, `paymentterms`, `lastpaid`,\n\t\t`lastpaiddate`, `bankact`, `bankref`, `bankpartics`,\n\t\t`remittance`, `taxgroupid`, `factorcompanyid`, `taxref`,\n\t\t`phn`, `port`, `email`, `fax`, `telephone`)\n\tSELECT '" . $newCode . "',\n\t\t`suppname`,  `address1`, `address2`, `address3`,\n\t\t`address4`,  `address5`,  `address6`, `supptype`, `lat`, `lng`,\n\t\t`currcode`,  `suppliersince`, `paymentterms`, `lastpaid`,\n\t\t`lastpaiddate`, `bankact`, `bankref`, `bankpartics`,\n\t\t`remittance`, `taxgroupid`, `factorcompanyid`, `taxref`,\n\t\t`phn`, `port`, `email`, `fax`, `telephone`\n\t\tFROM suppliers WHERE supplierid='" . $oldCode . "'";
    $DbgMsg = _('The SQL that failed was');
    $ErrMsg = _('The SQL to insert the new suppliers master record failed') . ', ' . _('the SQL statement was');
    $result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true);
    foreach ($table_key as $table => $key) {
        prnMsg(_('Changing') . ' ' . $table . ' ' . _('records'), 'info');
        $sql = "UPDATE " . $table . " SET {$key}='" . $newCode . "' WHERE {$key}='" . $oldCode . "'";
        $ErrMsg = _('The SQL to update') . ' ' . $table . ' ' . _('records failed');
        $result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true);
    }
    prnMsg(_('Deleting the supplier code from the suppliers master table'), 'info');
    $sql = "DELETE FROM suppliers WHERE supplierid='" . $oldCode . "'";
    $ErrMsg = _('The SQL to delete the old supplier record failed');
    $result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true);
    $result = DB_Txn_Commit($db);
}
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:37,代码来源:Z_ChangeSupplierCode.php

示例3: WeberpToOpenCartHourlySync

function WeberpToOpenCartHourlySync($ShowMessages, $db, $db_oc, $oc_tableprefix, $ControlTx = TRUE, $EmailText = '')
{
    $begintime = time_start();
    if ($ControlTx) {
        DB_Txn_Begin($db);
    }
    // check last time we run this script, so we know which records need to update from OC to webERP
    $LastTimeRun = CheckLastTimeRun('WeberpToOpenCartHourly', $db);
    if ($ShowMessages) {
        $TimeDifference = Get_SQL_to_PHP_time_difference($db);
        prnMsg('This script was last run on: ' . $LastTimeRun . ' Server time difference: ' . $TimeDifference, 'success');
        prnMsg('Server time now: ' . GetServerTimeNow($TimeDifference), 'success');
    }
    if ($EmailText != '' and ControlTx) {
        $EmailText = $EmailText . 'webERP to OpenCart Hourly Sync was last run on: ' . $LastTimeRun . "\n" . PrintTimeInformation($db);
    }
    // update product basic information
    $EmailText = SyncProductBasicInformation($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // update product - sales categories relationship
    $EmailText = SyncProductSalesCategories($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // update product prices
    $EmailText = SyncProductPrices($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // update stock in hand
    $EmailText = SyncProductQOH($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // clean duplicated URL alias
    $EmailText = CleanDuplicatedUrlAlias($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // We are done!
    SetLastTimeRun('WeberpToOpenCartHourly', $db);
    if ($ControlTx) {
        DB_Txn_Commit($db);
    }
    if ($ShowMessages) {
        time_finish($begintime);
    }
    return $EmailText;
}
开发者ID:ewintec,项目名称:OpenCartBridge,代码行数:36,代码来源:WeberpToOpenCartSync.php

示例4: DB_free_result

    }
    DB_free_result($OldResult);
    $OldCost = $_POST['OldMaterialCost'] + $_POST['OldLabourCost'] + $_POST['OldOverheadCost'];
    $NewCost = filter_number_format($_POST['MaterialCost']) + filter_number_format($_POST['LabourCost']) + filter_number_format($_POST['OverheadCost']);
    $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $StockID . "'");
    $myrow = DB_fetch_row($result);
    if (DB_num_rows($result) == 0) {
        prnMsg(_('The entered item code does not exist'), 'error', _('Non-existent Item'));
    } elseif ($OldCost != $NewCost) {
        $Result = DB_Txn_Begin();
        ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $_POST['QOH']);
        $SQL = "UPDATE stockmaster SET\tmaterialcost='" . filter_number_format($_POST['MaterialCost']) . "',\n\t\t\t\t\t\t\t\t\t\tlabourcost='" . filter_number_format($_POST['LabourCost']) . "',\n\t\t\t\t\t\t\t\t\t\toverheadcost='" . filter_number_format($_POST['OverheadCost']) . "',\n\t\t\t\t\t\t\t\t\t\tlastcost='" . $OldCost . "',\n\t\t\t\t\t\t\t\t\t\tlastcostupdate ='" . Date('Y-m-d') . "'\n\t\t\t\t\t\t\t\tWHERE stockid='" . $StockID . "'";
        $ErrMsg = _('The cost details for the stock item could not be updated because');
        $DbgMsg = _('The SQL that failed was');
        $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
        $Result = DB_Txn_Commit();
        UpdateCost($db, $StockID);
        //Update any affected BOMs
    }
}
$ErrMsg = _('The cost details for the stock item could not be retrieved because');
$DbgMsg = _('The SQL that failed was');
$result = DB_query("SELECT description,\n\t\t\t\t\t\t\tunits,\n\t\t\t\t\t\t\tlastcost,\n\t\t\t\t\t\t\tactualcost,\n\t\t\t\t\t\t\tmaterialcost,\n\t\t\t\t\t\t\tlabourcost,\n\t\t\t\t\t\t\toverheadcost,\n\t\t\t\t\t\t\tmbflag,\n\t\t\t\t\t\t\tstocktype,\n\t\t\t\t\t\t\tlastcostupdate,\n\t\t\t\t\t\t\tsum(quantity) as totalqoh\n\t\t\t\t\t\tFROM stockmaster INNER JOIN locstock\n\t\t\t\t\t\t\tON stockmaster.stockid=locstock.stockid\n\t\t\t\t\t\t\tINNER JOIN stockcategory\n\t\t\t\t\t\t\tON stockmaster.categoryid = stockcategory.categoryid\n\t\t\t\t\t\tWHERE stockmaster.stockid='" . $StockID . "'\n\t\t\t\t\t\tGROUP BY description,\n\t\t\t\t\t\t\tunits,\n\t\t\t\t\t\t\tlastcost,\n\t\t\t\t\t\t\tactualcost,\n\t\t\t\t\t\t\tmaterialcost,\n\t\t\t\t\t\t\tlabourcost,\n\t\t\t\t\t\t\toverheadcost,\n\t\t\t\t\t\t\tmbflag,\n\t\t\t\t\t\t\tstocktype", $ErrMsg, $DbgMsg);
$myrow = DB_fetch_array($result);
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">
	<div>
	<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
	<table cellpadding="2" class="selection">
		<tr>
			<th colspan="2">' . _('Item Code') . ':<input type="text" name="StockID" value="' . $StockID . '"  maxlength="20" /><input type="submit" name="Show" value="' . _('Show Cost Details') . '" /></th>
		</tr>
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:StockCostUpdate.php

示例5: locale_number_format

         }
         $LeftOvers = $pdf->addTextWrap(340, $YPos, 60, $FontSize, locale_number_format($DetailTrans['balance'], $CurrDecimalPlaces), 'right');
         $LeftOvers = $pdf->addTextWrap(405, $YPos, 60, $FontSize, locale_number_format($DiffOnExch, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
         $YPos -= $line_height;
         if ($YPos < $Bottom_Margin + $line_height) {
             $PageNumber++;
             include 'includes/PDFPaymentRunPageHeader.inc';
         }
     }
     /*end while there are detail transactions to show */
 }
 /* end while there are suppliers to retrieve transactions for */
 if ($SupplierID != '') {
     /*All the payment processing is in the below file */
     include 'includes/PDFPaymentRun_PymtFooter.php';
     $ProcessResult = DB_Txn_Commit($db);
     if (DB_error_no($db) != 0) {
         $Title = _('Payment Processing - Problem Report') . '.... ';
         include 'includes/header.inc';
         prnMsg(_('None of the payments will be processed. Unfortunately, there was a problem committing the changes to the database because') . ' - ' . DB_error_msg($db), 'error');
         echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>';
         if ($debug == 1) {
             prnMsg(_('The SQL that failed was') . '<br />' . $SQL, 'error');
         }
         $ProcessResult = DB_Txn_Rollback($db);
         include 'includes/footer.inc';
         exit;
     }
     $LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 340 - $Left_Margin, $FontSize, _('Grand Total Payments Due'), 'left');
     $LeftOvers = $pdf->addTextWrap(340, $YPos, 60, $FontSize, locale_number_format($TotalPayments, $CurrDecimalPlaces), 'right');
     $LeftOvers = $pdf->addTextWrap(405, $YPos, 60, $FontSize, locale_number_format($TotalAccumDiffOnExch, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
开发者ID:strollClouds,项目名称:snkStudy,代码行数:31,代码来源:SuppPaymentRun.php

示例6: gltrans

        if ($_SESSION['CreditItems' . $identifier]->FreightCost != 0) {
            $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\tVALUES (11,\n\t\t\t\t\t\t\t\t'" . $CreditNo . "',\n\t\t\t\t\t\t\t\t'" . $SQLCreditDate . "',\n\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t'" . $_SESSION['CompanyRecord']['freightact'] . "',\n\t\t\t\t\t\t\t\t'" . $_SESSION['CreditItems' . $identifier]->DebtorNo . "',\n\t\t\t\t\t\t\t\t'" . $_SESSION['CreditItems' . $identifier]->FreightCost / $_SESSION['CurrencyRate'] . "')";
            $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The freight GL posting for this credit note could not be inserted because');
            $DbgMsg = _('The following SQL to insert the GLTrans record was used');
            $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
        }
        foreach ($TaxTotals as $TaxAuthID => $TaxAmount) {
            if ($TaxAmount != 0) {
                $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\tamount )\n\t\t\t\t\t\t\t\t\t\tVALUES (11,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $SQLCreditDate . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $TaxGLCodes[$TaxAuthID] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['CreditItems' . $identifier]->DebtorNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $TaxAmount / $_SESSION['CurrencyRate'] . "')";
                $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The tax GL posting could not be inserted because');
                $DbgMsg = _('The following SQL to insert the GLTrans record was used');
                $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
            }
        }
        EnsureGLEntriesBalance(11, $CreditNo, $db);
    }
    /*end of if Sales and GL integrated */
    DB_Txn_Commit();
    unset($_SESSION['CreditItems' . $identifier]->LineItems);
    unset($_SESSION['CreditItems' . $identifier]);
    echo _('Credit Note number') . ' ' . $CreditNo . ' ' . _('processed') . '<br />';
    echo '<a target="_blank" href="' . $RootPath . '/PrintCustTrans.php?FromTransNo=' . $CreditNo . '&InvOrCredit=Credit">' . _('Show this Credit Note on screen') . '</a><br />';
    if ($_SESSION['InvoicePortraitFormat'] == 0) {
        echo '<a href="' . $RootPath . '/PrintCustTrans.php?FromTransNo=' . $CreditNo . '&InvOrCredit=Credit&PrintPDF=True">' . _('Print this Credit Note') . '</a>';
    } else {
        echo '<a href="' . $RootPath . '/PrintCustTransPortrait.php?FromTransNo=' . $CreditNo . '&InvOrCredit=Credit&PrintPDF=True">' . _('Print this Credit Note') . '</a>';
    }
    echo '<br /><a href="' . $RootPath . '/SelectCreditItems.php">' . _('Enter Another Credit Note') . '</a>';
}
/*end of process credit note */
include 'includes/footer.inc';
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:SelectCreditItems.php

示例7: 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

示例8: InsertSalesCredit

function InsertSalesCredit($CreditDetails, $user, $password)
{
    $Errors = array();
    $db = db($user, $password);
    if (gettype($db) == 'integer') {
        $Errors[0] = NoAuthorisation;
        return $Errors;
    }
    foreach ($CreditDetails as $key => $value) {
        $CreditDetails[$key] = DB_escape_string($value);
    }
    $PartCode = $CreditDetails['partcode'];
    $Errors = VerifyStockCodeExists($PartCode, sizeof($Errors), $Errors, $db);
    unset($CreditDetails['partcode']);
    $SalesArea = $CreditDetails['salesarea'];
    unset($CreditDetails['salesarea']);
    $CreditDetails['transno'] = GetNextTransactionNo(11, $db);
    $CreditDetails['type'] = 10;
    $Errors = VerifyDebtorExists($CreditDetails['debtorno'], sizeof($Errors), $Errors, $db);
    $Errors = VerifyBranchNoExists($CreditDetails['debtorno'], $CreditDetails['branchcode'], sizeof($Errors), $Errors, $db);
    $Errors = VerifyTransNO($CreditDetails['transno'], 10, sizeof($Errors), $Errors, $db);
    $Errors = VerifyTransactionDate($CreditDetails['trandate'], sizeof($Errors), $Errors, $db);
    if (isset($CreditDetails['settled'])) {
        $Errors = VerifySettled($CreditDetails['settled'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['reference'])) {
        $Errors = VerifyReference($CreditDetails['reference'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['tpe'])) {
        $Errors = VerifyTpe($CreditDetails['tpe'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['order_'])) {
        $Errors = VerifyOrderNumber($CreditDetails['order_'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['rate'])) {
        $Errors = VerifyExchangeRate($CreditDetails['rate'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['ovamount'])) {
        $Errors = VerifyOVAmount($CreditDetails['ovamount'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['ovgst'])) {
        $Errors = VerifyOVGst($CreditDetails['ovgst'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['ovfreight'])) {
        $Errors = VerifyOVFreight($CreditDetails['ovfreight'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['ovdiscount'])) {
        $Errors = VerifyOVDiscount($CreditDetails['ovdiscount'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['diffonexch'])) {
        $Errors = VerifyDiffOnExchange($CreditDetails['diffonexch'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['alloc'])) {
        $Errors = VerifyAllocated($CreditDetails['alloc'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['invtext'])) {
        $Errors = VerifyInvoiceText($CreditDetails['invtext'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['shipvia'])) {
        $Errors = VerifyShipVia($CreditDetails['shipvia'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['edisent'])) {
        $Errors = VerifyEdiSent($CreditDetails['edisent'], sizeof($Errors), $Errors);
    }
    if (isset($CreditDetails['consignment'])) {
        $Errors = VerifyConsignment($CreditDetails['consignment'], sizeof($Errors), $Errors);
    }
    $FieldNames = '';
    $FieldValues = '';
    $CreditDetails['trandate'] = ConvertToSQLDate($CreditDetails['trandate']);
    $CreditDetails['prd'] = GetPeriodFromTransactionDate($CreditDetails['trandate'], sizeof($Errors), $Errors, $db);
    foreach ($CreditDetails as $key => $value) {
        $FieldNames .= $key . ', ';
        $FieldValues .= '"' . $value . '", ';
    }
    if (sizeof($Errors) == 0) {
        $result = DB_Txn_Begin($db);
        $sql = "INSERT INTO debtortrans (" . mb_substr($FieldNames, 0, -2) . ")\n\t\t\t\t\t\tVALUES ('" . mb_substr($FieldValues, 0, -2) . "') ";
        $result = DB_Query($sql, $db);
        $sql = "UPDATE systypes SET typeno='" . GetNextTransactionNo(11, $db) . "' WHERE typeid=10";
        $result = DB_Query($sql, $db);
        $SalesGLCode = GetSalesGLCode($SalesArea, $PartCode, $db);
        $DebtorsGLCode = GetDebtorsGLCode($db);
        $sql = "INSERT INTO gltrans VALUES(null,\n\t\t\t\t\t\t\t\t\t\t\t10,\n\t\t\t\t\t\t\t\t\t\t\t'" . GetNextTransactionNo(11, $db) . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['trandate'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['prd'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $DebtorsGLCode . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . _('Invoice for') . ' - ' . $CreditDetails['debtorno'] . ' ' . -'Total' . ' - ' . $CreditDetails['ovamount'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['ovamount'] . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['jobref'] . "')";
        $result = DB_Query($sql, $db);
        $sql = "INSERT INTO gltrans VALUES(null,\n\t\t\t\t\t\t\t\t\t\t\t10,\n\t\t\t\t\t\t\t\t\t\t\t'" . GetNextTransactionNo(11, $db) . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['trandate'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['prd'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $SalesGLCode . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . _('Invoice for') . ' - ' . $CreditDetails['debtorno'] . ' ' . _('Total') . ' - ' . $CreditDetails['ovamount'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . -intval($CreditDetails['ovamount']) . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['jobref'] . "')";
        $result = DB_Query($sql, $db);
        $result = DB_Txn_Commit($db);
        if (DB_error_no($db) != 0) {
            $Errors[0] = DatabaseUpdateFailed;
        } else {
            $Errors[0] = 0;
        }
        return $Errors;
    } else {
        return $Errors;
    }
}
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:98,代码来源:api_debtortransactions.php

示例9: locale_number_format

         }
         $LeftOvers = $pdf->addTextWrap(340, $YPos, 60, $FontSize, locale_number_format($DetailTrans['balance'], $CurrDecimalPlaces), 'right');
         $LeftOvers = $pdf->addTextWrap(405, $YPos, 60, $FontSize, locale_number_format($DiffOnExch, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
         $YPos -= $line_height;
         if ($YPos < $Bottom_Margin + $line_height) {
             $PageNumber++;
             include 'includes/PDFPaymentRunPageHeader.inc';
         }
     }
     /*end while there are detail transactions to show */
 }
 /* end while there are suppliers to retrieve transactions for */
 if ($SupplierID != '') {
     /*All the payment processing is in the below file */
     include 'includes/PDFPaymentRun_PymtFooter.php';
     $ProcessResult = DB_Txn_Commit();
     if (DB_error_no() != 0) {
         $Title = _('Payment Processing - Problem Report') . '.... ';
         include 'includes/header.inc';
         prnMsg(_('None of the payments will be processed. Unfortunately, there was a problem committing the changes to the database because') . ' - ' . DB_error_msg(), 'error');
         echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>';
         if ($debug == 1) {
             prnMsg(_('The SQL that failed was') . '<br />' . $SQL, 'error');
         }
         $ProcessResult = DB_Txn_Rollback();
         include 'includes/footer.inc';
         exit;
     }
     $LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 340 - $Left_Margin, $FontSize, _('Grand Total Payments Due'), 'left');
     $LeftOvers = $pdf->addTextWrap(340, $YPos, 60, $FontSize, locale_number_format($TotalPayments, $CurrDecimalPlaces), 'right');
     $LeftOvers = $pdf->addTextWrap(405, $YPos, 60, $FontSize, locale_number_format($TotalAccumDiffOnExch, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:SuppPaymentRun.php

示例10: _

                $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL posting for the cost variance could not be inserted because');
                $DbgMsg = _('The following SQL to insert the GLTrans record was used');
                $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
                $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\tVALUES (29,\n\t\t\t\t\t\t\t" . $WOCloseNo . ",\n\t\t\t\t\t\t\t'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t" . $PeriodNo . ",\n\t\t\t\t\t\t\t" . $WORow['wipact'] . ",\n\t\t\t\t\t\t\t'" . $_POST['WO'] . ' - ' . $WORow['stockid'] . ' ' . _('share of cost variance') . "',\n\t\t\t\t\t\t\t" . $TotalCostVar * $ShareProportion . ")";
                $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL posting for the WIP side of the cost variance posting could not be inserted because');
                $DbgMsg = _('The following SQL to insert the GLTrans record was used');
                $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
            }
            //end of if gl-stock integrated and there's a cost variance
        }
        //end of standard costing section
    }
    // end loop around the items on the work order
    $CloseWOResult = DB_query('UPDATE workorders SET closed=1 WHERE wo=' . $_POST['WO'], $db, _('Could not update the work order to closed because:'), _('The SQL used to close the work order was:'), true);
    $DeleteAnyWOSerialNos = DB_query('DELETE FROM woserialnos WHERE wo=' . $_POST['WO'], $db, _('Could not delete the predefined work order serial numbers'), _('The SQL used to delete the predefined serial numbers was:'), true);
    $TransResult = DB_Txn_Commit($db);
    if ($_SESSION['CompanyRecord']['gllink_stock'] == 1) {
        if ($_SESSION['WeightedAverageCosting'] == 1) {
            prnMsg(_('The item cost as calculated from the work order has been applied against the weighted average cost and the necessary GL journals created to update stock as a result of closing this work order'), 'success');
        } else {
            prnMsg(_('The work order has been closed and general ledger entries made for the variances on the work order'), 'success');
        }
    } else {
        if ($_SESSION['WeightedAverageCosting'] == 1) {
            prnMsg(_('The item costs resulting from the work order have been applied against the weighted average stock value of the items on the work order, and the work order has been closed'), 'success');
        } else {
            prnMsg(_('The work order has been closed'), 'success');
        }
    }
    $WorkOrderRow['closed'] = 1;
}
开发者ID:stateless,项目名称:weberp-cvs,代码行数:31,代码来源:WorkOrderCosting.php

示例11: DB_query

         $result = DB_query($sql, $db, $ErrMsg);
     }
 }
 //What about cost data?
 //get any existing cost data
 $sql = "SELECT materialcost,\n                                        labourcost,\n                                        overheadcost,\n                                        mbflag,\n                                        sum(quantity) as totalqoh\n                                FROM stockmaster INNER JOIN locstock\n                                ON stockmaster.stockid=locstock.stockid\n                                WHERE stockmaster.stockid='" . $_POST['OldStockID'] . "'\n                                GROUP BY description,\n                                        units,\n                                        lastcost,\n                                        actualcost,\n                                        materialcost,\n                                        labourcost,\n                                        overheadcost,\n                                        mbflag";
 $ErrMsg = _('The entered item code does not exist');
 $OldResult = DB_query($sql, $db, $ErrMsg);
 $OldRow = DB_fetch_array($OldResult);
 //now update cloned item costs
 $Result = DB_Txn_Begin($db);
 $SQL = "UPDATE stockmaster SET\tmaterialcost='" . $OldRow['materialcost'] . "',\n\t\t\t\t\t\t\t\t\t\tlabourcost     ='" . $OldRow['labourcost'] . "',\n\t\t\t\t\t\t\t\t\t\toverheadcost   ='" . $OldRow['overheadcost'] . "',\n\t\t\t\t\t\t\t\t\t\tlastcost       ='" . $OldRow['lastcost'] . "',\n\t\t\t\t\t\t\t\t\t\tlastcostupdate ='" . Date('Y-m-d') . "'\n\t\t\t\t\t\t\t\tWHERE stockid='" . $_POST['StockID'] . "'";
 $ErrMsg = _('The cost details for the cloned stock item could not be updated because');
 $DbgMsg = _('The SQL that failed was');
 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
 $Result = DB_Txn_Commit($db);
 //finish up
 if (DB_error_no($db) == 0) {
     prnMsg(_('New Cloned Item') . ' ' . '<a href="SelectProduct.php?StockID=' . $_POST['StockID'] . '">' . $_POST['StockID'] . '</a> ' . _('has been added to the database') . '<br />' . _('We also attempted to setup item purchase data and pricing.'));
     if ($NoPricingData == 1) {
         prnMsg(_('There is no pricing data to clone. Use the following link to add pricing.'));
     }
     prnMsg('<br />' . '<a target="_blank" href="Prices.php?Item=' . $_POST['StockID'] . '">' . _('Review Item Prices') . '</a> ', 'success');
     if ($NoPurchasingData == 1) {
         prnMsg(_('There is no purchasing data to clone .Use the following link to add purchasing data.'));
     }
     prnMsg('<br />' . '<a target="_blank" href="PurchData.php?StockID=' . $_POST['StockID'] . '">' . _('Review Item Purchase Data.') . '</a> ', 'success') . prnMsg(_('Costing was updated for this cloned item.') . '<br />' . '<a target="_blank" href="StockCostUpdate.php?StockID=' . $_POST['StockID'] . '">' . _('Review Item Cost') . '</a>', 'success');
     echo '<br />';
     unset($_POST['Description']);
     unset($_POST['LongDescription']);
     unset($_POST['EOQ']);
开发者ID:strollClouds,项目名称:snkStudy,代码行数:31,代码来源:StockClone.php

示例12: _

                $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL posting for the cost variance could not be inserted because');
                $DbgMsg = _('The following SQL to insert the GLTrans record was used');
                $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
                $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\tVALUES (29,\n\t\t\t\t\t\t\t'" . $WOCloseNo . "',\n\t\t\t\t\t\t\t'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t'" . $WORow['wipact'] . "',\n\t\t\t\t\t\t\t'" . $_POST['WO'] . ' - ' . $WORow['stockid'] . ' ' . _('share of cost variance') . "',\n\t\t\t\t\t\t\t'" . round($TotalCostVar * $ShareProportion, $_SESSION['CompanyRecord']['decimalplaces']) . "')";
                $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL posting for the WIP side of the cost variance posting could not be inserted because');
                $DbgMsg = _('The following SQL to insert the GLTrans record was used');
                $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
            }
            //end of if gl-stock integrated and there's a cost variance
        }
        //end of standard costing section
    }
    // end loop around the items on the work order
    $CloseWOResult = DB_query("UPDATE workorders SET closed=1, closecomments = '" . $_POST['CloseComments'] . "' WHERE wo='" . $_POST['WO'] . "'", _('Could not update the work order to closed because:'), _('The SQL used to close the work order was:'), true);
    $DeleteAnyWOSerialNos = DB_query("DELETE FROM woserialnos WHERE wo='" . $_POST['WO'] . "'", _('Could not delete the predefined work order serial numbers'), _('The SQL used to delete the predefined serial numbers was:'), true);
    $TransResult = DB_Txn_Commit();
    if ($_SESSION['CompanyRecord']['gllink_stock'] == 1) {
        if ($_SESSION['WeightedAverageCosting'] == 1) {
            prnMsg(_('The item cost as calculated from the work order has been applied against the weighted average cost and the necessary GL journals created to update stock as a result of closing this work order'), 'success');
        } else {
            prnMsg(_('The work order has been closed and general ledger entries made for the variances on the work order'), 'success');
        }
    } else {
        if ($_SESSION['WeightedAverageCosting'] == 1) {
            prnMsg(_('The item costs resulting from the work order have been applied against the weighted average stock value of the items on the work order, and the work order has been closed'), 'success');
        } else {
            prnMsg(_('The work order has been closed'), 'success');
        }
    }
    $WorkOrderRow['closed'] = 1;
}
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:WorkOrderCosting.php

示例13: gltrans

            /* Now calculate the Balance in functional currency at the new rate */
            $NewBalanceInFucntionalCurrency = $BalanceInAccountCurrency / $NewRate;
            /* If some adjustment has to be done, do it! */
            $DifferenceToAdjust = $NewBalanceInFucntionalCurrency - $OldBalanceInFunctionalCurrency;
            if ($OldRate != $NewRate) {
                $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\t\t  VALUES (36,\n\t\t\t\t\t\t\t\t\t\t\t'" . $ExDiffTransNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($PostingDate) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['CompanyRecord']['exchangediffact'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrowBankAccount['bankaccountname'] . ' ' . _('currency rate adjustment to') . ' ' . locale_number_format($NewRate, 8) . ' ' . $SelectedCurrency . '/' . $_SESSION['CompanyRecord']['currencydefault'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . -$DifferenceToAdjust . "')";
                $ErrMsg = _('Cannot insert a GL entry for the exchange difference because');
                $DbgMsg = _('The SQL that failed to insert the exchange difference GL entry was');
                $result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
                $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\t\t  VALUES (36,\n\t\t\t\t\t\t\t\t\t\t\t'" . $ExDiffTransNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($PostingDate) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrowBankAccount['accountcode'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrowBankAccount['bankaccountname'] . ' ' . _('currency rate adjustment to') . ' ' . locale_number_format($NewRate, 8) . ' ' . $SelectedCurrency . '/' . $_SESSION['CompanyRecord']['currencydefault'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $DifferenceToAdjust . "')";
                $result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
                prnMsg(_('Bank Account') . ' ' . $myrowBankAccount['bankaccountname'] . ' ' . _('Currency Rate difference of') . ' ' . locale_number_format($DifferenceToAdjust, $_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'), 'success');
            }
        }
    }
    $resultTx = DB_Txn_Commit();
    unset($SelectedCurrency);
    unset($_POST['Country']);
    unset($_POST['HundredsName']);
    unset($_POST['DecimalPlaces']);
    unset($_POST['ExchangeRate']);
    unset($_POST['Abbreviation']);
    unset($_POST['webcart']);
} elseif (isset($_GET['delete'])) {
    //the link to delete a selected record was clicked instead of the submit button
    // PREVENT DELETES IF DEPENDENT RECORDS IN DebtorsMaster
    $sql = "SELECT COUNT(*) FROM debtorsmaster\n\t\t\tWHERE currcode = '" . $SelectedCurrency . "'";
    $result = DB_query($sql);
    $myrow = DB_fetch_row($result);
    if ($myrow[0] > 0) {
        prnMsg(_('Cannot delete this currency because customer accounts have been created referring to this currency') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this currency'), 'warn');
开发者ID:sjhelios,项目名称:trikemindo,代码行数:31,代码来源:Currencies.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: gltrans

            /* Now calculate the Balance in functional currency at the new rate */
            $NewBalanceInFucntionalCurrency = $BalanceInAccountCurrency / $NewRate;
            /* If some adjustment has to be done, do it! */
            $DifferenceToAdjust = $NewBalanceInFucntionalCurrency - $OldBalanceInFunctionalCurrency;
            if (OldRate != NewRate) {
                $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\t\t  VALUES (36,\n\t\t\t\t\t\t\t\t\t\t\t'" . $ExDiffTransNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($PostingDate) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['CompanyRecord']['exchangediffact'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrowBankAccount['bankaccountname'] . ' ' . _('currency rate adjustment to') . ' ' . locale_number_format($NewRate, 8) . ' ' . $SelectedCurrency . '/' . $_SESSION['CompanyRecord']['currencydefault'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . -$DifferenceToAdjust . "')";
                $ErrMsg = _('Cannot insert a GL entry for the exchange difference because');
                $DbgMsg = _('The SQL that failed to insert the exchange difference GL entry was');
                $result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
                $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\t\t  VALUES (36,\n\t\t\t\t\t\t\t\t\t\t\t'" . $ExDiffTransNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($PostingDate) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrowBankAccount['accountcode'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrowBankAccount['bankaccountname'] . ' ' . _('currency rate adjustment to') . ' ' . locale_number_format($NewRate, 8) . ' ' . $SelectedCurrency . '/' . $_SESSION['CompanyRecord']['currencydefault'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $DifferenceToAdjust . "')";
                $result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
                prnMsg(_('Bank Account') . ' ' . $myrowBankAccount['bankaccountname'] . ' ' . _('Currency Rate difference of') . ' ' . locale_number_format($DifferenceToAdjust, $_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'), 'success');
            }
        }
    }
    $resultTx = DB_Txn_Commit($db);
    unset($SelectedCurrency);
    unset($_POST['Country']);
    unset($_POST['HundredsName']);
    unset($_POST['DecimalPlaces']);
    unset($_POST['ExchangeRate']);
    unset($_POST['Abbreviation']);
    unset($_POST['webcart']);
} elseif (isset($_GET['delete'])) {
    //the link to delete a selected record was clicked instead of the submit button
    // PREVENT DELETES IF DEPENDENT RECORDS IN DebtorsMaster
    $sql = "SELECT COUNT(*) FROM debtorsmaster\n\t\t\tWHERE currcode = '" . $SelectedCurrency . "'";
    $result = DB_query($sql, $db);
    $myrow = DB_fetch_row($result);
    if ($myrow[0] > 0) {
        prnMsg(_('Cannot delete this currency because customer accounts have been created referring to this currency') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this currency'), 'warn');
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:Currencies.php


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