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


PHP CurrencyField::convertFromDollar方法代码示例

本文整理汇总了PHP中CurrencyField::convertFromDollar方法的典型用法代码示例。如果您正苦于以下问题:PHP CurrencyField::convertFromDollar方法的具体用法?PHP CurrencyField::convertFromDollar怎么用?PHP CurrencyField::convertFromDollar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CurrencyField的用法示例。


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

示例1: generateData

	function generateData() {
		$db = PearDatabase::getInstance();
		$chartSQL = $this->getQuery();

		$result = $db->pquery($chartSQL, array());
		$rows = $db->num_rows($result);
		$values = array();

		$queryColumnsByFieldModel = $this->getQueryColumnsByFieldModel();

		$recordCountLabel = '';
		if($this->isRecordCount()) {
			$recordCountLabel = 'RECORD_COUNT';
		}

		$groupByColumnsByFieldModel = $this->getGroupbyColumnsByFieldModel();

		$currentUserModel = Users_Record_Model::getCurrentUserModel();
		$currencyRateAndSymbol = getCurrencySymbolandCRate($currentUserModel->currency_id);
		$links = array();

		for($i = 0; $i < $rows; $i++) {
			$row = $db->query_result_rowdata($result, $i);

			if($recordCountLabel) {
				$values[$i][] = (int) $row[strtolower($recordCountLabel)];
			}

			if($queryColumnsByFieldModel) {
				foreach($queryColumnsByFieldModel as $fieldModel) {
					if($fieldModel->get('uitype') == '71' || $fieldModel->get('uitype') == '72') {
						$value = (float) ($row[strtolower($fieldModel->get('reportlabel'))]);
						$values[$i][] = CurrencyField::convertFromDollar($value, $currencyRateAndSymbol['rate']);
					} else {
						$values[$i][] = (int) $row[strtolower($fieldModel->get('reportlabel'))];
					}
				}
			}

			if($groupByColumnsByFieldModel) {
				foreach($groupByColumnsByFieldModel as $gFieldModel) {
					$fieldDataType = $gFieldModel->getFieldDataType();
					if($fieldDataType == 'picklist') {
						$label = vtranslate($row[strtolower($gFieldModel->get('reportlabel'))], $gFieldModel->getModuleName());
					} else if($fieldDataType == 'multipicklist') {
						$multiPicklistValue = $row[strtolower($gFieldModel->get('reportlabel'))];
						$multiPicklistValues = explode(' |##| ', $multiPicklistValue);
						foreach($multiPicklistValues as $multiPicklistValue) {
							$labelList[] = vtranslate($multiPicklistValue, $gFieldModel->getModuleName());
						}
						$label =  implode(',', $labelList);
					} else if($fieldDataType == 'date') {
						$label = Vtiger_Date_UIType::getDisplayDateValue($row[strtolower($gFieldModel->get('reportlabel'))]);
					} else if($fieldDataType == 'datetime') {
						$label = Vtiger_Date_UIType::getDisplayDateTimeValue($row[strtolower($gFieldModel->get('reportlabel'))]);
					} else {
                        // SalesPlatform.ru begin
                        $primaryModule = $this->getPrimaryModule();
                        if($primaryModule == 'PBXManager') {
                            $label = getUserFullName($row[strtolower($gFieldModel->get('reportlabel'))]);
                        } else {
                            $label = $row[strtolower($gFieldModel->get('reportlabel'))];
                        }
                        //$label = $row[strtolower($gFieldModel->get('reportlabel'))];
                        // SalesPlatform.ru end
					}
                                        //SalesPlatform.ru begin   
                                        $labels[] = (mb_strlen($label, 'UTF-8') > 30) ? mb_substr($label, 0, 30).'..' : $label; 
					//$labels[] = (strlen($label) > 30) ? substr($label, 0, 30).'..' : $label;
                                        //SalesPlatform.ru end
					$links[] = $this->generateLink($gFieldModel->get('reportcolumninfo'), $row[strtolower($gFieldModel->get('reportlabel'))]);
				}
			}
		}

		$data = array(	'labels' => $labels,
						'values' => $values,
						'links' => $links,
						'type' => (count($values[0]) == 1) ? 'singleBar' : 'multiBar',
						'data_labels' => $this->getDataLabels(),
						'graph_label' => $this->getGraphLabel()
					);
		return $data;
	}
开发者ID:Wasage,项目名称:werpa,代码行数:84,代码来源:Chart.php


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