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


PHP unformat_number函数代码示例

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


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

示例1: unformatField

 public function unformatField($formattedField, $vardef)
 {
     if ($formattedField === '' || $formattedField === NULL) {
         return null;
     }
     return (double) unformat_number($formattedField);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:SugarFieldFloat.php

示例2: unformatField

 public function unformatField($formattedField, $vardef)
 {
     if ($formattedField === '' || $formattedField === NULL) {
         return '';
     }
     return (int) unformat_number($formattedField);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:7,代码来源:SugarFieldInt.php

示例3: saveListItems

 function saveListItems()
 {
     require_once 'modules/AOS_Products_Quotes/AOS_Products_Quotes.php';
     $productQuote = new AOS_Products_Quotes();
     $product = array('id' => $_POST['product_quote_id'], 'product_id' => $_POST['product_id'], 'product_name' => $_POST['product_name'], 'product_qty' => $_POST['product_qty'], 'vat' => $_POST['vat'], 'vat_amt' => $_POST['vat_amt'], 'product_list_price' => $_POST['product_list_price'], 'product_unit_price' => $_POST['product_unit_price'], 'product_total_price' => $_POST['product_total_price'], 'product_note' => $_POST['product_note'], 'deleted' => $_POST['deleted']);
     $productLineCount = count($product['product_id']);
     for ($i = 0; $i < $productLineCount; $i++) {
         $productQuote->id = $product['id'][$i];
         $productQuote->parent_id = $this->id;
         $productQuote->parent_type = 'AOS_Invoices';
         $productQuote->product_id = $product['product_id'][$i];
         $productQuote->name = $product['product_name'][$i];
         $productQuote->product_qty = $product['product_qty'][$i];
         $productQuote->product_list_price = unformat_number($product['product_list_price'][$i]);
         $productQuote->product_unit_price = unformat_number($product['product_unit_price'][$i]);
         $productQuote->vat = $product['vat'][$i];
         $productQuote->vat_amt = unformat_number($product['vat_amt'][$i]);
         $productQuote->product_total_price = unformat_number($product['product_total_price'][$i]);
         $productQuote->description = $product['product_note'][$i];
         $productQuote->deleted = $product['deleted'][$i];
         if ($productQuote->deleted == 1) {
             $productQuote->mark_deleted($productQuote->id);
         } else {
             if (trim($productQuote->product_id) != '') {
                 $productQuote->save();
             }
         }
     }
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:29,代码来源:AOS_Invoices.php

示例4: ReadData

 function ReadData($targetstring, &$map, &$item)
 {
     $data[IN] = NULL;
     $data[OUT] = NULL;
     $data_time = 0;
     $itemname = $item->name;
     $matches = 0;
     $fd = fopen($targetstring, "r");
     if ($fd) {
         while (!feof($fd)) {
             $buffer = fgets($fd, 4096);
             # strip out any Windows line-endings that have gotten in here
             $buffer = str_replace("\r", "", $buffer);
             if (preg_match("/^{$itemname}\t(\\d+\\.?\\d*[KMGT]*)\t(\\d+\\.?\\d*[KMGT]*)/", $buffer, $matches)) {
                 $data[IN] = unformat_number($matches[1]);
                 $data[OUT] = unformat_number($matches[2]);
             }
         }
         $stats = stat($targetstring);
         $data_time = $stats['mtime'];
     } else {
         // some error code to go in here
         debug("TabText ReadData: Couldn't open ({$targetstring}). \n");
     }
     debug("TabText ReadData: Returning (" . ($data[IN] === NULL ? 'NULL' : $data[IN]) . "," . ($data[OUT] === NULL ? 'NULL' : $data[OUT]) . ",{$data_time})\n");
     return array($data[IN], $data[OUT], $data_time);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:27,代码来源:WeatherMapDataSource_tabfile.php

示例5: perform_save

function perform_save(&$focus)
{
    //US DOLLAR
    if (isset($focus->amount) && !number_empty($focus->amount)) {
        $currency = new Currency();
        $currency->retrieve($focus->currency_id);
        $focus->amount_usdollar = $currency->convertToDollar(unformat_number($focus->amount));
    }
}
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:9,代码来源:SaveOverload.php

示例6: perform_save

function perform_save(&$focus)
{
    require_once 'modules/Currencies/Currency.php';
    //US DOLLAR
    if (isset($focus->price) && !number_empty($focus->price)) {
        $currency = new Currency();
        $currency->retrieve($focus->currency_id);
        $focus->price_usdollar = $currency->convertToDollar(unformat_number($focus->price));
    }
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:10,代码来源:SaveOverload.php

示例7: unformatField

 public function unformatField($formattedField, $vardef)
 {
     if ($formattedField === '' || $formattedField === NULL) {
         return '';
     }
     if (is_array($formattedField)) {
         $formattedField = array_shift($formattedField);
     }
     return (double) unformat_number($formattedField);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:10,代码来源:SugarFieldFloat.php

示例8: save

 function save($df)
 {
     //the currency field
     $this->default = unformat_number($this->default);
     $this->default_value = $this->default;
     parent::save($df);
     //currency id
     $currency_id = new TemplateCurrencyId();
     $currency_id->name = 'currency_id';
     $currency_id->vname = 'LBL_CURRENCY';
     $currency_id->label = $currency_id->vname;
     $currency_id->save($df);
     //$df->addLabel($currency_id->vname);
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:14,代码来源:TemplateCurrency.php

示例9: perform_aos_save

/**
 * Products, Quotations & Invoices modules.
 * Extensions to SugarCRM
 * @package Advanced OpenSales for SugarCRM
 * @subpackage Products
 * @copyright SalesAgility Ltd http://www.salesagility.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
 * along with this program; if not, see http://www.gnu.org/licenses
 * or write to the Free Software Foundation,Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301  USA
 *
 * @author Salesagility Ltd <info@salesagility.com>
 */
function perform_aos_save($focus)
{
    foreach ($focus->field_defs as $field) {
        $fieldName = $field['name'];
        $fieldNameDollar = $field['name'] . '_usdollar';
        if (isset($focus->field_defs[$fieldNameDollar])) {
            $focus->{$fieldNameDollar} = '';
            if (!number_empty($focus->field_defs[$field['name']])) {
                $currency = new Currency();
                $currency->retrieve($focus->currency_id);
                $focus->{$fieldNameDollar} = $currency->convertToDollar(unformat_number($fieldName));
            }
        }
    }
}
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:39,代码来源:AOS_Utils.php

示例10: testUnformatNumber

 public function testUnformatNumber()
 {
     global $current_user;
     $testValue = "\$100,000.50";
     $unformattedValue = unformat_number($testValue);
     $this->assertEquals($unformattedValue, 100000.5, "Assert that \$100,000.50 becomes 100000.50. Formatted value is: " . $unformattedValue);
     //Switch the num_grp_sep and dec_sep values
     $current_user->setPreference('num_grp_sep', '.');
     $current_user->setPreference('dec_sep', ',');
     $current_user->save();
     //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
     get_number_seperators(true);
     $testValue = "\$100.000,50";
     $unformattedValue = unformat_number($testValue);
     $this->assertEquals($unformattedValue, 100000.5, "Assert that \$100.000,50 becomes 100000.50. Formatted value is: " . $unformattedValue);
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:16,代码来源:CurrencyTest.php

示例11: save

 public function save($df)
 {
     //the currency field
     $this->default = unformat_number($this->default);
     $this->default_value = $this->default;
     $this->related_fields = array('currency_id', 'base_rate');
     parent::save($df);
     $df->addLabel('LBL_CURRENCY');
     //currency id
     $currency_id = new TemplateCurrencyId();
     $currency_id->name = 'currency_id';
     $currency_id->save($df);
     //base_rate
     $base_rate = new TemplateCurrencyBaseRate();
     $base_rate->name = 'base_rate';
     $base_rate->label = 'LBL_CURRENCY_RATE';
     $base_rate->save($df);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:18,代码来源:TemplateCurrency.php

示例12: ReadData

 function ReadData($targetstring, &$map, &$item)
 {
     $inbw = NULL;
     $outbw = NULL;
     $data_time = 0;
     if (preg_match("/^static:(\\-?\\d+\\.?\\d*[KMGT]*):(\\-?\\d+\\.?\\d*[KMGT]*)\$/", $targetstring, $matches)) {
         $inbw = unformat_number($matches[1], $map->kilo);
         $outbw = unformat_number($matches[2], $map->kilo);
         $data_time = time();
     }
     if (preg_match("/^static:(\\-?\\d+\\.?\\d*[KMGT]*)\$/", $targetstring, $matches)) {
         $inbw = unformat_number($matches[1], $map->kilo);
         $outbw = $inbw;
         $data_time = time();
     }
     wm_debug("Static ReadData: Returning ({$inbw},{$outbw},{$data_time})\n");
     return array($inbw, $outbw, $data_time);
 }
开发者ID:stapler2025,项目名称:Weathermap-librenms,代码行数:18,代码来源:WeatherMapDataSource_static.php

示例13: SaveQuery

 /**
  * SaveQuery
  *  
  * This function handles saving the query parameters to the user preferences
  * SavedSearch.php does something very similar when saving saved searches as well
  * 
  * @see SavedSearch
  * @param $name String name  to identify this query
  */
 function SaveQuery($name)
 {
     global $current_user, $timedate;
     if (isset($this->query['module'])) {
         $bean = loadBean($this->query['module']);
         if (!empty($bean)) {
             foreach ($this->query as $key => $value) {
                 //Filter date fields to ensure it is saved to DB format, but also avoid empty values
                 if (!empty($value) && preg_match('/^(start_range_|end_range_|range_)?(.*?)(_advanced|_basic)$/', $key, $match)) {
                     $field = $match[2];
                     if (isset($bean->field_defs[$field]['type']) && empty($bean->field_defs[$field]['disable_num_format'])) {
                         $type = $bean->field_defs[$field]['type'];
                         if (($type == 'date' || $type == 'datetime' || $type == 'datetimecombo') && !preg_match('/^\\[.*?\\]$/', $value)) {
                             $db_format = $timedate->to_db_date($value, false);
                             $this->query[$key] = $db_format;
                         } else {
                             if ($type == 'int' || $type == 'currency' || $type == 'decimal' || $type == 'float') {
                                 if (preg_match('/[^\\d]/', $value)) {
                                     require_once 'modules/Currencies/Currency.php';
                                     $this->query[$key] = unformat_number($value);
                                     //Flag this value as having been unformatted
                                     $this->query[$key . '_unformatted_number'] = true;
                                     //If the type is of currency and there was a currency symbol (non-digit), save the symbol
                                     if ($type == 'currency' && preg_match('/^([^\\d])/', $value, $match)) {
                                         $this->query[$key . '_currency_symbol'] = $match[1];
                                     }
                                 } else {
                                     //unset any flags
                                     if (isset($this->query[$key . '_unformatted_number'])) {
                                         unset($this->query[$key . '_unformatted_number']);
                                     }
                                     if (isset($this->query[$key . '_currency_symbol'])) {
                                         unset($this->query[$key . '_currency_symbol']);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $current_user->setPreference($name . 'Q', $this->query);
 }
开发者ID:nartnik,项目名称:sugarcrm_test,代码行数:53,代码来源:StoreQuery.php

示例14: handleAdd

 function handleAdd()
 {
     global $current_user;
     if ($current_user->is_admin) {
         if (isset($_POST['edit']) && $_POST['edit'] == 'true' && isset($_POST['name']) && !empty($_POST['name']) && isset($_POST['conversion_rate']) && !empty($_POST['conversion_rate']) && isset($_POST['symbol']) && !empty($_POST['symbol'])) {
             $currency = new Currency();
             if (isset($_POST['record']) && !empty($_POST['record'])) {
                 $currency->retrieve($_POST['record']);
             }
             $currency->name = $_POST['name'];
             $currency->status = $_POST['status'];
             $currency->symbol = $_POST['symbol'];
             $currency->iso4217 = $_POST['iso4217'];
             $currency->conversion_rate = unformat_number($_POST['conversion_rate']);
             $currency->save();
             $this->focus = $currency;
         }
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:19,代码来源:ListCurrency.php

示例15: handleAdd

 /**
  * handle creating or updating a currency record
  *
  */
 function handleAdd()
 {
     global $current_user;
     if ($current_user->is_admin) {
         if (isset($_POST['edit']) && $_POST['edit'] == 'true' && isset($_POST['name']) && !empty($_POST['name']) && isset($_POST['conversion_rate']) && !empty($_POST['conversion_rate']) && isset($_POST['symbol']) && !empty($_POST['symbol'])) {
             $currency = BeanFactory::getBean('Currencies');
             $isUpdate = false;
             if (isset($_POST['record']) && !empty($_POST['record'])) {
                 $isUpdate = true;
                 $currency->retrieve($_POST['record']);
             }
             $currency->name = $_POST['name'];
             $currency->status = $_POST['status'];
             $currency->symbol = $_POST['symbol'];
             $currency->iso4217 = $_POST['iso4217'];
             $previousConversionRate = $currency->conversion_rate;
             $currency->conversion_rate = (string) unformat_number($_POST['conversion_rate']);
             $currency->save();
             $this->focus = $currency;
             // Used to tell calling code that a change was made
             $this->recordSaved = true;
             //Check if the conversion rates changed and, if so, update the rates with a scheduler job
             if ($isUpdate && $previousConversionRate != $currency->conversion_rate) {
                 global $timedate;
                 // use bean factory here
                 $job = BeanFactory::getBean('SchedulersJobs');
                 $job->name = "SugarJobUpdateCurrencyRates: " . $timedate->getNow()->asDb();
                 $job->target = "class::SugarJobUpdateCurrencyRates";
                 $job->data = $currency->id;
                 $job->retry_count = 0;
                 $job->assigned_user_id = $current_user->id;
                 $jobQueue = new SugarJobQueue();
                 $jobQueue->submitJob($job);
             }
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:41,代码来源:ListCurrency.php


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