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


PHP filter_number_format函数代码示例

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


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

示例1: DB_query

    if ($_POST['StockCat'] != 'All') {
        $CategorySQL = "SELECT categorydescription FROM stockcategory WHERE categoryid='" . $_POST['StockCat'] . "'";
        $CategoryResult = DB_query($CategorySQL, $db);
        $CategoryRow = DB_fetch_array($CategoryResult);
        $CategoryDescription = $CategoryRow['categorydescription'];
        $WhereCategory = " AND stockmaster.categoryid ='" . $_POST['StockCat'] . "' ";
    } else {
        $CategoryDescription = _('All');
        $WhereCategory = " ";
    }
    // If Strategy is "Items needed at TO location with overstock at FROM" we need to control the "needed at TO" part
    // The "overstock at FROM" part is controlled in any case with AND (fromlocstock.quantity - fromlocstock.reorderlevel) > 0
    if ($_POST['Strategy'] == 'All') {
        $WhereCategory = $WhereCategory . " AND locstock.reorderlevel > locstock.quantity ";
    }
    $sql = "SELECT locstock.stockid,\n\t\t\t\tstockmaster.description,\n\t\t\t\tlocstock.loccode,\n\t\t\t\tlocstock.quantity,\n\t\t\t\tlocstock.reorderlevel,\n\t\t\t\tstockmaster.decimalplaces,\n\t\t\t\tstockmaster.serialised,\n\t\t\t\tstockmaster.controlled,\n\t\t\t\tstockmaster.discountcategory,\n\t\t\t\tROUND((locstock.reorderlevel - locstock.quantity) *\n\t\t\t\t   (1 + (" . filter_number_format($_POST['Percent']) . "/100)))\n\t\t\t\tas neededqty,\n\t\t\t   (fromlocstock.quantity - fromlocstock.reorderlevel)  as available,\n\t\t\t   fromlocstock.reorderlevel as fromreorderlevel,\n\t\t\t   fromlocstock.quantity as fromquantity\n\t\t\tFROM stockmaster\n\t\t\tLEFT JOIN stockcategory\n\t\t\t\tON stockmaster.categoryid=stockcategory.categoryid,\n\t\t\tlocstock\n\t\t\tLEFT JOIN locstock AS fromlocstock ON\n\t\t\t  locstock.stockid = fromlocstock.stockid\n\t\t\t  AND fromlocstock.loccode = '" . $_POST['FromLocation'] . "'\n\t\t\tWHERE locstock.stockid=stockmaster.stockid\n\t\t\tAND locstock.loccode ='" . $_POST['ToLocation'] . "'\n\t\t\tAND (fromlocstock.quantity - fromlocstock.reorderlevel) > 0\n\t\t\tAND stockcategory.stocktype<>'A'\n\t\t\tAND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') " . $WhereCategory . " ORDER BY locstock.loccode,locstock.stockid";
    $result = DB_query($sql, $db, '', '', false, true);
    if (DB_error_no($db) != 0) {
        $Title = _('Stock Dispatch - Problem Report');
        include 'includes/header.inc';
        prnMsg(_('The Stock Dispatch report could not be retrieved by the SQL because') . ' ' . DB_error_msg($db), 'error');
        echo '<br />
				<a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>';
        if ($debug == 1) {
            echo '<br />' . $sql;
        }
        include 'includes/footer.inc';
        exit;
    }
    if (DB_num_rows($result) == 0) {
        $Title = _('Stock Dispatch - Problem Report');
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:StockDispatch.php

示例2: _

$ViewTopic = 'Inventory';
$BookMark = 'FulfilRequest';
include 'includes/header.inc';
include 'includes/SQL_CommonFunctions.inc';
echo '<p class="page_title_text noPrint" ><img src="' . $RootPath . '/css/' . $Theme . '/images/inventory.png" title="' . _('Contract') . '" alt="" />' . _('Fulfil Stock Requests') . '</p>';
if (isset($_POST['UpdateAll'])) {
    foreach ($_POST as $key => $value) {
        if (mb_strpos($key, 'Qty')) {
            $RequestID = mb_substr($key, 0, mb_strpos($key, 'Qty'));
            $LineID = mb_substr($key, mb_strpos($key, 'Qty') + 3);
            $Quantity = filter_number_format($_POST[$RequestID . 'Qty' . $LineID]);
            $StockID = $_POST[$RequestID . 'StockID' . $LineID];
            $Location = $_POST[$RequestID . 'Location' . $LineID];
            $Department = $_POST[$RequestID . 'Department' . $LineID];
            $Tag = $_POST[$RequestID . 'Tag' . $LineID];
            $RequestedQuantity = filter_number_format($_POST[$RequestID . 'RequestedQuantity' . $LineID]);
            if (isset($_POST[$RequestID . 'Completed' . $LineID])) {
                $Completed = True;
            } else {
                $Completed = False;
            }
            $sql = "SELECT materialcost, labourcost, overheadcost, decimalplaces FROM stockmaster WHERE stockid='" . $StockID . "'";
            $result = DB_query($sql, $db);
            $myrow = DB_fetch_array($result);
            $StandardCost = $myrow['materialcost'] + $myrow['labourcost'] + $myrow['overheadcost'];
            $DecimalPlaces = $myrow['decimalplaces'];
            $Narrative = _('Issue') . ' ' . $Quantity . ' ' . _('of') . ' ' . $StockID . ' ' . _('to department') . ' ' . $Department . ' ' . _('from') . ' ' . $Location;
            $AdjustmentNumber = GetNextTransNo(17, $db);
            $PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
            $SQLAdjustmentDate = FormatDateForSQL(Date($_SESSION['DefaultDateFormat']));
            $Result = DB_Txn_Begin($db);
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:InternalStockRequestFulfill.php

示例3: DB_query

         if ($DescriptionLanguage != '') {
             $result = DB_query("INSERT INTO stockdescriptiontranslations VALUES('" . $_POST['StockID'] . "','" . $DescriptionLanguage . "', '" . $_POST['Description_' . str_replace('.', '_', $DescriptionLanguage)] . "')", $db, $ErrMsg, $DbgMsg, true);
         }
     }
 }
 //now insert any item properties
 for ($i = 0; $i < $_POST['PropertyCounter']; $i++) {
     if ($_POST['PropType' . $i] == 2) {
         if ($_POST['PropValue' . $i] == 'on') {
             $_POST['PropValue' . $i] = 1;
         } else {
             $_POST['PropValue' . $i] = 0;
         }
     }
     if ($_POST['PropNumeric' . $i] == 1) {
         $_POST['PropValue' . $i] = filter_number_format($_POST['PropValue' . $i]);
     } else {
         $_POST['PropValue' . $i] = $_POST['PropValue' . $i];
     }
     $result = DB_query("INSERT INTO stockitemproperties (stockid,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstkcatpropid,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue)\n\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $_POST['StockID'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['PropID' . $i] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['PropValue' . $i] . "')", $db, $ErrMsg, $DbgMsg, true);
 }
 //end of loop around properties defined for the category
 //Add data to locstock
 $sql = "INSERT INTO locstock (loccode,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstockid)\n\t\t\t\t\t\t\t\t\t\tSELECT locations.loccode,\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['StockID'] . "'\n\t\t\t\t\t\t\t\t\t\tFROM locations";
 $ErrMsg = _('The locations for the item') . ' ' . $_POST['StockID'] . ' ' . _('could not be added because');
 $DbgMsg = _('NB Locations records can be added by opening the utility page') . ' <i>Z_MakeStockLocns.php</i> ' . _('The SQL that was used to add the location records that failed was');
 $InsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
 DB_Txn_Commit($db);
 //check for any purchase data
 $sql = "SELECT purchdata.supplierno,\n                                suppliers.suppname,\n                                purchdata.price,\n                                suppliers.currcode,\n                                purchdata.effectivefrom,\n                                purchdata.suppliersuom,\n                                purchdata.supplierdescription,\n                                purchdata.leadtime,\n                                purchdata.suppliers_partno,\n                                purchdata.minorderqty,\n                                purchdata.preferred,\n                                purchdata.conversionfactor,\n                                currencies.decimalplaces AS currdecimalplaces\n                            FROM purchdata INNER JOIN suppliers\n                                ON purchdata.supplierno=suppliers.supplierid\n                            INNER JOIN currencies\n                                ON suppliers.currcode=currencies.currabrev\n                            WHERE purchdata.stockid = '" . $_POST['OldStockID'] . "'\n                            ORDER BY purchdata.effectivefrom DESC";
 $ErrMsg = _('The supplier purchasing details for the selected part could not be retrieved because');
开发者ID:strollClouds,项目名称:snkStudy,代码行数:31,代码来源:StockClone.php

示例4: foreach

 foreach ($_SESSION['SuppTrans']->Taxes as $Tax) {
     /*Set the tax rate to what was entered */
     if (isset($_POST['TaxRate' . $Tax->TaxCalculationOrder])) {
         $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate = filter_number_format($_POST['TaxRate' . $Tax->TaxCalculationOrder]) / 100;
     }
     if ($_POST['OverRideTax'] == 'Auto' or !isset($_POST['OverRideTax'])) {
         /*Now recaluclate the tax depending on the method */
         if ($Tax->TaxOnTax == 1) {
             $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * ($_SESSION['SuppTrans']->OvAmount + $TaxTotal);
         } else {
             /*Calculate tax without the tax on tax */
             $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * $_SESSION['SuppTrans']->OvAmount;
         }
     } else {
         /*Tax being entered manually accept the taxamount entered as is*/
         $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = filter_number_format($_POST['TaxAmount' . $Tax->TaxCalculationOrder]);
     }
     $TaxTotal += $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount;
 }
 $InputError = False;
 if ($TaxTotal + $_SESSION['SuppTrans']->OvAmount <= 0) {
     $InputError = True;
     prnMsg(_('The credit note as entered cannot be processed because the total amount of the credit note is less than or equal to 0') . '. ' . _('Credit notes are expected to be entered as positive amounts to credit'), 'warn');
 } elseif (mb_strlen($_SESSION['SuppTrans']->SuppReference) < 1) {
     $InputError = True;
     prnMsg(_('The credit note as entered cannot be processed because the there is no suppliers credit note number or reference entered') . '. ' . _('The supplier credit note number must be entered'), 'error');
 } elseif (!Is_Date($_SESSION['SuppTrans']->TranDate)) {
     $InputError = True;
     prnMsg(_('The credit note as entered cannot be processed because the date entered is not in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
 } elseif (DateDiff(Date($_SESSION['DefaultDateFormat']), $_SESSION['SuppTrans']->TranDate, 'd') < 0) {
     $InputError = True;
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:SupplierCredit.php

示例5: stockcatproperties

         } else {
             $_POST['PropNumeric' . $i] = 0;
         }
         if (!isset($_POST['PropMinimum' . $i]) or $_POST['PropMinimum' . $i] === '') {
             $_POST['PropMinimum' . $i] = '-999999999';
         }
         if (!isset($_POST['PropMaximum' . $i]) or $_POST['PropMaximum' . $i] === '') {
             $_POST['PropMaximum' . $i] = '999999999';
         }
         if ($_POST['PropID' . $i] == 'NewProperty' and mb_strlen($_POST['PropLabel' . $i]) > 0) {
             $sql = "INSERT INTO stockcatproperties (categoryid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontroltype,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefaultvalue,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tminimumvalue,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaximumvalue,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumericvalue,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treqatsalesorder)\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $SelectedCategory . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['PropLabel' . $i] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t" . $_POST['PropControlType' . $i] . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['PropDefault' . $i] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . filter_number_format($_POST['PropMinimum' . $i]) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . filter_number_format($_POST['PropMaximum' . $i]) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['PropNumeric' . $i] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t" . $_POST['PropReqSO' . $i] . ')';
             $ErrMsg = _('Could not insert a new category property for') . $_POST['PropLabel' . $i];
             $result = DB_query($sql, $ErrMsg);
         } elseif ($_POST['PropID' . $i] != 'NewProperty') {
             //we could be amending existing properties
             $sql = "UPDATE stockcatproperties SET label ='" . $_POST['PropLabel' . $i] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t  controltype = " . $_POST['PropControlType' . $i] . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t  defaultvalue = '" . $_POST['PropDefault' . $i] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t  minimumvalue = '" . filter_number_format($_POST['PropMinimum' . $i]) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t  maximumvalue = '" . filter_number_format($_POST['PropMaximum' . $i]) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t  numericvalue = '" . $_POST['PropNumeric' . $i] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t  reqatsalesorder = " . $_POST['PropReqSO' . $i] . "\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE stkcatpropid =" . $_POST['PropID' . $i];
             $ErrMsg = _('Updated the stock category property for') . ' ' . $_POST['PropLabel' . $i];
             $result = DB_query($sql, $ErrMsg);
         }
     }
     //end of loop round properties
     prnMsg(_('Updated the stock category record for') . ' ' . $_POST['CategoryDescription'], 'success');
 } elseif ($InputError != 1) {
     /*Selected category is null cos no item selected on first time round so must be adding a	record must be submitting new entries in the new stock category form */
     $sql = "INSERT INTO stockcategory (categoryid,\n\t\t\t\t\t\t\t\t\t\t\tstocktype,\n\t\t\t\t\t\t\t\t\t\t\tcategorydescription,\n\t\t\t\t\t\t\t\t\t\t\tdefaulttaxcatid,\n\t\t\t\t\t\t\t\t\t\t\tstockact,\n\t\t\t\t\t\t\t\t\t\t\tadjglact,\n\t\t\t\t\t\t\t\t\t\t\tissueglact,\n\t\t\t\t\t\t\t\t\t\t\tpurchpricevaract,\n\t\t\t\t\t\t\t\t\t\t\tmaterialuseagevarac,\n\t\t\t\t\t\t\t\t\t\t\twipact)\n\t\t\t\t\t\t\t\t\t\tVALUES ('" . $_POST['CategoryID'] . "','" . $_POST['StockType'] . "','" . $_POST['CategoryDescription'] . "','" . $_POST['DefaultTaxCatID'] . "','" . $_POST['StockAct'] . "','" . $_POST['AdjGLAct'] . "','" . $_POST['IssueGLAct'] . "','" . $_POST['PurchPriceVarAct'] . "','" . $_POST['MaterialUseageVarAc'] . "','" . $_POST['WIPAct'] . "')";
     $ErrMsg = _('Could not insert the new stock category') . $_POST['CategoryDescription'] . _('because');
     $result = DB_query($sql, $ErrMsg);
     prnMsg(_('A new stock category record has been added for') . ' ' . $_POST['CategoryDescription'], 'success');
 }
 //run the SQL from either of the above possibilites
 unset($_POST['StockType']);
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:StockCategories.php

示例6: DateAdd

                      */
                     $DeliveryDate = DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', $LeadTime);
                     if (!Date1GreaterThanDate2($DeliveryDate, $_SESSION['PO' . $identifier]->DeliveryDate)) {
                         $DeliveryDate = $_SESSION['PO' . $identifier]->DeliveryDate;
                     }
                 } else {
                     // no purchasing data setup
                     $PurchPrice = 0;
                     $ConversionFactor = 1;
                     $SupplierDescription = $ItemRow['description'];
                     $SuppliersUnitOfMeasure = $ItemRow['units'];
                     $SuppliersPartNo = '';
                     $LeadTime = 1;
                     $DeliveryDate = $_SESSION['PO' . $identifier]->DeliveryDate;
                 }
                 $_SESSION['PO' . $identifier]->add_to_order($_SESSION['PO' . $identifier]->LinesOnOrder + 1, $ItemCode, 0, 0, filter_number_format($Quantity) * $ConversionFactor, $SupplierDescription, $PurchPrice, $ItemRow['units'], $ItemRow['stockact'], $DeliveryDate, 0, 0, 0, 0, 0, $ItemRow['accountname'], $ItemRow['decimalplaces'], $SuppliersUnitOfMeasure, $ConversionFactor, $LeadTime, $SuppliersPartNo);
             } else {
                 //no rows returned by the SQL to get the item
                 prnMsg(_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the order'), 'error');
                 if ($debug == 1) {
                     echo '<br />' . $sql;
                 }
                 include 'includes/footer.inc';
                 exit;
             }
         }
         /* end of if not already on the order */
     }
     /* end if the $_POST has NewQty in the variable name */
 }
 /* end loop around the $_POST array */
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:PO_Items.php

示例7: _

}
include 'includes/session.inc';
$Title = _('Tax Rates');
include 'includes/header.inc';
echo '<p class="page_title_text noPrint" >
		<img src="' . $RootPath . '/css/' . $Theme . '/images/maintenance.png" title="' . _('Supplier Types') . '" alt="" />' . $Title . '
	</p>';
if (!isset($TaxAuthority)) {
    prnMsg(_('This page can only be called after selecting the tax authority to edit the rates for') . '. ' . _('Please select the Rates link from the tax authority page') . '<br /><a href="' . $RootPath . '/TaxAuthorities.php">' . _('click here') . '</a> ' . _('to go to the Tax Authority page'), 'error');
    include 'includes/footer.inc';
    exit;
}
if (isset($_POST['UpdateRates'])) {
    $TaxRatesResult = DB_query("SELECT taxauthrates.taxcatid,\n\t\t\t\t\t\t\t\t\t\ttaxauthrates.taxrate,\n\t\t\t\t\t\t\t\t\t\ttaxauthrates.dispatchtaxprovince\n\t\t\t\t\t\t\t\tFROM taxauthrates\n\t\t\t\t\t\t\t\tWHERE taxauthrates.taxauthority='" . $TaxAuthority . "'", $db);
    while ($myrow = DB_fetch_array($TaxRatesResult)) {
        $sql = "UPDATE taxauthrates SET taxrate=" . filter_number_format($_POST[$myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid']]) / 100 . "\n\t\t\t\t\t\tWHERE taxcatid = '" . $myrow['taxcatid'] . "'\n\t\t\t\t\t\tAND dispatchtaxprovince = '" . $myrow['dispatchtaxprovince'] . "'\n\t\t\t\t\t\tAND taxauthority = '" . $TaxAuthority . "'";
        DB_query($sql, $db);
    }
    prnMsg(_('All rates updated successfully'), 'info');
}
/* end of update code
 */
/*Display updated rates
 */
$TaxAuthDetail = DB_query("SELECT description\n\t\t\t\t\t\t\tFROM taxauthorities WHERE taxid='" . $TaxAuthority . "'", $db);
$myrow = DB_fetch_row($TaxAuthDetail);
echo '<form onSubmit="return VerifyForm(this);" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post" class="noPrint">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<input type="hidden" name="TaxAuthority" value="' . $TaxAuthority . '" />';
$TaxRatesResult = DB_query("SELECT taxauthrates.taxcatid,\n\t\t\t\t\t\t\t\t\ttaxcategories.taxcatname,\n\t\t\t\t\t\t\t\t\ttaxauthrates.taxrate,\n\t\t\t\t\t\t\t\t\ttaxauthrates.dispatchtaxprovince,\n\t\t\t\t\t\t\t\t\ttaxprovinces.taxprovincename\n\t\t\t\t\t\t\tFROM taxauthrates INNER JOIN taxauthorities\n\t\t\t\t\t\t\tON taxauthrates.taxauthority=taxauthorities.taxid\n\t\t\t\t\t\t\tINNER JOIN taxprovinces\n\t\t\t\t\t\t\tON taxauthrates.dispatchtaxprovince= taxprovinces.taxprovinceid\n\t\t\t\t\t\t\tINNER JOIN taxcategories\n\t\t\t\t\t\t\tON taxauthrates.taxcatid=taxcategories.taxcatid\n\t\t\t\t\t\t\tWHERE taxauthrates.taxauthority='" . $TaxAuthority . "'\n\t\t\t\t\t\t\tORDER BY taxauthrates.dispatchtaxprovince,\n\t\t\t\t\t\t\ttaxauthrates.taxcatid", $db);
if (isset($_SESSION['FirstStart'])) {
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:TaxAuthorityRates.php

示例8: prnMsg

            if (filter_number_format($_POST['Amt' . $AllocCounter]) < 0) {
                prnMsg(_('Amount entered was negative') . '. ' . _('Only positive amounts are allowed') . '.', 'warn');
                $_POST['Amt' . $AllocCounter] = 0;
            }
            if (isset($_POST['All' . $AllocCounter]) and $_POST['All' . $AllocCounter] == True) {
                $_POST['Amt' . $AllocCounter] = $_POST['YetToAlloc' . $AllocCounter];
            }
            if (filter_number_format($_POST['Amt' . $AllocCounter]) > $_POST['YetToAlloc' . $AllocCounter]) {
                $_POST['Amt' . $AllocCounter] = locale_number_format($_POST['YetToAlloc' . $AllocCounter], $_SESSION['Alloc']->CurrDecimalPlaces);
                // Amount entered must be smaller than unallocated amount
            }
            $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->AllocAmt = filter_number_format($_POST['Amt' . $AllocCounter]);
            // recalcuate the new difference on exchange (a +positive amount is a gain -ve a loss)
            $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->DiffOnExch = filter_number_format($_POST['Amt' . $AllocCounter]) / $_SESSION['Alloc']->TransExRate - filter_number_format($_POST['Amt' . $AllocCounter]) / $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->ExRate;
            $TotalDiffOnExch += $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->DiffOnExch;
            $TotalAllocated += filter_number_format($_POST['Amt' . $AllocCounter]);
        }
    }
    if ($TotalAllocated + $_SESSION['Alloc']->TransAmt > 0.008) {
        prnMsg(_('Allocation could not be processed because the amount allocated is more than the') . ' ' . $_SESSION['Alloc']->TransTypeName . ' ' . _('being allocated') . '<br />' . _('Total allocated') . ' = ' . $TotalAllocated . ' ' . _('and the total amount of the') . ' ' . $_SESSION['Alloc']->TransTypeName . ' ' . _('was') . ' ' . -$_SESSION['Alloc']->TransAmt, 'error');
        $InputError = 1;
    }
}
if (isset($_POST['UpdateDatabase'])) {
    if ($InputError == 0) {
        //
        //========[ START TRANSACTION ]===========
        //
        $Error = '';
        $Result = DB_Txn_Begin($db);
        $AllAllocations = 0;
开发者ID:strollClouds,项目名称:snkStudy,代码行数:31,代码来源:CustomerAllocations.php

示例9: _

    echo '<p class="page_title_text" align="center"><strong>' . _('No Sales Items') . '</strong></p>';
    echo '<form action="PDFNoSalesItems.php"  method="GET">
		<table class="selection">';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    $TableHeader = '<tr>
						<th>' . _('No') . '</th>
						<th>' . _('Location') . '</th>
						<th>' . _('Code') . '</th>
						<th>' . _('Description') . '</th>
						<th>' . _('Location QOH') . '</th>
						<th>' . _('Total QOH') . '</th>
						<th>' . _('Units') . '</th>
					</tr>';
    echo $TableHeader;
    echo '<input type="hidden" value="' . $_POST['Location'] . '" name="Location" />
			<input type="hidden" value="' . filter_number_format($_POST['NumberOfDays']) . '" name="NumberOfDays" />
			<input type="hidden" value="' . $_POST['Customers'] . '" name="Customers" />';
    $k = 0;
    //row colour counter
    $i = 1;
    while ($myrow = DB_fetch_array($result)) {
        if ($k == 1) {
            echo '<tr class="EvenTableRows">';
            $k = 0;
        } else {
            echo '<tr class="OddTableRows">';
            $k = 1;
        }
        $QOHResult = DB_query("SELECT sum(quantity)\n\t\t\t\tFROM locstock\n\t\t\t\tINNER JOIN locationusers ON locationusers.loccode=locstock.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1\n\t\t\t\tWHERE stockid = '" . $myrow['stockid'] . "'" . $WhereLocation);
        $QOHRow = DB_fetch_row($QOHResult);
        $QOH = $QOHRow[0];
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:NoSalesItems.php

示例10: LevelNetting

function LevelNetting(&$db, $part, $eoq, $PanSize, $ShrinkFactor, $LeadTime)
{
    // Create an array of mrprequirements and an array of mrpsupplies, then read through
    // them seeing if all requirements are covered by supplies. Create a planned order
    // for any unmet requirements. Change dates if necessary for the supplies.
    //echo '<br />Part is ' . "$part" . '<br />';
    // Get decimal places from stockmaster for rounding of shrinkage factor
    $sql = "SELECT decimalplaces FROM stockmaster WHERE stockid = '" . $part . "'";
    $result = DB_query($sql, $db);
    $myrow = DB_fetch_row($result);
    $DecimalPlaces = $myrow[0];
    // Load mrprequirements into $Requirements array
    $sql = "SELECT * FROM mrprequirements WHERE part = '" . $part . "' ORDER BY daterequired";
    $result = DB_query($sql, $db);
    $Requirements = array();
    $i = 0;
    while ($myrow = DB_fetch_array($result)) {
        array_push($Requirements, $myrow);
        $i++;
    }
    //end of while loop
    // Load mrpsupplies into $Supplies array
    $sql = "SELECT * FROM mrpsupplies WHERE part = '" . $part . "' ORDER BY duedate";
    $result = DB_query($sql, $db);
    $Supplies = array();
    $i = 0;
    while ($myrow = DB_fetch_array($result)) {
        array_push($Supplies, $myrow);
        $i++;
    }
    //end of while loop
    // Go through all requirements and check if have supplies to cover them
    $RequirementCount = count($Requirements);
    $SupplyCount = count($Supplies);
    $reqi = 0;
    //Index for requirements
    $supi = 0;
    // index for supplies
    $TotalRequirement = 0;
    $TotalSupply = 0;
    if ($RequirementCount > 0 && $SupplyCount > 0) {
        $TotalRequirement += $Requirements[$reqi]['quantity'];
        $TotalSupply += $Supplies[$supi]['supplyquantity'];
        while ($TotalRequirement > 0 && $TotalSupply > 0) {
            $Supplies[$supi]['updateflag'] = 1;
            // ******** Put leeway calculation in here ********
            $DueDate = ConvertSQLDate($Supplies[$supi]['duedate']);
            $ReqDate = ConvertSQLDate($Requirements[$reqi]['daterequired']);
            $DateDiff = DateDiff($DueDate, $ReqDate, 'd');
            //if ($Supplies[$supi]['duedate'] > $Requirements[$reqi]['daterequired']) {
            if ($DateDiff > abs(filter_number_format($_POST['Leeway']))) {
                $sql = "UPDATE mrpsupplies SET mrpdate = '" . $Requirements[$reqi]['daterequired'] . "' WHERE id = '" . $Supplies[$supi]['id'] . "' AND duedate = mrpdate";
                $result = DB_query($sql, $db);
            }
            if ($TotalRequirement > $TotalSupply) {
                $TotalRequirement -= $TotalSupply;
                $Requirements[$reqi]['quantity'] -= $TotalSupply;
                $TotalSupply = 0;
                $Supplies[$supi]['supplyquantity'] = 0;
                $supi++;
                if ($SupplyCount > $supi) {
                    $TotalSupply += $Supplies[$supi]['supplyquantity'];
                }
            } elseif ($TotalRequirement < $TotalSupply) {
                $TotalSupply -= $TotalRequirement;
                $Supplies[$supi]['supplyquantity'] -= $TotalRequirement;
                $TotalRequirement = 0;
                $Requirements[$reqi]['quantity'] = 0;
                $reqi++;
                if ($RequirementCount > $reqi) {
                    $TotalRequirement += $Requirements[$reqi]['quantity'];
                }
            } else {
                $TotalSupply -= $TotalRequirement;
                $Supplies[$supi]['supplyquantity'] -= $TotalRequirement;
                $TotalRequirement = 0;
                $Requirements[$reqi]['quantity'] = 0;
                $reqi++;
                if ($RequirementCount > $reqi) {
                    $TotalRequirement += $Requirements[$reqi]['quantity'];
                }
                $TotalRequirement -= $TotalSupply;
                $Requirements[$reqi]['quantity'] -= $TotalSupply;
                $TotalSupply = 0;
                $Supplies[$supi]['supplyquantity'] = 0;
                $supi++;
                if ($SupplyCount > $supi) {
                    $TotalSupply += $Supplies[$supi]['supplyquantity'];
                }
            }
            // End of if $TotalRequirement > $TotalSupply
        }
        // End of while
    }
    // End of if
    // When get to this part of code, have gone through all requirements, If there is any
    // unmet requirements, create an mrpplannedorder to cover it. Also call the
    // CreateLowerLevelRequirement() function to create gross requirements for lower level parts.
    // There is an excess quantity if the eoq is higher than the actual required amount.
    // If there is a subsuquent requirement, the excess quantity is subtracted from that
//.........这里部分代码省略.........
开发者ID:strollClouds,项目名称:snkStudy,代码行数:101,代码来源:MRP.php

示例11: prnMsg

     prnMsg(_('A recurring order cannot be made from a quotation'), 'error');
 }
 if ($InputErrors == 0) {
     /*Error checks above all passed ok so lets go*/
     if ($NewRecurringOrder == 'Yes') {
         /* finally write the recurring order header to the database and then the line details*/
         $DelDate = FormatDateforSQL($_SESSION['Items' . $identifier]->DeliveryDate);
         $HeaderSQL = "INSERT INTO recurringsalesorders (\n\t\t\t\t\t\t\t\t\t\tdebtorno,\n\t\t\t\t\t\t\t\t\t\tbranchcode,\n\t\t\t\t\t\t\t\t\t\tcustomerref,\n\t\t\t\t\t\t\t\t\t\tcomments,\n\t\t\t\t\t\t\t\t\t\torddate,\n\t\t\t\t\t\t\t\t\t\tordertype,\n\t\t\t\t\t\t\t\t\t\tdeliverto,\n\t\t\t\t\t\t\t\t\t\tdeladd1,\n\t\t\t\t\t\t\t\t\t\tdeladd2,\n\t\t\t\t\t\t\t\t\t\tdeladd3,\n\t\t\t\t\t\t\t\t\t\tdeladd4,\n\t\t\t\t\t\t\t\t\t\tdeladd5,\n\t\t\t\t\t\t\t\t\t\tdeladd6,\n\t\t\t\t\t\t\t\t\t\tcontactphone,\n\t\t\t\t\t\t\t\t\t\tcontactemail,\n\t\t\t\t\t\t\t\t\t\tfreightcost,\n\t\t\t\t\t\t\t\t\t\tfromstkloc,\n\t\t\t\t\t\t\t\t\t\tshipvia,\n\t\t\t\t\t\t\t\t\t\tlastrecurrence,\n\t\t\t\t\t\t\t\t\t\tstopdate,\n\t\t\t\t\t\t\t\t\t\tfrequency,\n\t\t\t\t\t\t\t\t\t\tautoinvoice)\n\t\t\t\t\t\t\t\t\tvalues (\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DebtorNo . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->Branch . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->CustRef . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->Comments . "',\n\t\t\t\t\t\t\t\t\t\t'" . Date('Y-m-d H:i') . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DefaultSalesType . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DeliverTo . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DelAdd1 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DelAdd2 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DelAdd3 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DelAdd4 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DelAdd5 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->DelAdd6 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->PhoneNo . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->Email . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->FreightCost . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->Location . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items' . $identifier]->ShipVia . "',\n\t\t\t\t\t\t\t\t\t\t'" . FormatDateforSQL($_POST['StartDate']) . "',\n\t\t\t\t\t\t\t\t\t\t'" . FormatDateforSQL($_POST['StopDate']) . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Frequency'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['AutoInvoice'] . "')";
         $ErrMsg = _('The recurring order cannot be added because');
         $DbgMsg = _('The SQL that failed was');
         $InsertQryResult = DB_query($HeaderSQL, $ErrMsg, $DbgMsg, true);
         $RecurrOrderNo = DB_Last_Insert_ID($db, 'recurringsalesorders', 'recurrorderno');
         echo 'xxx' . $RecurrOrderNo;
         $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails (recurrorderno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstkcode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunitprice,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tquantity,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdiscountpercent,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnarrative)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES ('";
         foreach ($_SESSION['Items' . $identifier]->LineItems as $StockItem) {
             $LineItemsSQL = $StartOf_LineItemsSQL . $RecurrOrderNo . "',\n\t\t\t\t\t\t\t\t'" . $StockItem->StockID . "',\n\t\t\t\t\t\t\t\t'" . filter_number_format($StockItem->Price) . "',\n\t\t\t\t\t\t\t\t'" . filter_number_format($StockItem->Quantity) . "',\n\t\t\t\t\t\t\t\t'" . filter_number_format($StockItem->DiscountPercent) . "',\n\t\t\t\t\t\t\t\t'" . $StockItem->Narrative . "')";
             $Ins_LineItemResult = DB_query($LineItemsSQL, $ErrMsg, $DbgMsg, true);
         }
         /* inserted line items into sales order details */
         $result = DB_Txn_Commit();
         prnmsg(_('The new recurring order template has been added'), 'success');
     } else {
         /* must be updating an existing recurring order */
         $HeaderSQL = "UPDATE recurringsalesorders SET\n\t\t\t\t\t\tstopdate =  '" . FormatDateforSQL($_POST['StopDate']) . "',\n\t\t\t\t\t\tfrequency = '" . $_POST['Frequency'] . "',\n\t\t\t\t\t\tautoinvoice = '" . $_POST['AutoInvoice'] . "'\n\t\t\t\t\tWHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'";
         $ErrMsg = _('The recurring order cannot be updated because');
         $UpdateQryResult = DB_query($HeaderSQL, $ErrMsg);
         prnmsg(_('The recurring order template has been updated'), 'success');
     }
     echo '<p><a href="' . $RootPath . '/SelectOrderItems.php?NewOrder=Yes">' . _('Enter New Sales Order') . '</a>';
     echo '<p><a href="' . $RootPath . '/SelectRecurringSalesOrder.php">' . _('Select A Recurring Sales Order Template') . '</a>';
     unset($_SESSION['Items' . $identifier]->LineItems);
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:RecurringSalesOrders.php

示例12: InvoiceSalesOrder


//.........这里部分代码省略.........
                    if (empty($AssParts['standard'])) {
                        $AssParts['standard'] = 0;
                    }
                    $SQL = "INSERT INTO stockmoves (stockid,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransno,\n\t\t\t\t\t\t\t\t\t\t\t\t\tloccode,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdebtorno,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbranchcode,\n\t\t\t\t\t\t\t\t\t\t\t\t\tprd,\n\t\t\t\t\t\t\t\t\t\t\t\t\treference,\n\t\t\t\t\t\t\t\t\t\t\t\t\tqty,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstandardcost,\n\t\t\t\t\t\t\t\t\t\t\t\t\tshow_on_inv_crds,\n\t\t\t\t\t\t\t\t\t\t\t\t\tnewqoh)\n\t\t\t\t\t\t\t\t\t\tVALUES ('" . $AssParts['component'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t 10,\n\t\t\t\t\t\t\t\t\t\t\t\t '" . $InvoiceNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t '" . $OrderHeader['fromstkloc'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t '" . $DefaultDispatchDate . "',\n\t\t\t\t\t\t\t\t\t\t\t\t '" . $OrderHeader['debtorno'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t '" . $OrderHeader['branchcode'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t '" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t '" . _('Assembly') . ': ' . $OrderLineRow['stkcode'] . ' ' . _('Order') . ': ' . $OrderNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t '" . -$AssParts['quantity'] * $OrderLineRow['quantity'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t '" . $AssParts['standard'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t 0,\n\t\t\t\t\t\t\t\t\t\t\t\t '" . ($QtyOnHandPrior - $AssParts['quantity'] * $OrderLineRow['quantity']) . "'\t)";
                    $Result = DB_query($SQL, $db, '', '', true);
                    $SQL = "UPDATE locstock\n\t\t\t\t\t\t\tSET quantity = locstock.quantity - " . $AssParts['quantity'] * $OrderLineRow['quantity'] . "\n\t\t\t\t\t\t\tWHERE locstock.stockid = '" . $AssParts['component'] . "'\n\t\t\t\t\t\t\tAND loccode = '" . $OrderHeader['fromlocstk'] . "'";
                    $Result = DB_query($SQL, $db, '', '', true);
                }
                /* end of assembly explosion and updates */
            }
        }
        /* end of its an assembly */
        if ($OrderLineRow['mbflag'] == 'A' or $OrderLineRow['mbflag'] == 'D') {
            /*it's a Dummy/Service item or an Assembly item - still need stock movement record
             * but quantites on hand are always nil */
            $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'0' )";
            $Result = api_DB_query($SQL, $db, '', '', true);
        }
        /*Get the ID of the StockMove... */
        $StkMoveNo = DB_Last_Insert_ID($db, 'stockmoves', 'stkmoveno');
        /*Insert the taxes that applied to this line */
        foreach ($LineTaxes[$LineCounter] as $Tax) {
            $SQL = "INSERT INTO stockmovestaxes (stkmoveno,\n\t\t\t\t\t\t\t\t\ttaxauthid,\n\t\t\t\t\t\t\t\t\ttaxrate,\n\t\t\t\t\t\t\t\t\ttaxcalculationorder,\n\t\t\t\t\t\t\t\t\ttaxontax)\n\t\t\t\t\t\tVALUES ('" . $StkMoveNo . "',\n\t\t\t\t\t\t\t'" . $Tax['TaxAuthID'] . "',\n\t\t\t\t\t\t\t'" . $Tax['TaxRate'] . "',\n\t\t\t\t\t\t\t'" . $Tax['TaxCalculationOrder'] . "',\n\t\t\t\t\t\t\t'" . $Tax['TaxOnTax'] . "')";
            $Result = DB_query($SQL, $db, '', '', true);
        }
        /*Insert Sales Analysis records */
        $SQL = "SELECT COUNT(*),\n\t\t\t\t\t\tsalesanalysis.stkcategory,\n\t\t\t\t\t\tsalesanalysis.area,\n\t\t\t\t\t\tsalesanalysis.salesperson,\n\t\t\t\t\t\tsalesanalysis.periodno,\n\t\t\t\t\t\tsalesanalysis.typeabbrev,\n\t\t\t\t\t\tsalesanalysis.cust,\n\t\t\t\t\t\tsalesanalysis.custbranch,\n\t\t\t\t\t\tsalesanalysis.stockid\n\t\t\t\t\tFROM salesanalysis,\n\t\t\t\t\t\tcustbranch,\n\t\t\t\t\t\tstockmaster\n\t\t\t\t\tWHERE salesanalysis.stkcategory=stockmaster.categoryid\n\t\t\t\t\tAND salesanalysis.stockid=stockmaster.stockid\n\t\t\t\t\tAND salesanalysis.cust=custbranch.debtorno\n\t\t\t\t\tAND salesanalysis.custbranch=custbranch.branchcode\n\t\t\t\t\tAND salesanalysis.area=custbranch.area\n\t\t\t\t\tAND salesanalysis.salesperson=custbranch.salesman\n\t\t\t\t\tAND salesanalysis.typeabbrev ='" . $OrderHeader['ordertype'] . "'\n\t\t\t\t\tAND salesanalysis.periodno='" . $PeriodNo . "'\n\t\t\t\t\tAND salesanalysis.cust " . LIKE . "  '" . $OrderHeader['debtorno'] . "'\n\t\t\t\t\tAND salesanalysis.custbranch  " . LIKE . " '" . $OrderHeader['branchcode'] . "'\n\t\t\t\t\tAND salesanalysis.stockid  " . LIKE . " '" . $OrderLineRow['stkcode'] . "'\n\t\t\t\t\tAND salesanalysis.budgetoractual='1'\n\t\t\t\t\tGROUP BY salesanalysis.stockid,\n\t\t\t\t\t\tsalesanalysis.stkcategory,\n\t\t\t\t\t\tsalesanalysis.cust,\n\t\t\t\t\t\tsalesanalysis.custbranch,\n\t\t\t\t\t\tsalesanalysis.area,\n\t\t\t\t\t\tsalesanalysis.periodno,\n\t\t\t\t\t\tsalesanalysis.typeabbrev,\n\t\t\t\t\t\tsalesanalysis.salesperson";
        $ErrMsg = _('The count of existing Sales analysis records could not run because');
        $DbgMsg = _('SQL to count the no of sales analysis records');
        $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
        $myrow = DB_fetch_row($Result);
        if ($myrow[0] > 0) {
            /*Update the existing record that already exists */
            $SQL = "UPDATE salesanalysis\n\t\t\t\t\t\tSET amt=amt+" . filter_number_format($OrderLineRow['unitprice'] * $OrderLineRow['quantity'] / $OrderHeader['rate']) . ",\n\t\t\t\t\t\tqty=qty +" . $OrderLineRow['quantity'] . ",\n\t\t\t\t\t\tdisc=disc+" . filter_number_format($OrderLineRow['discountpercent'] * $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] / $OrderHeader['rate']) . "\n\t\t\t\t\t\tWHERE salesanalysis.area='" . $myrow[2] . "'\n\t\t\t\t\t\tAND salesanalysis.salesperson='" . $myrow[3] . "'\n\t\t\t\t\t\tAND typeabbrev ='" . $OrderHeader['ordertype'] . "'\n\t\t\t\t\t\tAND periodno = '" . $PeriodNo . "'\n\t\t\t\t\t\tAND cust  " . LIKE . " '" . $OrderHeader['debtorno'] . "'\n\t\t\t\t\t\tAND custbranch  " . LIKE . "  '" . $OrderHeader['branchcode'] . "'\n\t\t\t\t\t\tAND stockid  " . LIKE . " '" . $OrderLineRow['stkcode'] . "'\n\t\t\t\t\t\tAND salesanalysis.stkcategory ='" . $myrow[1] . "'\n\t\t\t\t\t\tAND budgetoractual='1'";
        } else {
            /* insert a new sales analysis record */
            $SQL = "INSERT INTO salesanalysis (\ttypeabbrev,\n\t\t\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\t\t\tamt,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcost,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcust,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcustbranch,\n\t\t\t\t\t\t\t\t\t\t\t\t\tqty,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisc,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstockid,\n\t\t\t\t\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbudgetoractual,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsalesperson,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstkcategory )\n\t\t\t\t\t\t\t\tSELECT '" . $OrderHeader['ordertype'] . "',\n\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t'" . $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] / $OrderHeader['rate'] . "',\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t'" . $OrderHeader['debtorno'] . "',\n\t\t\t\t\t\t\t\t\t'" . $OrderHeader['branchcode'] . "',\n\t\t\t\t\t\t\t\t\t'" . $OrderLineRow['quantity'] . "',\n\t\t\t\t\t\t\t\t\t'" . $OrderLineRow['discountpercent'] * $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] / $OrderHeader['rate'] . "',\n\t\t\t\t\t\t\t\t\t'" . $OrderLineRow['stkcode'] . "',\n\t\t\t\t\t\t\t\t\tcustbranch.area,\n\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\tcustbranch.salesman,\n\t\t\t\t\t\t\t\t\tstockmaster.categoryid\n\t\t\t\t\t\t\t\tFROM stockmaster, custbranch\n\t\t\t\t\t\t\t\tWHERE stockmaster.stockid = '" . $OrderLineRow['stkcode'] . "'\n\t\t\t\t\t\t\t\tAND custbranch.debtorno = '" . $OrderHeader['debtorno'] . "'\n\t\t\t\t\t\t\t\tAND custbranch.branchcode='" . $OrderHeader['branchcode'] . "'";
        }
        $Result = api_DB_query($SQL, $db, '', '', true);
        if ($CompanyRecord['gllink_stock'] == 1 and $StandardCost != 0) {
            /*first the cost of sales entry - GL accounts are retrieved using the function GetCOGSGLAccount from includes/GetSalesTransGLCodes.inc  */
            $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\tVALUES (10,\n\t\t\t\t\t\t\t\t\t\t'" . $InvoiceNo . "',\n\t\t\t\t\t\t\t\t\t\t'" . $OrderHeader['orddate'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t'" . GetCOGSGLAccount($OrderHeader['area'], $OrderLineRow['stkcode'], $OrderHeader['ordertype'], $db) . "',\n\t\t\t\t\t\t\t\t\t\t'" . $OrderHeader['debtorno'] . " - " . $OrderLineRow['stkcode'] . " x " . $OrderLineRow['quantity'] . " @ " . $StandardCost . "',\n\t\t\t\t\t\t\t\t\t\t'" . $StandardCost * $OrderLineRow['quantity'] . "')";
            $Result = api_DB_query($SQL, $db, '', '', true);
            /*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */
            $StockGLCode = GetStockGLCode($OrderLineRow['stkcode'], $db);
            $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\tVALUES (10,\n\t\t\t\t\t\t\t\t\t\t'" . $InvoiceNo . "',\n\t\t\t\t\t\t\t\t\t\t'" . $OrderHeader['orddate'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t'" . $StockGLCode['stockact'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $OrderHeader['debtorno'] . " - " . $OrderLineRow['stkcode'] . " x " . $OrderLineRow['quantity'] . " @ " . $StandardCost . "',\n\t\t\t\t\t\t\t\t\t\t'" . -$StandardCost * $OrderLineRow['quantity'] . "')";
            $Result = api_DB_query($SQL, $db, '', '', true);
        }
        /* end of if GL and stock integrated and standard cost !=0  and not an asset */
        if ($CompanyRecord['gllink_debtors'] == 1 and $OrderLineRow['unitprice'] != 0) {
            //Post sales transaction to GL credit sales
            $SalesGLAccounts = GetSalesGLAccount($OrderHeader['area'], $OrderLineRow['stkcode'], $OrderHeader['ordertype'], $db);
            $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\tVALUES ('10',\n\t\t\t\t\t\t'" . $InvoiceNo . "',\n\t\t\t\t\t\t'" . $OrderHeader['orddate'] . "',\n\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t'" . $SalesGLAccounts['salesglcode'] . "',\n\t\t\t\t\t\t'" . $OrderHeader['debtorno'] . " - " . $OrderLineRow['stkcode'] . " x " . $OrderLineRow['quantity'] . " @ " . $OrderLineRow['unitprice'] . "',\n\t\t\t\t\t\t'" . -$OrderLineRow['unitprice'] * $OrderLineRow['quantity'] / $OrderHeader['rate'] . "'\n\t\t\t\t\t)";
            $Result = api_DB_query($SQL, $db, '', '', true);
            if ($OrderLineRow['discountpercent'] != 0) {
                $SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\t\ttypeno,\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\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\tVALUES (10,\n\t\t\t\t\t\t\t\t'" . $InvoiceNo . "',\n\t\t\t\t\t\t\t\t'" . $OrderHeader['orddate'] . "',\n\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t'" . $SalesGLAccounts['discountglcode'] . "',\n\t\t\t\t\t\t\t\t'" . $OrderHeader['debtorno'] . " - " . $OrderLineRow['stkcode'] . " @ " . $OrderLineRow['discountpercent'] * 100 . "%',\n\t\t\t\t\t\t\t\t'" . $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] * $OrderLineRow['discountpercent'] / $OrderHeader['rate'] . "')";
                $Result = DB_query($SQL, $db, '', '', true);
            }
            /*end of if discount !=0 */
        }
        /*end of if sales integrated with gl */
        $LineCounter++;
        //needed for the array of taxes by line
    }
    /*end of OrderLine loop */
    $TotalInvLocalCurr = ($TotalFXNetInvoice + $TotalFXTax) / $OrderHeader['rate'];
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:67,代码来源:api_salesorders.php

示例13: DB_query

        $result = DB_query("SELECT assetid FROM fixedassets WHERE assetid='" . $_POST['AssetID'] . "'", $db);
        if (DB_num_rows($result) == 0) {
            prnMsg(_('The asset ID entered manually is not a valid fixed asset. If you do not know the asset reference, select it from the list'), 'error');
            $InputError = True;
            unset($_POST['AssetID']);
        }
        //DB_num_rows($result) == 0
    }
    if (!is_numeric(filter_number_format($_POST['Amount']))) {
        prnMsg(_('The amount entered is not numeric. This fixed asset cannot be added to the invoice'), 'error');
        $InputError = True;
        unset($_POST['Amount']);
    }
    //!is_numeric(filter_number_format($_POST['Amount']))
    if ($InputError == False) {
        $_SESSION['SuppTrans']->Add_Asset_To_Trans($_POST['AssetID'], filter_number_format($_POST['Amount']));
        unset($_POST['AssetID']);
        unset($_POST['Amount']);
    }
    //$InputError == False
}
//isset($_POST['AddAssetToInvoice'])
if (isset($_GET['Delete'])) {
    $_SESSION['SuppTrans']->Remove_Asset_From_Trans($_GET['Delete']);
}
//isset($_GET['Delete'])
/*Show all the selected ShiptRefs so far from the SESSION['SuppInv']->Shipts array */
if ($_SESSION['SuppTrans']->InvoiceOrCredit == 'Invoice') {
    echo '<div class="centre"><p class="page_title_text noPrint" >' . _('Fixed Assets on Invoice') . ' ';
} else {
    echo '<div class="centre"><p class="page_title_text noPrint" >' . _('Fixed Asset credits on Credit Note') . ' ';
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:SuppFixedAssetChgs.php

示例14: mb_strtoupper

include 'includes/header.inc';
include 'includes/SQL_CommonFunctions.inc';
if (isset($_POST['SelectedTabs'])) {
    $SelectedTabs = mb_strtoupper($_POST['SelectedTabs']);
} elseif (isset($_GET['SelectedTabs'])) {
    $SelectedTabs = mb_strtoupper($_GET['SelectedTabs']);
}
if (isset($_POST['SelectedIndex'])) {
    $SelectedIndex = $_POST['SelectedIndex'];
} elseif (isset($_GET['SelectedIndex'])) {
    $SelectedIndex = $_GET['SelectedIndex'];
}
if (isset($_POST['Days'])) {
    $Days = filter_number_format($_POST['Days']);
} elseif (isset($_GET['Days'])) {
    $Days = filter_number_format($_GET['Days']);
}
if (isset($_POST['Process'])) {
    if ($SelectedTabs == '') {
        prnMsg(_('You Must First Select a Petty Cash Tab To Authorise'), 'error');
        unset($SelectedTabs);
    }
}
if (isset($_POST['Go'])) {
    if ($Days <= 0) {
        prnMsg(_('The number of days must be a positive number'), 'error');
        $Days = 30;
    }
}
if (isset($SelectedTabs)) {
    echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Petty Cash') . '" alt="" />' . _('Authorisation Of Petty Cash Expenses ') . '' . $SelectedTabs . '</p>';
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:PcAuthorizeExpenses.php

示例15: DB_query

			<td><select name="Currency">';
    $sql = "SELECT currency, currabrev FROM currencies";
    $result = DB_query($sql, $db);
    while ($myrow = DB_fetch_array($result)) {
        if ($myrow['currabrev'] == $_SESSION['CompanyRecord']['currencydefault']) {
            echo '<option selected="selected" value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>';
        } else {
            echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>';
        }
    }
    echo '</select></td>
		</tr>';
    if (!isset($_POST['ExRate']) or !is_numeric(filter_number_format($_POST['ExRate']))) {
        $DefaultExRate = '1';
    } else {
        $DefaultExRate = filter_number_format($_POST['ExRate']);
    }
    echo '<tr>
			<td>' . _('Exchange Rate') . ':</td>
            <td><input type="text" class="number" title="' . _('The input must be number') . '" name="ExRate" maxlength="11" size="12" value="' . locale_number_format($DefaultExRate, 'Variable') . '" /></td>
          </tr>';
    if (!isset($_POST['AmountsDueBy'])) {
        $DefaultDate = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') + 1, 0, Date('y')));
    } else {
        $DefaultDate = $_POST['AmountsDueBy'];
    }
    echo '<tr>
			<td>' . _('Payments Due To') . ':</td>
            <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="AmountsDueBy" maxlength="11" size="12" value="' . $DefaultDate . '" /></td>
          </tr>';
    $SQL = "SELECT bankaccountname, accountcode FROM bankaccounts";
开发者ID:strollClouds,项目名称:snkStudy,代码行数:31,代码来源:SuppPaymentRun.php


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