本文整理汇总了PHP中CurrencyField::setNumberofDecimals方法的典型用法代码示例。如果您正苦于以下问题:PHP CurrencyField::setNumberofDecimals方法的具体用法?PHP CurrencyField::setNumberofDecimals怎么用?PHP CurrencyField::setNumberofDecimals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurrencyField
的用法示例。
在下文中一共展示了CurrencyField::setNumberofDecimals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdvancedSearchCriteriaList
function getAdvancedSearchCriteriaList($advft_criteria, $advft_criteria_groups, $module = '')
{
global $currentModule, $current_user;
if (empty($module)) {
$module = $currentModule;
}
$advfilterlist = array();
$moduleHandler = vtws_getModuleHandlerFromName($module, $current_user);
$moduleMeta = $moduleHandler->getMeta();
$moduleFields = $moduleMeta->getModuleFields();
foreach ($advft_criteria as $column_index => $column_condition) {
if (empty($column_condition)) {
continue;
}
$adv_filter_column = $column_condition["columnname"];
$adv_filter_comparator = $column_condition["comparator"];
$adv_filter_value = $column_condition["value"];
$adv_filter_column_condition = $column_condition["columncondition"];
$adv_filter_groupid = $column_condition["groupid"];
$column_info = explode(":", $adv_filter_column);
$fieldName = $column_info[2];
$fieldObj = $moduleFields[$fieldName];
$fieldType = $fieldObj->getFieldDataType();
if ($fieldType == 'currency') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($fieldObj->getUIType() == '72') {
$adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value, null, true);
} else {
$currencyField = new CurrencyField($adv_filter_value);
if ($module == 'Potentials' && $fieldName == 'amount') {
$currencyField->setNumberofDecimals(2);
}
$adv_filter_value = $currencyField->getDBInsertedValue();
}
}
$criteria = array();
$criteria['columnname'] = $adv_filter_column;
$criteria['comparator'] = $adv_filter_comparator;
$criteria['value'] = $adv_filter_value;
$criteria['column_condition'] = $adv_filter_column_condition;
$advfilterlist[$adv_filter_groupid]['columns'][] = $criteria;
}
foreach ($advft_criteria_groups as $group_index => $group_condition_info) {
if (empty($group_condition_info)) {
continue;
}
if (empty($advfilterlist[$group_index])) {
continue;
}
$advfilterlist[$group_index]['condition'] = $group_condition_info["groupcondition"];
$noOfGroupColumns = count($advfilterlist[$group_index]['columns']);
if (!empty($advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'])) {
$advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'] = '';
}
}
$noOfGroups = count($advfilterlist);
if (!empty($advfilterlist[$noOfGroups]['condition'])) {
$advfilterlist[$noOfGroups]['condition'] = '';
}
return $advfilterlist;
}
示例2: sanitizeCurrencyFieldsForInsert
function sanitizeCurrencyFieldsForInsert($row, $meta)
{
global $current_user;
$moduleFields = $meta->getModuleFields();
foreach ($moduleFields as $fieldName => $fieldObj) {
if (($fieldObj->getFieldDataType() == "currency" || $fieldObj->getFieldDataType() == "double") && !empty($row[$fieldName])) {
$uitype = $fieldObj->getUIType();
$cryFields = new CurrencyField($row[$fieldName]);
$cryFields->initialize($current_user);
$cryFields->setNumberofDecimals($cryFields::$maxNumberOfDecimals);
if ($uitype == '71') {
$row[$fieldName] = $cryFields->getDisplayValue($current_user, false, true);
} else {
if ($uitype == '72' || $uitype == '7' || $uitype == '9') {
$row[$fieldName] = $cryFields->getDisplayValue($current_user, true, true);
}
}
}
}
return $row;
}
示例3: getDetailViewOutputHtml
//.........这里部分代码省略.........
} elseif ($uitype == 5 || $uitype == 23 || $uitype == 70) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
$dateValue = $col_fields[$fieldname];
if (isset($col_fields['time_end']) && $col_fields['time_end'] != '' && ($tabid == 9 || $tabid == 16) && $uitype == 23) {
$end_time = $col_fields['time_end'];
}
if ($dateValue == '0000-00-00' || empty($dateValue)) {
$displayValue = '';
} else {
if (empty($end_time) && strpos($dateValue, ' ') == false) {
$displayValue = DateTimeField::convertToUserFormat($col_fields[$fieldname]);
} else {
if (!empty($end_time)) {
$date = new DateTimeField($col_fields[$fieldname] . ' ' . $end_time);
} else {
$date = new DateTimeField($col_fields[$fieldname]);
}
$displayValue = $date->getDisplayDateTimeValue();
}
}
$label_fld[] = $displayValue;
} elseif ($uitype == 9 || $uitype == 7) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
$fldrs = $adb->pquery('select typeofdata from vtiger_field
where vtiger_field.fieldname=? and vtiger_field.tabid=?', array($fieldname, $tabid));
$typeofdata = $adb->query_result($fldrs, 0, 0);
$typeinfo = explode('~', $typeofdata);
if ($typeinfo[0] == 'I') {
$label_fld[] = $col_fields[$fieldname];
} else {
$currencyField = new CurrencyField($col_fields[$fieldname]);
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
$currencyField->initialize($current_user);
$currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
$label_fld[] = $currencyField->getDisplayValue(null, false, true);
}
} elseif ($uitype == 71 || $uitype == 72) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
$currencyField = new CurrencyField($col_fields[$fieldname]);
$fldrs = $adb->pquery('select typeofdata from vtiger_field
where vtiger_field.fieldname=? and vtiger_field.tabid=?', array($fieldname, $tabid));
$typeofdata = $adb->query_result($fldrs, 0, 0);
$typeinfo = explode('~', $typeofdata);
if ($uitype == 72) {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($fieldname == 'unit_price') {
$rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module));
$label_fld[] = $currencyField->getDisplayValue(null, true);
$label_fld["cursymb"] = $rate_symbol['symbol'];
} else {
$currency_info = getInventoryCurrencyInfo($module, $col_fields['record_id']);
$label_fld[] = $currencyField->getDisplayValue(null, true);
$label_fld["cursymb"] = $currency_info['currency_symbol'];
}
} else {
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
$currencyField->initialize($current_user);
$currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
$label_fld[] = $currencyField->getDisplayValue(null, false, true);
$label_fld["cursymb"] = $currencyField->getCurrencySymbol();
}
} elseif ($uitype == 75 || $uitype == 81) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
$vendor_id = $col_fields[$fieldname];
if ($vendor_id != '') {
$vendor_name = getVendorName($vendor_id);
示例4: getOutputHtml
//.........这里部分代码省略.........
$account_selected = "selected";
} else {
$parent_name = "";
$value = "";
}
}
$editview_label[0] = array();
$editview_label[1] = array();
$editview_label[2] = array();
if (vtlib_isModuleActive('Accounts')) {
array_push($editview_label[0], $app_strings['COMBO_ACCOUNTS']);
array_push($editview_label[1], $account_selected);
array_push($editview_label[2], "Accounts");
}
if (vtlib_isModuleActive('Contacts')) {
array_push($editview_label[0], $app_strings['COMBO_CONTACTS']);
array_push($editview_label[1], $contact_selected);
array_push($editview_label[2], "Contacts");
}
$fieldvalue[] = $parent_name;
$fieldvalue[] = $value;
} elseif ($uitype == 9 || $uitype == 7) {
$editview_label[] = getTranslatedString($fieldlabel, $module_name);
$fldrs = $adb->pquery('select typeofdata from vtiger_field
where vtiger_field.fieldname=? and vtiger_field.tabid=?', array($fieldname, getTabid($module_name)));
$typeofdata = $adb->query_result($fldrs, 0, 0);
$typeinfo = explode('~', $typeofdata);
if ($typeinfo[0] == 'I') {
$fieldvalue[] = $value;
} else {
$currencyField = new CurrencyField($value);
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
$currencyField->initialize($current_user);
$currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
$fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
}
} elseif ($uitype == 71 || $uitype == 72) {
$currencyField = new CurrencyField($value);
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($col_fields['record_id'] != '' && $uitype == 72) {
if ($fieldname == 'unit_price') {
$rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module_name));
$currencySymbol = $rate_symbol['symbol'];
} else {
$currency_info = getInventoryCurrencyInfo($module, $col_fields['record_id']);
$currencySymbol = $currency_info['currency_symbol'];
}
$fieldvalue[] = $currencyField->getDisplayValue(null, true);
} else {
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
$currencyField->initialize($current_user);
$currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
$fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
$currencySymbol = $currencyField->getCurrencySymbol();
}
$editview_label[] = getTranslatedString($fieldlabel, $module_name) . ': (' . $currencySymbol . ')';
} elseif ($uitype == 75 || $uitype == 81) {
if ($value != '') {
$vendor_name = getVendorName($value);
} elseif (isset($_REQUEST['vendor_id']) && $_REQUEST['vendor_id'] != '') {
$value = $_REQUEST['vendor_id'];
$vendor_name = getVendorName($value);
}
$pop_type = 'specific';
if ($uitype == 81) {
$pop_type = 'specific_vendor_address';
示例5: addUserSearchConditions
//.........这里部分代码省略.........
$this->addConditionGlue($columncondition);
}
}
$this->endGroup();
$groupConditionGlue = $groupcolumns['condition'];
if (!empty($groupConditionGlue)) {
$this->addConditionGlue($groupConditionGlue);
}
}
}
$this->endGroup();
} elseif ($input['type'] == 'dbrd') {
if ($this->conditionInstanceCount > 0) {
$this->startGroup(self::$AND);
} else {
$this->startGroup('');
}
$allConditionsList = $this->getDashBoardConditionList();
$conditionList = $allConditionsList['conditions'];
$relatedConditionList = $allConditionsList['relatedConditions'];
$noOfConditions = count($conditionList);
$noOfRelatedConditions = count($relatedConditionList);
foreach ($conditionList as $index => $conditionInfo) {
$this->addCondition($conditionInfo['fieldname'], $conditionInfo['value'], $conditionInfo['operator']);
if ($index < $noOfConditions - 1 || $noOfRelatedConditions > 0) {
$this->addConditionGlue(self::$AND);
}
}
foreach ($relatedConditionList as $index => $conditionInfo) {
$this->addRelatedModuleCondition($conditionInfo['relatedModule'], $conditionInfo['conditionModule'], $conditionInfo['finalValue'], $conditionInfo['SQLOperator']);
if ($index < $noOfRelatedConditions - 1) {
$this->addConditionGlue(self::$AND);
}
}
$this->endGroup();
} else {
if (isset($input['search_field']) && $input['search_field'] != "") {
$fieldName = vtlib_purify($input['search_field']);
} else {
return;
}
if ($this->conditionInstanceCount > 0) {
$this->startGroup(self::$AND);
} else {
$this->startGroup('');
}
$moduleFields = $this->meta->getModuleFields();
$field = $moduleFields[$fieldName];
$type = $field->getFieldDataType();
if (isset($input['search_text']) && $input['search_text'] != "") {
// search other characters like "|, ?, ?" by jagi
$value = $input['search_text'];
$stringConvert = function_exists(iconv) ? @iconv("UTF-8", $default_charset, $value) : $value;
if (!$this->isStringType($type)) {
$value = trim($stringConvert);
}
if ($type == 'picklist') {
global $mod_strings;
// Get all the keys for the for the Picklist value
$mod_keys = array_keys($mod_strings, $value);
if (sizeof($mod_keys) >= 1) {
// Iterate on the keys, to get the first key which doesn't start with LBL_ (assuming it is not used in PickList)
foreach ($mod_keys as $mod_idx => $mod_key) {
$stridx = strpos($mod_key, 'LBL_');
// Use strict type comparision, refer strpos for more details
if ($stridx !== 0) {
$value = $mod_key;
break;
}
}
}
}
if ($type == 'currency') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$value = CurrencyField::convertToDBFormat($value, null, true);
} else {
$currencyField = new CurrencyField($value);
if ($this->getModule() == 'Potentials' && $fieldName == 'amount') {
$currencyField->setNumberofDecimals(2);
}
$value = $currencyField->getDBInsertedValue();
}
}
}
if (!empty($input['operator'])) {
$operator = $input['operator'];
} elseif (trim(strtolower($value)) == 'null') {
$operator = 'e';
} else {
if (!$this->isNumericType($type) && !$this->isDateType($type)) {
$operator = 'c';
} else {
$operator = 'h';
}
}
$this->addCondition($fieldName, $value, $operator);
$this->endGroup();
}
}