本文整理汇总了PHP中get_number_seperators函数的典型用法代码示例。如果您正苦于以下问题:PHP get_number_seperators函数的具体用法?PHP get_number_seperators怎么用?PHP get_number_seperators使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_number_seperators函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSVNumbersHtml
function getSVNumbersHtml($focus, $name, $value, $view)
{
if ('EditView' != $view && 'DetailView' != $view) {
return "";
// skip the rest of the method if another view calls this method
}
global $app_list_strings;
global $sugar_config;
$json = getJSONobj();
$svnumbersSmartyArray = $focus->getSVNumbersArray();
$svnumberQuicksearch = getSVNumberQuicksearch('svnumber', 'svnumber_id');
$smarty = new Sugar_Smarty();
$smarty->assign('sugarDateFormat', getSugarCrmLocale('datef'));
//$smarty->assign('sugarDateFormat', $sugar_config['default_date_format']);
$smarty->assign('sqsJavaScript', $svnumberQuicksearch);
$smarty->assign('svnumbersArray', $svnumbersSmartyArray);
$smarty->assign('languageStringsCommon', getLanguageStrings("common"));
if ('DetailView' === $view) {
// transfer ide into ajvascript code so that we can determine the urls in the ajax call
$smarty->assign('id', $focus->id);
// $smarty->assign('languageStringsDocuments', getLanguageStrings('Documents'));
}
$sep = get_number_seperators();
$smarty->assign('sugarDecimalSeperator', $sep[1]);
return $smarty->fetch('include/oqc/ExternalContracts/SVNumbers.' . $view . '.html');
}
示例2: process
function process()
{
global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
$mod_strings = return_module_language($current_language, 'Opportunities');
$json = getJSONobj();
parent::process();
list($num_grp_sep, $dec_sep) = get_number_seperators();
$this->ss->assign('NUM_GRP_SEP', $num_grp_sep);
$this->ss->assign('DEC_SEP', $dec_sep);
$this->ss->assign('CURRENCY_ID', $current_user->getPreference('currency'));
$this->ss->assign("SALES_STAGE_OPTIONS", get_select_options_with_id($app_list_strings['sales_stage_dom'], ''));
$this->ss->assign("LEAD_SOURCE_OPTIONS", get_select_options_with_id($app_list_strings['lead_source_dom'], ''));
$this->ss->assign('prob_array', $json->encode($app_list_strings['sales_probability_dom']));
if ($this->viaAJAX) {
// override for ajax call
$this->ss->assign('saveOnclick', "onclick='if(check_form(\"opportunitiesQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"opportunities\"); else return false;'");
$this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_opportunities\")';");
}
$this->ss->assign('viaAJAX', $this->viaAJAX);
$this->javascript = new javascript();
$this->javascript->setFormName('opportunitiesQuickCreate');
$focus = new Opportunity();
$this->javascript->setSugarBean($focus);
$this->javascript->addAllFields('');
$this->ss->assign('additionalScripts', $this->javascript->getScript(false));
}
示例3: testFormatNumber
public function testFormatNumber()
{
global $current_user;
$testValue = "100000.50";
$formattedValue = format_number($testValue);
$this->assertEquals($formattedValue, "100,000.50", "Assert that 100000.50 becomes 100,000.50. Formatted value is: " . $formattedValue);
//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 = "100000.50";
$formattedValue = format_number($testValue);
$this->assertEquals($formattedValue, "100.000,50", "Assert that 100000.50 becomes 100.000,50. Formatted value is: " . $formattedValue);
}
示例4: getPdfVariables
function getPdfVariables($contract)
{
global $app_list_strings;
global $locale;
$serviceArrays = array();
$oneTimeServiceArrays = array();
$productArrays = array();
$oneTimeProductArrays = array();
$pdfDataArray = array();
$contractVariables = array();
$calculatedCosts = array();
$imagesExist = false;
$sep = get_number_seperators();
$vat_default = floatval(str_replace($sep[1], '.', $app_list_strings['oqc_vat_list']['default'])) / 100;
//Get contract variables
$contractVariables = getContractVariables($contract);
//Get service data for processing
$services = $contract->get_linked_beans('oqc_service', 'oqc_Service');
if (!empty($services)) {
usort($services, array('oqc_Service', 'oqc_service_compare_position'));
foreach ($services as $service) {
$serviceArray = $service->toArray();
$serviceArray = sanatizeBeanArrayForLatex($serviceArray);
$product = getProductBean($service);
if ($product) {
$productArray = $product->toArray();
$productArray = sanatizeBeanArrayForLatex($productArray);
} else {
$productArray = array();
}
if (!empty($service->description)) {
// Rewrite description with Latex converter output.
$convertor = new oqc_HtmlToLatexConverter();
$serviceArray['description'] = $convertor->html2latex('<html><head></head><body>' . from_html($service->description) . '</body></html>');
} elseif (!empty($product->description)) {
$convertor = new oqc_HtmlToLatexConverter();
$productArray['description'] = $convertor->html2latex('<html><head></head><body>' . from_html($product->description) . '</body></html>');
}
// translate
$serviceArray['zeitbezug_translated'] = $app_list_strings['zeitbezug_list'][$serviceArray['zeitbezug']];
if ($app_list_strings['unit_list'][$serviceArray['unit']]) {
$serviceArray['unit'] = $app_list_strings['unit_list'][$serviceArray['unit']];
}
$calc_vat = $serviceArray['oqc_vat'] == 'default' ? $vat_default : ($serviceArray['oqc_vat'] !== '' ? $serviceArray['oqc_vat'] : $vat_default);
$serviceArray['oqc_vat'] = $calc_vat * 100;
$serviceArray['discounted_price'] = $service->getDiscountedPrice($calc_vat);
$serviceArray['discounted_price_tax_free'] = $service->getDiscountedPriceTaxFree();
$serviceArray['image_url'] = false;
if ($product) {
if ($product->getImageFilenameUrl()) {
if (WINDOWS) {
$serviceArray['image_url'] = str_replace("\\", "/", '"' . getcwd() . '"/' . $product->getImageFilenameUrl());
} else {
$serviceArray['image_url'] = str_replace("\\", "/", getcwd() . '/' . $product->getImageFilenameUrl());
}
}
}
$serviceArray['has_image'] = $serviceArray['image_url'] !== FALSE;
// convenient flag for access from latex template
$serviceArray['startdate'] = $contract->startdate;
$serviceArray['enddate'] = $contract->enddate;
//$GLOBALS['log']->error('getPdfVariables: '. var_export($serviceArray['oqc_vat'],true));
if (!empty($serviceArray['service_currency_id'])) {
$currency = new Currency();
//$currency_id = -99;
$currency->retrieve($serviceArray['service_currency_id']);
//Convert currency symbols to latex equivalents here
$serviceArray['currency_symbol'] = $currency->symbol;
$serviceArray['currency_symbol'] = str_replace("€", '\\euro{}', $serviceArray['currency_symbol']);
$serviceArray['currency_symbol'] = str_replace('$', '\\$', $serviceArray['currency_symbol']);
$serviceArray['currency_symbol'] = str_replace("£", '{\\pounds}', $serviceArray['currency_symbol']);
$serviceArray['currency_symbol'] = str_replace("¥", '{Y\\hspace*{-1.4ex}--}', $serviceArray['currency_symbol']);
}
if (!$imagesExist && $serviceArray['has_image']) {
$imagesExist = true;
}
if ($service->zeitbezug == 'once') {
$oneTimeServiceArrays[] = $serviceArray;
$oneTimeProductArrays[] = $productArray;
} else {
$serviceArrays[] = $serviceArray;
$productArrays[] = $productArray;
}
}
// merge data from products and services, prefering service data
$serviceData = array_map('array_merge', $productArrays, $serviceArrays);
$oneTimeServiceData = array_map('array_merge', $oneTimeProductArrays, $oneTimeServiceArrays);
}
$costsTotal = calculateTotalCosts($serviceData, false);
$oneTimeCostsTotal = calculateTotalCosts($oneTimeServiceData);
//$currency_symbol =
$serviceData = array('imagesExist' => $imagesExist, 'services' => $serviceData, 'oneTimeServices' => $oneTimeServiceData);
$pdfDataArray = array_merge($contractVariables, $serviceData, $costsTotal, $oneTimeCostsTotal);
//$GLOBALS['log']->error('Services: variable transferred to pdf: '. var_export($pdfDataArray,true));
return $pdfDataArray;
}
示例5: getJavascriptValidation
/**
* Get JS validation code for views
*/
public static function getJavascriptValidation()
{
global $timedate;
$cal_date_format = $timedate->get_cal_date_format();
$timereg = $timedate->get_regular_expression($timedate->get_time_format());
$datereg = $timedate->get_regular_expression($timedate->get_date_format());
$date_pos = '';
foreach ($datereg['positions'] as $type => $pos) {
if (empty($date_pos)) {
$date_pos .= "'{$type}': {$pos}";
} else {
$date_pos .= ",'{$type}': {$pos}";
}
}
$time_separator = $timedate->timeSeparator();
$hour_offset = $timedate->getUserUTCOffset() * 60;
// Add in the number formatting styles here as well, we have been handling this with individual modules.
require_once 'modules/Currencies/Currency.php';
list($num_grp_sep, $dec_sep) = get_number_seperators();
$the_script = "<script type=\"text/javascript\">\n" . "\tvar time_reg_format = '" . $timereg['format'] . "';\n" . "\tvar date_reg_format = '" . $datereg['format'] . "';\n" . "\tvar date_reg_positions = { {$date_pos} };\n" . "\tvar time_separator = '{$time_separator}';\n" . "\tvar cal_date_format = '{$cal_date_format}';\n" . "\tvar time_offset = {$hour_offset};\n" . "\tvar num_grp_sep = '{$num_grp_sep}';\n" . "\tvar dec_sep = '{$dec_sep}';\n" . "</script>";
return $the_script;
}
示例6: format_number_sugarpdf
/**
* Copy of format_number() from currency with fix for sugarpdf.
* @return String formatted currency value
* @see modules/Currencies/Currency.php
*/
function format_number_sugarpdf($amount, $round = null, $decimals = null, $params = array())
{
global $app_strings, $current_user, $sugar_config, $locale;
static $current_users_currency = null;
static $last_override_currency = null;
static $override_currency_id = null;
static $currency;
$seps = get_number_seperators();
$num_grp_sep = $seps[0];
$dec_sep = $seps[1];
// cn: bug 8522 - sig digits not honored in pdfs
if (is_null($decimals)) {
$decimals = $locale->getPrecision();
}
if (is_null($round)) {
$round = $locale->getPrecision();
}
// only create a currency object if we need it
if (!empty($params['currency_symbol']) && $params['currency_symbol'] || !empty($params['convert']) && $params['convert'] || !empty($params['currency_id'])) {
// if we have an override currency_id
if (!empty($params['currency_id'])) {
if ($override_currency_id != $params['currency_id']) {
$override_currency_id = $params['currency_id'];
$currency = new Currency();
$currency->retrieve($override_currency_id);
$last_override_currency = $currency;
} else {
$currency = $last_override_currency;
}
} elseif (!isset($current_users_currency)) {
// else use current user's
$current_users_currency = new Currency();
if ($current_user->getPreference('currency')) {
$current_users_currency->retrieve($current_user->getPreference('currency'));
} else {
$current_users_currency->retrieve('-99');
}
// use default if none set
$currency = $current_users_currency;
}
}
if (!empty($params['convert']) && $params['convert']) {
$amount = $currency->convertFromDollar($amount, 6);
}
if (!empty($params['currency_symbol']) && $params['currency_symbol']) {
if (!empty($params['symbol_override'])) {
$symbol = $params['symbol_override'];
} elseif (!empty($params['type']) && $params['type'] == 'sugarpdf') {
$symbol = $currency->symbol;
$symbol_space = false;
} else {
if (empty($currency->symbol)) {
$symbol = $currency->getDefaultCurrencySymbol();
} else {
$symbol = $currency->symbol;
}
$symbol_space = true;
}
} else {
$symbol = '';
}
if (isset($params['charset_convert'])) {
$symbol = $locale->translateCharset($symbol, 'UTF-8', $locale->getExportCharset());
}
if (empty($params['human'])) {
$amount = number_format(round($amount, $round), $decimals, $dec_sep, $num_grp_sep);
$amount = format_place_symbol($amount, $symbol, empty($params['symbol_space']) ? false : true);
} else {
// If amount is more greater than a thousand(postiive or negative)
if (strpos($amount, '.') > 0) {
$checkAmount = strlen(substr($amount, 0, strpos($amount, '.')));
}
if ($checkAmount >= 1000 || $checkAmount <= -1000) {
$amount = round($amount / 1000, 0);
$amount = $amount . 'k';
$amount = format_place_symbol($amount, $symbol, empty($params['symbol_space']) ? false : true);
} else {
$amount = format_place_symbol($amount, $symbol, empty($params['symbol_space']) ? false : true);
}
}
if (!empty($params['percentage']) && $params['percentage']) {
$amount .= $app_strings['LBL_PERCENTAGE_SYMBOL'];
}
return $amount;
}
示例7: unformat_number
function unformat_number($string)
{
// Just in case someone passes an already unformatted number through.
if (!is_string($string)) {
return $string;
}
static $currency = null;
if (!isset($currency)) {
global $current_user;
$currency = new Currency();
if (!empty($current_user->id)) {
if ($current_user->getPreference('currency')) {
$currency->retrieve($current_user->getPreference('currency'));
} else {
$currency->retrieve('-99');
// use default if none set
}
} else {
$currency->retrieve('-99');
// use default if none set
}
}
$seps = get_number_seperators();
// remove num_grp_sep and replace decimal separator with decimal
$string = trim(str_replace(array($seps[0], $seps[1], $currency->symbol), array('', '.', ''), $string));
if (preg_match('/^[+-]?\\d(\\.\\d+)?[Ee]([+-]?\\d+)?$/', $string)) {
$string = sprintf("%.0f", $string);
}
//for scientific number format. After round(), we may get this number type.
preg_match('/[\\-\\+]?[0-9\\.]*/', $string, $string);
$out_number = trim($string[0]);
if ($out_number == '') {
return '';
} else {
return (double) $out_number;
}
}
示例8: display_lines
/**
* Advanced OpenSales, Advanced, robust set of sales modules.
* @package Advanced OpenSales for SugarCRM
* @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 <info@salesagility.com>
*/
function display_lines($focus, $field, $value, $view)
{
global $sugar_config, $locale, $app_list_strings, $mod_strings;
$enable_groups = (int) $sugar_config['aos']['lineItems']['enableGroups'];
$total_tax = (int) $sugar_config['aos']['lineItems']['totalTax'];
$html = '';
if ($view == 'EditView') {
$html .= '<script src="modules/AOS_Products_Quotes/line_items.js"></script>';
if (file_exists('custom/modules/AOS_Products_Quotes/line_items.js')) {
$html .= '<script src="custom/modules/AOS_Products_Quotes/line_items.js"></script>';
}
$html .= '<script language="javascript">var sig_digits = ' . $locale->getPrecision() . ';';
$html .= 'var module_sugar_grp1 = "' . $focus->module_dir . '";';
$html .= 'var enable_groups = ' . $enable_groups . ';';
$html .= 'var total_tax = ' . $total_tax . ';';
$html .= '</script>';
$html .= "<table border='0' cellspacing='4' width='37.5%' id='lineItems'></table>";
if ($enable_groups) {
$html .= "<div style='padding-top: 10px; padding-bottom:10px;'>";
$html .= "<input type=\"button\" tabindex=\"116\" class=\"button\" value=\"" . $mod_strings['LBL_ADD_GROUP'] . "\" id=\"addGroup\" onclick=\"insertGroup(0)\" />";
$html .= "</div>";
}
$html .= '<input type="hidden" name="vathidden" id="vathidden" value="' . get_select_options_with_id($app_list_strings['vat_list'], '') . '">
<input type="hidden" name="discounthidden" id="discounthidden" value="' . get_select_options_with_id($app_list_strings['discount_list'], '') . '">';
require_once 'modules/AOS_Products_Quotes/AOS_Products_Quotes.php';
require_once 'modules/AOS_Line_Item_Groups/AOS_Line_Item_Groups.php';
$sql = "SELECT pg.id, pg.group_id FROM aos_products_quotes pg LEFT JOIN aos_line_item_groups lig ON pg.group_id = lig.id WHERE pg.parent_type = '" . $focus->object_name . "' AND pg.parent_id = '" . $focus->id . "' AND pg.deleted = 0 ORDER BY lig.number ASC, pg.number ASC";
$result = $focus->db->query($sql);
$html .= "<script>\n\t\t\tif(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}\n\t\t\t</script>";
while ($row = $focus->db->fetchByAssoc($result)) {
$line_item = new AOS_Products_Quotes();
$line_item->retrieve($row['id']);
$line_item = json_encode($line_item->toArray());
$group_item = 'null';
if ($row['group_id'] != null) {
$group_item = new AOS_Line_Item_Groups();
$group_item->retrieve($row['group_id']);
$group_item = json_encode($group_item->toArray());
}
$html .= "<script>\n\t\t\t\t\tinsertLineItems(" . $line_item . "," . $group_item . ");\n\t\t\t\t</script>";
}
if (!$enable_groups) {
$html .= '<script>insertGroup();</script>';
}
} else {
if ($view == 'DetailView') {
$params = array('currency_id' => $focus->currency_id);
$sql = "SELECT pg.id, pg.group_id FROM aos_products_quotes pg LEFT JOIN aos_line_item_groups lig ON pg.group_id = lig.id WHERE pg.parent_type = '" . $focus->object_name . "' AND pg.parent_id = '" . $focus->id . "' AND pg.deleted = 0 ORDER BY lig.number ASC, pg.number ASC";
$result = $focus->db->query($sql);
$sep = get_number_seperators();
$html .= "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
$i = 0;
$productCount = 0;
$serviceCount = 0;
$group_id = '';
$groupStart = '';
$groupEnd = '';
$product = '';
$service = '';
while ($row = $focus->db->fetchByAssoc($result)) {
$line_item = new AOS_Products_Quotes();
$line_item->retrieve($row['id']);
if ($enable_groups && ($group_id != $row['group_id'] || $i == 0)) {
$html .= $groupStart . $product . $service . $groupEnd;
if ($i != 0) {
$html .= "<tr><td colspan='9' nowrap='nowrap'><br></td></tr>";
}
$groupStart = '';
$groupEnd = '';
$product = '';
$service = '';
$i = 1;
$productCount = 0;
$serviceCount = 0;
$group_id = $row['group_id'];
$group_item = new AOS_Line_Item_Groups();
$group_item->retrieve($row['group_id']);
$groupStart .= "<tr>";
//.........这里部分代码省略.........
示例9: populateLineItems
function populateLineItems()
{
global $app_list_strings, $app_strings, $mod_strings;
$vat_value = $app_list_strings['vat_list'];
$vat_value2 = array_keys($vat_value);
$sql = "SELECT * FROM aos_products_quotes WHERE parent_type = 'AOS_Quotes' AND parent_id = '" . $this->bean->id . "' AND deleted = 0";
$result = $this->bean->db->query($sql);
$countLine = $this->bean->db->getRowCount($result);
$html = "";
$html .= "<table border='0' width='100%' id='productLine'>";
$html .= "<tr>";
$html .= "<td width='15%' class='dataLabel' style='text-align: left;'>" . $mod_strings['LBL_PRODUCT_NAME'] . "</td>";
$html .= "<td width='10%' class='dataLabel' style='text-align: left;'>Asset</td>";
$html .= "<td width='5%' class='dataLabel' style='text-align: left;'>" . $mod_strings['LBL_UNIT_PRICE'] . "</td>";
$html .= "<td width='5%' class='dataLabel' style='text-align: left;'>Product Rate</td>";
$html .= "<td width='5%' class='dataLabel' style='text-align: left;'>Start Date</td>";
$html .= "<td width='5%' class='dataLabel' style='text-align: left;'>Stop Date</td>";
$html .= "<td width='10%' class='dataLabel' style='text-align: left;'>Notes</td>";
$html .= "<td width='10%' class='dataLabel' style='text-align: left;'> </td>";
$html .= "</tr>";
$i = 0;
while ($row = $this->bean->db->fetchByAssoc($result)) {
$row['id'] = isset($_REQUEST['Duplicate']) && trim($_REQUEST['Duplicate']) == 'Duplicate' ? "" : $row['id'];
$html .= "<tr id='product_line{$i}'>";
$html .= "<td class='dataField'><input tabindex='3' type='text' name='product_name[]' id='product_name{$i}' size='25' maxlength='50' value='" . $row['name'] . "' title=''><input type='hidden' name='product_id[]' id='product_id{$i}' value='" . $row['product_id'] . "'> <input title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accessKey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' type='button' tabindex='3' class='button' value='" . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "' name='btn1' onclick='openProductPopup({$i})'></td>";
$html .= "<td class='dataField'><textarea tabindex='3' name='product_note[]' id='product_note{$i}' rows='1' cols='25'>" . $row['description'] . "</textarea></td>";
$html .= "<td class='dataField'><input tabindex='3' type='text' name='product_unit_price[]' id='product_unit_price{$i}' size='10' maxlength='50' value='" . format_number($row['product_unit_price']) . "' title='' onfocus='copyListPrice({$i});' onblur='calculateProductLine({$i});'></td>";
$html .= "<td class='dataField'><input tabindex='3' type='text' name='product_rate[]' id='product_rate{$i}' size='10' maxlength='50' value='" . $row['product_rate'] . "' title=''></td>";
$html .= "<td class='dataField'><input tabindex='3' type='text' name='start_date[]' id='start_date{$i}' size='15' maxlength='50' value='" . substr($row['start_date'], 0, 10) . "' title=''></td>";
$html .= "<td class='dataField'><input tabindex='3' type='text' name='stop_date[]' id='stop_date{$i}' size='15' maxlength='50' value='" . substr($row['stop_date'], 0, 10) . "' title=''></td>";
$html .= "<td class='dataField'><textarea tabindex='3' name='product_note2[]' id='product_note2{$i}' rows='1' cols='25'>" . $row['description2'] . "</textarea></td>";
$html .= "<td class='dataField'><input type='hidden' name='deleted[]' id='deleted{$i}' value='0'><input type='hidden' name='product_quote_id[]' value='" . $row['id'] . "'><input type='button' class='button' value='" . $mod_strings['LBL_REMOVE_PRODUCT_LINE'] . "' tabindex='3' onclick='markProductLineDeleted({$i})'></td>";
$html .= "</tr>";
/*
$html .= "<td class='dataField'> Vat % : <select name='vat[]' id='vat$i' onchange='calculateProductLine($i)'>";
for($j=0;$j < count($vat_value2); $j++)
{
if($row['vat']==$vat_value2[$j])
$html .= "<option value='".$vat_value2[$j]."' selected>".$vat_value2[$j]."</option>";
else
$html .= "<option value='".$vat_value2[$j]."'>".$vat_value2[$j]."</option>";
}
$html .= "</select></td>";
*/
$html .= "<td class='dataField' colspan='5'></td>";
$html .= "</tr>";
$i++;
}
$html .= "</table>";
$html .= "<div style='padding-top: 10px; padding-bottom:10px;'>";
$html .= "<input type=\"button\" class=\"button\" value=\"" . $mod_strings['LBL_ADD_PRODUCT_LINE'] . "\" id=\"addProductLine\" onclick=\"insertProductLine(" . $countLine . ")\" />";
$html .= "</div>";
$sep = get_number_seperators();
$html .= '<input type="hidden" name="vathidden" id="vathidden" value="' . get_select_options_with_id($vat_value, '') . '">
<input type="hidden" id="grp_seperator" name="grp_seperator" value="' . $sep[0] . '" />
<input type="hidden" id="dec_seperator" name="dec_seperator" value="' . $sep[1] . '" />
<input type="hidden" id="currency_symbol" name="currency_symbol" value="{CURRENCY_SYMBOL}" />';
$this->ss->assign('LINE_ITEMS', $html);
}
示例10: get_worksheet_defintion
//.........这里部分代码省略.........
include 'modules/Forecasts/metadata/listviewdefs.php';
$lv->displayColumns = $listViewDefs['ForecastDirectReports'];
//disable some features.
$lv->multiSelect = false;
$lv->delete = false;
$lv->select = false;
$lv->export = false;
$lv->show_mass_update_form = false;
$lv->setup($DirReportsFocus, 'modules/Forecasts/ListViewForecast.tpl', $where);
//assign logged in user's forecast details.
//this is for user who owns the forecast.
$lv->ss->assign("USER_ID", $current_user->id);
$lv->ss->assign("TIMEPERIOD_ID", $timeperiod_id);
$lv->ss->assign("FORECASTTYPE", 'Rollup');
//top level forecast type.
//set current users forecast details into the form.
$lv->ss->assign("SEL_USER_ID", $user_id);
$lv->ss->assign("SEL_TIMEPERIOD_ID", $timeperiod_id);
$lv->ss->assign("SEL_FORECASTTYPE", $forecast_type);
//commit allowed for this user.
if ($allow_commit && $user_id == $current_user->id && ACLController::checkAccess('Forecasts', 'edit', true)) {
$lv->ss->assign("commit_allowed", 'true');
$lv->ss->assign("COPY_LINK", buildExportLink('rollup'));
}
$prev_commit = $DirReportsFocus->get_last_committed_forecast();
$lv->ss->assign("PREV_COMMIT_DATE", $prev_commit['DATE_ENTERED']);
$lv->ss->assign("PREV_BEST_CASE", $prev_commit['BEST_CASE']);
$lv->ss->assign("PREV_LIKELY_CASE", $prev_commit['LIKELY_CASE']);
$lv->ss->assign("PREV_WORST_CASE", $prev_commit['WORST_CASE']);
$lv->ss->assign("totals", $totals);
}
$lv->ss->assign("CURRENCY_SYMBOL", $DirReportsFocus->currency->symbol);
$lv->ss->assign("CURRENTOPPORTUNITYCOUNT", $DirReportsFocus->total_opp_count);
$lv->ss->assign("CURRENTWEIGHTEDVALUENUMBER", $DirReportsFocus->total_weigh_value_number);
//assign the qota amount.
$lv->ss->assign("QUOTA_VALUE", $DirReportsFocus->get_quota());
}
//process page urls.
if (isset($lv->data['pageData']['urls']['endPage'])) {
$lv->ss->assign("endPageJSON", processnavigation($lv->data['pageData']['urls']['endPage'], $json));
$lv->data['pageData']['urls']['endPage'] = 'javascript:goToNav(3)';
}
if (isset($lv->data['pageData']['urls']['startPage'])) {
$lv->ss->assign("startPageJSON", processnavigation($lv->data['pageData']['urls']['startPage'], $json));
$lv->data['pageData']['urls']['startPage'] = 'javascript:goToNav(0)';
}
if (isset($lv->data['pageData']['urls']['nextPage'])) {
$lv->ss->assign("nextPageJSON", processnavigation($lv->data['pageData']['urls']['nextPage'], $json));
$lv->data['pageData']['urls']['nextPage'] = 'javascript:goToNav(2)';
}
if (isset($lv->data['pageData']['urls']['prevPage'])) {
$lv->ss->assign("prevPageJSON", processnavigation($lv->data['pageData']['urls']['prevPage'], $json));
$lv->data['pageData']['urls']['prevPage'] = 'javascript:goToNav(1)';
}
//process display columns
$orderby_array = processnavigation($lv->data['pageData']['urls']['orderBy']);
//{$pageData.urls.orderBy}{$params.orderBy|default:$colHeader|lower}'
foreach ($lv->displayColumns as $key => $values) {
if (!empty($values['orderBy'])) {
$orderby_array[$lv->lvd->var_order_by] = strtolower($values['orderBy']);
} else {
if (!empty($values['tablename'])) {
$orderby_array[$lv->lvd->var_order_by] = $values['tablename'] . '.' . strtolower($key);
} else {
$orderby_array[$lv->lvd->var_order_by] = strtolower($key);
}
}
$lv->displayColumns[$key]['order_by_object'] = $json->encode($orderby_array);
}
$lv->ss->assign('displayColumns', $lv->displayColumns);
//assign label values to the template.
$lv->ss->assign("LBL_DV_LAST_COMMIT_DATE", $mod_strings['LBL_DV_LAST_COMMIT_DATE']);
$lv->ss->assign("LBL_DV_LAST_COMMIT_AMOUNT", $mod_strings['LBL_DV_LAST_COMMIT_AMOUNT']);
$lv->ss->assign("LBL_COMMIT_NOTE", $mod_strings['LBL_COMMIT_NOTE']);
$lv->ss->assign("LBL_QC_COMMIT_BUTTON", $mod_strings['LBL_QC_COMMIT_BUTTON']);
$lv->ss->assign("LBL_SAVE_WOKSHEET", $mod_strings['LBL_SAVE_WOKSHEET']);
$lv->ss->assign("LBL_RESET_WOKSHEET", $mod_strings['LBL_RESET_WOKSHEET']);
$lv->ss->assign("LBL_RESET_CHECK", $mod_strings['LBL_RESET_CHECK']);
$lv->ss->assign("LBL_BEST_CASE", $mod_strings['LBL_BEST_CASE']);
$lv->ss->assign("LBL_LIKELY_CASE", $mod_strings['LBL_LIKELY_CASE']);
$lv->ss->assign("LBL_WORST_CASE", $mod_strings['LBL_WORST_CASE']);
$lv->ss->assign("ERR_FORECAST_AMOUNT", $mod_strings['ERR_FORECAST_AMOUNT']);
$lv->ss->assign("LBL_COMMIT_MESSAGE", $mod_strings['LBL_COMMIT_MESSAGE']);
$lv->ss->assign("LBL_SHOW_CHART", $mod_strings['LBL_SHOW_CHART']);
$lv->ss->assign("LBL_FORECAST_FOR", $mod_strings['LBL_FORECAST_FOR']);
//
$seps = get_number_seperators();
$lv->ss->assign("NUM_GRP_SEP", $seps[0]);
$lv->ss->assign("DEC_SEP", $seps[1]);
$forecast_for = $sel_user->name . " ";
if (strtolower($forecast_type) == 'direct') {
$forecast_for .= $mod_strings['LBL_FMT_DIRECT_FORECAST'];
} else {
$forecast_for .= $mod_strings['LBL_FMT_ROLLUP_FORECAST'];
}
$lv->ss->assign("USER_FORECAST_TYPE", $forecast_for);
$lv->ss->assign("LBL_TP_QUOTA", $mod_strings['LBL_TP_QUOTA']);
$contents = $lv->display(false);
echo $contents;
}
示例11: setupAll
//.........这里部分代码省略.........
$this->th->ss->assign('JS_CUSTOM_VERSION', $js_custom_version);
//this is used for multiple forms on one page
if (!empty($this->formName)) {
$form_id = $this->formName;
$form_name = $this->formName;
} else {
$form_id = $this->view;
$form_name = $this->view;
}
if ($ajaxSave && empty($this->formName)) {
$form_id = 'form_' . $this->view . '_' . $moduleName;
$form_name = $form_id;
$this->view = $form_name;
}
$form_name = $form_name == 'QuickCreate' ? "QuickCreate_{$moduleName}" : $form_name;
$form_id = $form_id == 'QuickCreate' ? "QuickCreate_{$moduleName}" : $form_id;
if (isset($this->defs['templateMeta']['preForm'])) {
$this->th->ss->assign('preForm', $this->defs['templateMeta']['preForm']);
}
if (isset($this->defs['templateMeta']['form']['closeFormBeforeCustomButtons'])) {
$this->th->ss->assign('closeFormBeforeCustomButtons', $this->defs['templateMeta']['form']['closeFormBeforeCustomButtons']);
}
if (isset($this->defs['templateMeta']['form']['enctype'])) {
$this->th->ss->assign('enctype', 'enctype="' . $this->defs['templateMeta']['form']['enctype'] . '"');
}
//for SugarFieldImage, we must set form enctype to "multipart/form-data"
foreach ($this->fieldDefs as $field) {
if (isset($field['type']) && $field['type'] == 'image') {
$this->th->ss->assign('enctype', 'enctype="multipart/form-data"');
break;
}
}
$this->th->ss->assign('showDetailData', $this->showDetailData);
$this->th->ss->assign('showSectionPanelsTitles', $this->showSectionPanelsTitles);
$this->th->ss->assign('form_id', $form_id);
$this->th->ss->assign('form_name', $form_name);
//$form_name change by id form showCaseForm
$this->th->ss->assign('set_focus_block', get_set_focus_js());
$this->th->ss->assign('form', isset($this->defs['templateMeta']['form']) ? $this->defs['templateMeta']['form'] : null);
$this->th->ss->assign('includes', isset($this->defs['templateMeta']['includes']) ? $this->defs['templateMeta']['includes'] : null);
$this->th->ss->assign('view', $this->view);
$admin = new Administration();
$admin->retrieveSettings();
if (isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
$this->th->ss->assign("PORTAL_ENABLED", true);
} else {
$this->th->ss->assign("PORTAL_ENABLED", false);
}
//Calculate time & date formatting (may need to calculate this depending on a setting)
global $timedate;
$this->th->ss->assign('CALENDAR_DATEFORMAT', $timedate->get_cal_date_format());
$this->th->ss->assign('USER_DATEFORMAT', $timedate->get_user_date_format());
$time_format = $timedate->get_user_time_format();
$this->th->ss->assign('TIME_FORMAT', $time_format);
$date_format = $timedate->get_cal_date_format();
$time_separator = ':';
if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
$time_separator = $match[1];
}
// Create Smarty variables for the Calendar picker widget
$t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
if (!isset($match[2]) || $match[2] == '') {
$this->th->ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . '%M');
} else {
$pm = $match[2] == 'pm' ? '%P' : '%p';
$this->th->ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . '%M' . $pm);
}
$this->th->ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week());
$this->th->ss->assign('TIME_SEPARATOR', $time_separator);
$seps = get_number_seperators();
$this->th->ss->assign('NUM_GRP_SEP', $seps[0]);
$this->th->ss->assign('DEC_SEP', $seps[1]);
if ($this->view == 'EditView' || $this->view == 'BpmView') {
$height = $current_user->getPreference('text_editor_height');
$width = $current_user->getPreference('text_editor_width');
$height = isset($height) ? $height : '300px';
$width = isset($width) ? $width : '95%';
$this->th->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height);
$this->th->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width);
} else {
$this->th->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px');
$this->th->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%');
}
$this->th->ss->assign('SHOW_VCR_CONTROL', $this->showVCRControl);
$str = $this->showTitle($showTitle);
$ajaxSave = false;
//Use the output filter to trim the whitespace
$this->th->ss->load_filter('output', 'trimwhitespace');
$form_name = $this->view;
if ($this->th->checkTemplate($this->bean->module_name, $this->view) && !empty($this->dyn_uid)) {
$nameTemplateTmp = $this->dyn_uid;
} else {
$nameTemplateTmp = 'PMSEDetailView';
}
$this->th->buildTemplate($this->bean->module_name, $nameTemplateTmp, $this->tpl, $ajaxSave, $this->defs);
$this->th->deleteTemplate($this->bean->module_name, $form_name);
$newTplFile = $this->th->cacheDir . $this->th->templateDir . $this->bean->module_name . '/' . $nameTemplateTmp . '.tpl';
$str .= $this->th->ss->fetch($newTplFile);
return $str;
}
示例12: tearDown
public function tearDown()
{
global $sugar_config;
$this->currency_system->symbol = $this->backupSymbol;
$this->currency_system->save(false);
$sugar_config['default_currency_symbol'] = $this->backupSymbol;
format_number(0, 0, 0, array('currency_id' => $this->currency_51568->id, 'currency_symbol' => $this->currency_51568->symbol));
format_number(0, 0, 0, array('currency_id' => -99, 'currency_symbol' => $this->currency_51568->getDefaultCurrencySymbol()));
$this->currency_51568->mark_deleted($this->currency_51568->id);
SugarTestHelper::tearDown();
get_number_seperators(true);
}
示例13: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'modules/Quotes/Layouts.php';
require_once 'include/EditView/EditView2.php';
global $beanFiles;
require_once $beanFiles['Quote'];
require_once $beanFiles['TaxRate'];
require_once $beanFiles['Shipper'];
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $current_user;
global $timedate;
global $locale;
$original_quote = BeanFactory::getBean('Quotes');
if ($this->ev->isDuplicate) {
$this->bean->id = "";
$this->bean->quote_num = "";
$original_quote->retrieve($_REQUEST['record']);
}
//needed when creating a new quote only with a default account value passed in
if (empty($this->bean->id) && !$this->ev->isDuplicate) {
$this->bean->quote_num = '';
$this->bean->total = '0.00';
$this->bean->shipping = '0.00';
$this->bean->tax = '0.00';
$this->bean->subtotal = '0.00';
if (isset($_REQUEST['opportunity_name'])) {
$this->bean->opportunity_name = $_REQUEST['opportunity_name'];
}
if (isset($_REQUEST['opportunity_id'])) {
$this->bean->opportunity_id = $_REQUEST['opportunity_id'];
}
if (isset($_REQUEST['account_name'])) {
$this->bean->billing_account_name = $_REQUEST['account_name'];
$this->bean->shipping_account_name = $_REQUEST['account_name'];
}
if (isset($_REQUEST['account_id'])) {
$this->bean->billing_account_id = $_REQUEST['account_id'];
$this->bean->shipping_account_id = $_REQUEST['account_id'];
require_once $beanFiles['Account'];
$account = BeanFactory::getBean('Accounts', $this->bean->shipping_account_id);
$this->bean->shipping_address_street = $account->shipping_address_street;
$this->bean->shipping_address_city = $account->shipping_address_city;
$this->bean->shipping_address_state = $account->shipping_address_state;
$this->bean->shipping_address_country = $account->shipping_address_country;
$this->bean->shipping_address_postalcode = $account->shipping_address_postalcode;
$this->bean->billing_address_street = $account->billing_address_street;
$this->bean->billing_address_city = $account->billing_address_city;
$this->bean->billing_address_state = $account->billing_address_state;
$this->bean->billing_address_country = $account->billing_address_country;
$this->bean->billing_address_postalcode = $account->billing_address_postalcode;
}
if (isset($_REQUEST['contact_id'])) {
$this->bean->contact_id = $_REQUEST['contact_id'];
require_once $beanFiles['Contact'];
$contact = BeanFactory::getBean('Contacts', $this->bean->contact_id);
$this->bean->billing_contact_name = $locale->formatName($contact);
$this->bean->billing_contact_id = $contact->id;
$this->bean->shipping_contact_name = $locale->formatName($contact);
$this->bean->shipping_contact_id = $contact->id;
$this->bean->shipping_address_street = $contact->primary_address_street;
$this->bean->shipping_address_city = $contact->primary_address_city;
$this->bean->shipping_address_state = $contact->primary_address_state;
$this->bean->shipping_address_country = $contact->primary_address_country;
$this->bean->shipping_address_postalcode = $contact->primary_address_postalcode;
}
if (isset($_REQUEST['date_quote_expected_closed'])) {
$this->bean->date_quote_expected_closed = $_REQUEST['date_quote_expected_closed'];
}
if (isset($_REQUEST['currency_id'])) {
$this->bean->currency_id = $_REQUEST['currency_id'];
}
}
$currency = BeanFactory::getBean('Currencies', $this->bean->currency_id);
// Set the number grouping and decimal separators
$seps = get_number_seperators();
$dec_sep = $seps[1];
$num_grp_sep = $seps[0];
$this->ss->assign('NUM_GRP_SEP', $num_grp_sep);
$this->ss->assign('DEC_SEP', $dec_sep);
$significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
$this->ss->assign('PRECISION', $significantDigits);
if ((is_admin($current_user) || is_admin_for_module($GLOBALS['current_user'], 'Quotes')) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
$record = '';
if (!empty($_REQUEST['record'])) {
$record = $_REQUEST['record'];
}
$this->ss->assign('ADMIN_EDIT', "<a href='index.php?action=index&module=DynamicLayout&from_action=" . $_REQUEST['action'] . "&from_module=" . $_REQUEST['module'] . "&record=" . $record . "'>" . SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDITLAYOUT']) . "</a>");
}
$this->ss->assign('QUOTE_STAGE_OPTIONS', get_select_options_with_id($app_list_strings['quote_stage_dom'], $this->bean->quote_stage));
$this->ss->assign('DEFAULT_PRODUCT_STATUS', $app_list_strings['product_status_quote_key']);
if (isset($this->bean->subtotal)) {
$this->ss->assign('SUBTOTAL', $this->bean->subtotal);
} else {
$this->ss->assign('SUBTOTAL', "0.00");
}
//.........这里部分代码省略.........
示例14: testget_number_seperators
public function testget_number_seperators()
{
$this->assertEquals(array(',', '.'), get_number_seperators());
$this->assertEquals(array(',', '.'), get_number_seperators(false));
}
示例15: parse_template_bean
function parse_template_bean($string, $bean_name, &$focus)
{
global $app_strings, $module;
$repl_arr = array();
foreach ($focus->field_defs as $field_def) {
if ($field_def['type'] == 'enum' && isset($field_def['options'])) {
$translated = translate($field_def['options'], $bean_name, $focus->{$field_def}['name']);
if (isset($translated) && !is_array($translated)) {
$repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = $translated;
} else {
// unset enum field, make sure we have a match string to replace with ""
$repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = '';
}
} elseif ($field_def['type'] == 'currency') {
//Custom kiem tra kieu currency
$repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = number_format($focus->{$field_def}['name'], '2', '.', '');
} else {
$repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = $focus->{$field_def}['name'];
}
}
// end foreach()
krsort($repl_arr);
reset($repl_arr);
foreach ($repl_arr as $name => $value) {
if (strpos($name, 'amt') > 0 || strpos($name, 'amount') > 0 || strpos($name, 'price') > 0) {
$value = currency_format_number($value, $params = array('currency_symbol' => false));
} else {
if (strpos($name, 'product_discount') > 0) {
if ($value != '' && $value != '0.00') {
if ($repl_arr[aos_products_quotes_discount] == 'Percentage') {
$sep = get_number_seperators();
$value = trim(trim(currency_format_number($value, $params = array('currency_symbol' => false)), '0'), $sep[1]) . $app_strings['LBL_PERCENTAGE_SYMBOL'];
} else {
$value = currency_format_number($value, $params = array('currency_symbol' => false));
}
} else {
$value = '';
}
}
}
if ($name === 'aos_products_quotes_vat' || strpos($name, 'pct') > 0 || strpos($name, 'percent') > 0 || strpos($name, 'percentage') > 0) {
$sep = get_number_seperators();
$value = trim(trim(currency_format_number($value, $params = array('currency_symbol' => false)), '0'), $sep[1]) . $app_strings['LBL_PERCENTAGE_SYMBOL'];
}
// Kiem tra kieu ngay
$fieldsname = explode('_', $name, 2);
if (strpos($fieldsname[1], 'date') > 0 || strpos($fieldsname[1], 'expiration') > 0) {
if ($value != '') {
$dt = explode(' ', $value);
$value = $dt[0];
}
}
if ($value != '' && is_string($value)) {
$string = str_replace("\${$name}", $value, $string);
} else {
if (strpos($name, 'address') > 0) {
$string = str_replace("\${$name}<br />", '', $string);
$string = str_replace("\${$name} <br />", '', $string);
$string = str_replace("\${$name}", '', $string);
} else {
$string = str_replace("\${$name}", ' ', $string);
}
}
}
return $string;
}