本文整理汇总了PHP中CurrencyField::getDecimalsFromTypeOfData方法的典型用法代码示例。如果您正苦于以下问题:PHP CurrencyField::getDecimalsFromTypeOfData方法的具体用法?PHP CurrencyField::getDecimalsFromTypeOfData怎么用?PHP CurrencyField::getDecimalsFromTypeOfData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurrencyField
的用法示例。
在下文中一共展示了CurrencyField::getDecimalsFromTypeOfData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOutputHtml
//.........这里部分代码省略.........
$result = $adb->pquery($sql, array($value));
$parent_name = $adb->query_result($result, 0, "accountname");
$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';
示例2: adjustCurrencyField
/** Function to retrieve maximum decimal values of currency field on save
* @param $fieldname currency field name
* @param $fldvalue currency value they want to save
* @returns field value from database with maximum decimals if it is the same as value being saved
*/
function adjustCurrencyField($fieldname, $fldvalue, $tabid)
{
global $adb, $log, $current_user;
$log->debug("Entering adjustCurrencyField({$fieldname},{$fldvalue})");
if (isset(self::$dbvalues[$fieldname])) {
$dbvalue = self::$dbvalues[$fieldname];
} else {
$dbvals = $result = array();
foreach ($this->tab_name_index as $table_name => $index) {
$result = $adb->pquery("select * from {$table_name} where {$index}=?", array($this->id));
$flds = $adb->fetch_array($result);
$dbvals = array_merge($dbvals, $flds);
}
self::$dbvalues = $dbvals;
$dbvalue = self::$dbvalues[$fieldname];
$fldrs = $adb->pquery('select fieldname,typeofdata from vtiger_field
where vtiger_field.uitype in (7,9,71,72) and vtiger_field.tabid=?', array($tabid));
while ($fldinf = $adb->fetch_array($fldrs)) {
self::$todvalues[$fldinf['fieldname']] = $fldinf['typeofdata'];
}
}
$typeofdata = self::$todvalues[$fieldname];
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
if (round($dbvalue, min($decimals, $current_user->no_of_currency_decimals)) == $fldvalue) {
$fldvalue = $dbvalue;
}
$log->debug("Exiting adjustCurrencyField ({$fldvalue})");
return $fldvalue;
}
示例3: getDetailViewOutputHtml
//.........这里部分代码省略.........
}
$label_fld[] = $displayValue;
} 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];