本文整理汇总了PHP中getCurrencySymbolandCRate函数的典型用法代码示例。如果您正苦于以下问题:PHP getCurrencySymbolandCRate函数的具体用法?PHP getCurrencySymbolandCRate怎么用?PHP getCurrencySymbolandCRate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCurrencySymbolandCRate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTopPotentials
function getTopPotentials($maxval, $calCnt)
{
$log = LoggerManager::getLogger('top opportunity_list');
$log->debug("Entering getTopPotentials() method ...");
require_once "data/Tracker.php";
require_once 'modules/Potentials/Potentials.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
global $app_strings;
global $adb;
global $current_language;
global $current_user;
$current_module_strings = return_module_language($current_language, "Potentials");
$title = array();
$title[] = 'myTopOpenPotentials.gif';
$title[] = $current_module_strings['LBL_TOP_OPPORTUNITIES'];
$title[] = 'home_mypot';
$where = "AND vtiger_potential.potentialid > 0 AND vtiger_potential.sales_stage not in ('Closed Won','Closed Lost','" . $current_module_strings['Closed Won'] . "','" . $current_module_strings['Closed Lost'] . "') AND vtiger_crmentity.smownerid='" . $current_user->id . "' AND vtiger_potential.amount > 0";
$header = array();
$header[] = $current_module_strings['LBL_LIST_OPPORTUNITY_NAME'];
//$header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME'];
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
$curr_symbol = $rate_symbol['symbol'];
$header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
$list_query = "SELECT vtiger_crmentity.crmid, vtiger_potential.potentialname,\n\t\t\tvtiger_potential.amount, potentialid\n\t\t\tFROM vtiger_potential\n\t\t\tIGNORE INDEX(PRIMARY) INNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_potential.potentialid";
$list_query .= getNonAdminAccessControlQuery('Potentials', $current_user);
$list_query .= "WHERE vtiger_crmentity.deleted = 0 " . $where;
$list_query .= " ORDER BY amount DESC";
$list_query .= " LIMIT " . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($list_query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($list_query);
$open_potentials_list = array();
$noofrows = $adb->num_rows($list_result);
$entries = array();
if ($noofrows) {
for ($i = 0; $i < $noofrows; $i++) {
$open_potentials_list[] = array('name' => $adb->query_result($list_result, $i, 'potentialname'), 'id' => $adb->query_result($list_result, $i, 'potentialid'), 'amount' => $adb->query_result($list_result, $i, 'amount'));
$potentialid = $adb->query_result($list_result, $i, 'potentialid');
$potentialname = $adb->query_result($list_result, $i, 'potentialname');
$Top_Potential = strlen($potentialname) > 20 ? substr($potentialname, 0, 20) . '...' : $potentialname;
$value = array();
$value[] = '<a href="index.php?action=DetailView&module=Potentials&record=' . $potentialid . '">' . $Top_Potential . '</a>';
$value[] = CurrencyField::convertToUserFormat($adb->query_result($list_result, $i, 'amount'));
$entries[$potentialid] = $value;
}
}
$advft_criteria_groups = array('1' => array('groupcondition' => null));
$advft_criteria = array(array('groupid' => 1, 'columnname' => 'vtiger_potential:sales_stage:sales_stage:Potentials_Sales_Stage:V', 'comparator' => 'k', 'value' => 'closed', 'columncondition' => 'and'), array('groupid' => 1, 'columnname' => 'vtiger_potential:amount:amount:Potentials_Amount:N', 'comparator' => 'g', 'value' => '0', 'columncondition' => 'and'), array('groupid' => 1, 'columnname' => 'vtiger_crmentity:smownerid:assigned_user_id:Leads_Assigned_To:V', 'comparator' => 'e', 'value' => getFullNameFromArray('Users', $current_user->column_fields), 'columncondition' => null));
$search_qry = '&advft_criteria=' . Zend_Json::encode($advft_criteria) . '&advft_criteria_groups=' . Zend_Json::encode($advft_criteria_groups) . '&searchtype=advance&query=true';
$values = array('ModuleName' => 'Potentials', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
if (count($open_potentials_list) == 0 || count($open_potentials_list) > 0) {
$log->debug("Exiting getTopPotentials method ...");
return $values;
}
}
示例2: getTopAccounts
function getTopAccounts($maxval, $calCnt)
{
$log = LoggerManager::getLogger('top accounts_list');
$log->debug("Entering getTopAccounts() method ...");
require_once "data/Tracker.php";
require_once 'modules/Potentials/Potentials.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
global $app_strings;
global $adb;
global $current_language;
global $current_user;
$current_module_strings = return_module_language($current_language, "Accounts");
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
$list_query = "select vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol, sum(vtiger_potential.amount) as amount from vtiger_potential inner join vtiger_crmentity on (vtiger_potential.potentialid=vtiger_crmentity.crmid) left join vtiger_account on (vtiger_potential.related_to=vtiger_account.accountid) left join vtiger_groups on (vtiger_groups.groupid = vtiger_crmentity.smownerid) where vtiger_crmentity.deleted=0 AND vtiger_crmentity.smownerid='" . $current_user->id . "' and vtiger_potential.sales_stage not in ('Closed Won', 'Closed Lost','" . $app_strings['LBL_CLOSE_WON'] . "','" . $app_strings['LBL_CLOSE_LOST'] . "')";
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[6] == 3) {
$sec_parameter = getListViewSecurityParameter('Accounts');
$list_query .= $sec_parameter;
}
$list_query .= " group by vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol order by amount desc";
$list_query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($list_query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($list_query);
$open_accounts_list = array();
$noofrows = $adb->num_rows($list_result);
if ($noofrows) {
for ($i = 0; $i < $noofrows; $i++) {
$open_accounts_list[] = array('accountid' => $adb->query_result($list_result, $i, 'accountid'), 'accountname' => $adb->query_result($list_result, $i, 'accountname'), 'amount' => $adb->query_result($list_result, $i, 'amount'), 'tickersymbol' => $adb->query_result($list_result, $i, 'tickersymbol'));
}
}
$title = array();
$title[] = 'myTopAccounts.gif';
$title[] = $current_module_strings['LBL_TOP_ACCOUNTS'];
$title[] = 'home_myaccount';
$header = array();
$header[] = $current_module_strings['LBL_LIST_ACCOUNT_NAME'];
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
$curr_symbol = $rate_symbol['symbol'];
$header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
$entries = array();
foreach ($open_accounts_list as $account) {
$value = array();
$account_fields = array('ACCOUNT_ID' => $account['accountid'], 'ACCOUNT_NAME' => $account['accountname'], 'AMOUNT' => $account['amount']);
$Top_Accounts = strlen($account['accountname']) > 20 ? substr($account['accountname'], 0, 20) . '...' : $account['accountname'];
$value[] = '<a href="index.php?action=DetailView&module=Accounts&record=' . $account['accountid'] . '">' . $Top_Accounts . '</a>';
$value[] = convertFromDollar($account['amount'], $rate);
$entries[$account['accountid']] = $value;
}
$values = array('ModuleName' => 'Accounts', 'Title' => $title, 'Header' => $header, 'Entries' => $entries);
$log->debug("Exiting getTopAccounts method ...");
if ($display_empty_home_blocks && count($entries) == 0 || count($entries) > 0) {
return $values;
}
}
示例3: getTopPotentials
function getTopPotentials($maxval, $calCnt)
{
$log = LoggerManager::getLogger('top opportunity_list');
$log->debug("Entering getTopPotentials() method ...");
require_once "data/Tracker.php";
require_once 'modules/Potentials/Potentials.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
global $app_strings;
global $adb;
global $current_language;
global $current_user;
$current_module_strings = return_module_language($current_language, "Potentials");
$title = array();
$title[] = 'myTopOpenPotentials.gif';
$title[] = $current_module_strings['LBL_TOP_OPPORTUNITIES'];
$title[] = 'home_mypot';
$where = "AND vtiger_potential.potentialid > 0 AND vtiger_potential.sales_stage not in ('Closed Won','Closed Lost','" . $current_module_strings['Closed Won'] . "','" . $current_module_strings['Closed Lost'] . "') AND vtiger_crmentity.smownerid='" . $current_user->id . "' AND vtiger_potential.amount > 0";
$header = array();
$header[] = $current_module_strings['LBL_LIST_OPPORTUNITY_NAME'];
//$header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME'];
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
$curr_symbol = $rate_symbol['symbol'];
$header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
$list_query = "SELECT vtiger_crmentity.crmid, vtiger_potential.potentialname,\n\t\t\tvtiger_potential.amount, potentialid\n\t\t\tFROM vtiger_potential\n\t\t\tIGNORE INDEX(PRIMARY) INNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_potential.potentialid";
$list_query .= getNonAdminAccessControlQuery('Potentials', $current_user);
$list_query .= "WHERE vtiger_crmentity.deleted = 0 " . $where;
$list_query .= " ORDER BY amount DESC";
$list_query .= " LIMIT " . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($list_query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($list_query);
$open_potentials_list = array();
$noofrows = $adb->num_rows($list_result);
$entries = array();
if ($noofrows) {
for ($i = 0; $i < $noofrows; $i++) {
$open_potentials_list[] = array('name' => $adb->query_result($list_result, $i, 'potentialname'), 'id' => $adb->query_result($list_result, $i, 'potentialid'), 'amount' => $adb->query_result($list_result, $i, 'amount'));
$potentialid = $adb->query_result($list_result, $i, 'potentialid');
$potentialname = $adb->query_result($list_result, $i, 'potentialname');
$Top_Potential = strlen($potentialname) > 20 ? substr($potentialname, 0, 20) . '...' : $potentialname;
$value = array();
$value[] = '<a href="index.php?action=DetailView&module=Potentials&record=' . $potentialid . '">' . $Top_Potential . '</a>';
$value[] = convertFromDollar($adb->query_result($list_result, $i, 'amount'), $rate);
$entries[$potentialid] = $value;
}
}
$search_qry = "&query=true&Fields0=assigned_user_id&Condition0=e&Srch_value0=" . $current_user->column_fields['user_name'] . "&Fields1=sales_stage&Condition1=k&Srch_value1=closed&searchtype=advance&search_cnt=2&matchtype=all";
$values = array('ModuleName' => 'Potentials', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
if ($display_empty_home_blocks && count($open_potentials_list) == 0 || count($open_potentials_list) > 0) {
$log->debug("Exiting getTopPotentials method ...");
return $values;
}
}
示例4: updateListPrices
function updateListPrices()
{
global $log, $adb;
$log->debug("Entering function updateListPrices...");
$pricebook_currency = $this->column_fields['currency_id'];
$prod_res = $adb->pquery("select * from vtiger_pricebookproductrel where pricebookid=? AND usedcurrency != ?", array($this->id, $pricebook_currency));
$numRows = $adb->num_rows($prod_res);
for ($i = 0; $i < $numRows; $i++) {
$product_id = $adb->query_result($prod_res, $i, 'productid');
$list_price = $adb->query_result($prod_res, $i, 'listprice');
$used_currency = $adb->query_result($prod_res, $i, 'usedcurrency');
$product_currency_info = getCurrencySymbolandCRate($used_currency);
$product_conv_rate = $product_currency_info['rate'];
$pricebook_currency_info = getCurrencySymbolandCRate($pricebook_currency);
$pb_conv_rate = $pricebook_currency_info['rate'];
$conversion_rate = $pb_conv_rate / $product_conv_rate;
$computed_list_price = $list_price * $conversion_rate;
$query = "update vtiger_pricebookproductrel set listprice=?, usedcurrency=? where pricebookid=? and productid=?";
$params = array($computed_list_price, $pricebook_currency, $this->id, $product_id);
$adb->pquery($query, $params);
}
$log->debug("Exiting function updateListPrices...");
}
示例5: getCurrencySymbol
/**
* Function that gives the Currency Symbol
* @params $result $adb object - resultset
* $column String column name
* Return $value - Currency Symbol
*/
function getCurrencySymbol($result, $i, $column)
{
global $adb;
$currencyid = $adb->query_result($result, $i, $column);
$curr = getCurrencySymbolandCRate($currencyid);
$value = "(" . $curr['symbol'] . ")";
return $value;
}
示例6: getSubGroupRow
//.........这里部分代码省略.........
$return_arr_sub = $this->getSubGroupRow($group2_value, $currency_id, $ngi, $g_con_sql);
$return_arr[$group_value][$group2_value]["sub_row"] = $return_arr_sub;
}
}
}
if (!empty($return_arr[$group_value])) {
$xls_r_i = 0;
foreach ($return_arr[$group_value] as $g1column_alias => $g1column_values) {
$sp_cname_i = 0;
foreach ($g1column_values as $column_alias => $column_values) {
if ($sp_cname_i == 0) {
$td_class = $agi_first_td_class;
} else {
$td_class = "rpt4youGrpHead";
}
if ($column_alias != "sub_row") {
$column_arr = explode("_", $column_alias);
$calculation_type = strtolower($column_arr[count($column_arr) - 1]);
$cl_c_alias_arr = array();
for ($cl_c_i = 0; $cl_c_i < count($column_arr) - 1; $cl_c_i++) {
$cl_c_alias_arr[] = $column_arr[$cl_c_i];
}
$cl_c_alias = implode("_", $cl_c_alias_arr);
if (is_array($column_values)) {
$column_values_f = "";
ksort($column_values);
$column_values_count = count($column_values);
$column_values_i = 0;
foreach ($column_values as $currency_id => $column_value) {
if ($column_value != "") {
//$txt_align = $this->getFldAlignment($column_alias, $column_value);
$fld_style_arr = $this->getFldStyle($column_alias, $column_value);
$fld_style = $this->getFldStyleString($fld_style_arr);
$rate_symbol = getCurrencySymbolandCRate($currency_id);
$fld_value = $this->getFldNumberFormat($column_alias, $column_value, $currency_id);
/* if (is_numeric($fld_value) && $calculation_type != "count" && $cl_c_alias != "quantity" && !in_array($column_alias, $this->g_flds)) {
$fld_value = CurrencyField::appendCurrencySymbol($fld_value, $rate_symbol['symbol']);
} */
$column_values_f .= $fld_value;
$column_values_i++;
if ($column_values_i < $column_values_count) {
$column_values_f .= "<br>";
}
}
}
if ($this->outputformat == "XLS") {
$return_html[$xls_r_i][] = $column_values_f;
} else {
$return_html .= "<td class='{$td_class}' style='background-color:{$bg_color};{$fld_style}' nowrap >" . $column_values_f . "</td>";
}
} else {
//$txt_align = $this->getFldAlignment($column_alias, $column_values);
$fld_style_arr = $this->getFldStyle($column_alias, $column_value);
$fld_style = $this->getFldStyleString($fld_style_arr);
if ($this->outputformat == "XLS") {
$return_html[$xls_r_i][] = $this->getFldNumberFormat($column_alias, $column_values, "");
} else {
$return_html .= "<td class='{$td_class}' style='background-color:{$bg_color};{$fld_style}' nowrap >" . $this->getFldNumberFormat($column_alias, $column_values, "") . "</td>";
}
}
// charts array population start
if ($column_alias == $this->charts["charts_ds_column"]) {
if (!isset($this->ch_array["dataseries_label"])) {
$this->setDataseriesLabel($column_alias);
}
$this->addToSubvalChArrayValues("dataseries", $group_value, $column_values, $this->getFldNumberFormat($this->group_cols_array[$ngi], $g1column_alias, "", true), $currency_id);
示例7: GenerateReport
//.........这里部分代码省略.........
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($adb, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if (!empty($fieldInfo)) {
$translatedLabel = getTranslatedString($field->getFieldLabelKey(), $module);
} else {
$translatedLabel = getTranslatedString(str_replace('_', " ", $fieldLabel), $module);
}
/*STRING TRANSLATION starts */
$moduleLabel = '';
if (in_array($module, $modules_selected)) {
$moduleLabel = getTranslatedString($module, $module);
}
if (empty($translatedLabel)) {
$translatedLabel = getTranslatedString(str_replace('_', " ", $fld->name));
}
$headerLabel = $translatedLabel;
if (!empty($this->secondarymodule)) {
if ($moduleLabel != '') {
$headerLabel = $moduleLabel . " " . $translatedLabel;
}
}
// Check for role based pick list
$temp_val = $fld->name;
if ($fieldType == 'currency') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
$cur_value = $custom_field_values[$i];
if ($field->getUIType() == '72') {
$curid_value = explode("::", $cur_value);
if (count($curid_value) == 2) {
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
} else {
$currency_value = $curid_value[0];
$cur_sym_rate['symbol'] = '';
}
$arraylists[$headerLabel] = number_format($currency_value, 2, '.', '');
$arraylists[getTranslatedString('LBL_CURRENCY') . ' ' . $headerLabel] = $cur_sym_rate['symbol'];
} else {
$currencyField = new CurrencyField($cur_value);
$fieldvalue = $currencyField->getDisplayValue();
$arraylists[$headerLabel] = number_format($fieldvalue, 2, '.', '');
}
} else {
$fieldvalue = getReportFieldValue($this, $picklistarray, $fld, $custom_field_values, $i);
$arraylists[$headerLabel] = $fieldvalue;
}
}
$arr_val[] = $arraylists;
set_time_limit($php_max_execution_time);
} while ($custom_field_values = $adb->fetch_array($result));
return $arr_val;
}
} elseif ($outputformat == "TOTALXLS") {
$escapedchars = array('_SUM', '_AVG', '_MIN', '_MAX');
$totalpdf = array();
$sSQL = $this->sGetSQLforReport($this->reportid, $filtersql, "COLUMNSTOTOTAL");
if (isset($this->totallist)) {
if ($sSQL != "") {
$result = $adb->query($sSQL);
$y = $adb->num_fields($result);
$custom_field_values = $adb->fetch_array($result);
foreach ($this->totallist as $key => $value) {
$fieldlist = explode(":", $key);
示例8: 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;
}
示例9: GenerateReport
//.........这里部分代码省略.........
$newvalue = $custom_field_values[0];
$snewvalue = $custom_field_values[1];
$tnewvalue = $custom_field_values[2];
}
if ($newvalue == "") {
$newvalue = "-";
}
if ($snewvalue == "") {
$snewvalue = "-";
}
if ($tnewvalue == "") {
$tnewvalue = "-";
}
$valtemplate .= "<tr>";
// Performance Optimization
if ($directOutput) {
echo $valtemplate;
$valtemplate = '';
}
// END
for ($i = 0; $i < $y; $i++) {
$fld = $adb->field_name($result, $i);
$fld_type = $column_definitions[$i]->type;
if (in_array($fld->name, $this->convert_currency)) {
if ($custom_field_values[$i] != '') {
$fieldvalue = convertFromMasterCurrency($custom_field_values[$i], $current_user->conv_rate);
} else {
$fieldvalue = getTranslatedString($custom_field_values[$i]);
}
} elseif (in_array($fld->name, $this->append_currency_symbol_to_value)) {
$curid_value = explode("::", $custom_field_values[$i]);
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
if ($custom_field_values[$i] != '') {
$fieldvalue = $cur_sym_rate['symbol'] . " " . $currency_value;
} else {
$fieldvalue = getTranslatedString($custom_field_values[$i]);
}
} elseif ($fld->name == "PurchaseOrder_Currency" || $fld->name == "SalesOrder_Currency" || $fld->name == "Invoice_Currency" || $fld->name == "Quotes_Currency") {
if ($custom_field_values[$i] != '') {
$fieldvalue = getCurrencyName($custom_field_values[$i]);
} else {
$fieldvalue = getTranslatedString($custom_field_values[$i]);
}
} elseif (in_array($fld->name, $this->ui10_fields) && !empty($custom_field_values[$i])) {
$type = getSalesEntityType($custom_field_values[$i]);
$tmp = getEntityName($type, $custom_field_values[$i]);
foreach ($tmp as $key => $val) {
$fieldvalue = $val;
break;
}
} else {
if ($custom_field_values[$i] != '') {
$fieldvalue = getTranslatedString($custom_field_values[$i]);
} else {
$fieldvalue = getTranslatedString($custom_field_values[$i]);
}
}
$fieldvalue = str_replace("<", "<", $fieldvalue);
$fieldvalue = str_replace(">", ">", $fieldvalue);
//check for Roll based pick list
$temp_val = $fld->name;
if (is_array($picklistarray)) {
if (array_key_exists($temp_val, $picklistarray)) {
if (!in_array($custom_field_values[$i], $picklistarray[$fld->name]) && $custom_field_values[$i] != '') {
示例10: Quotes
* defined return URL.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once 'modules/Quotes/Quotes.php';
require_once 'include/logging.php';
require_once 'include/database/PearDatabase.php';
include_once "modules/Emails/mail.php";
$local_log =& LoggerManager::getLogger('index');
$focus = new Quotes();
//added to fix 4600
$search = vtlib_purify($_REQUEST['search_url']);
setObjectValuesFromRequest($focus);
$focus->column_fields['currency_id'] = $_REQUEST['inventory_currency'];
$cur_sym_rate = getCurrencySymbolandCRate($_REQUEST['inventory_currency']);
$focus->column_fields['conversion_rate'] = $cur_sym_rate['rate'];
if ($_REQUEST['assigntype'] == 'U') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif ($_REQUEST['assigntype'] == 'T') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}
$focus->save("Quotes");
$return_id = $focus->id;
$parenttab = getParentTab();
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") {
$return_module = vtlib_purify($_REQUEST['return_module']);
} else {
$return_module = "Quotes";
}
if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") {
示例11: getListViewRecords
//.........这里部分代码省略.........
$timeField = 'time_end';
}
}
$timeFieldValue = $this->db->query_result($result, $i, $timeField);
if (!empty($timeFieldValue)) {
$value .= ' ' . $timeFieldValue;
//TO make sure it takes time value as well
$fieldDataType = 'datetime';
}
}
if ($fieldDataType == 'datetime') {
$value = Vtiger_Datetime_UIType::getDateTimeValue($value);
} else {
if ($fieldDataType == 'date') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
}
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'time') {
if (!empty($value)) {
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = CurrencyField::convertToUserFormat($value, null, true);
$row['currencySymbol'] = $currencySymbol;
$value = CurrencyField::appendCurrencySymbol($value, $currencySymbol);
} else {
if (!empty($value)) {
$value = CurrencyField::convertToUserFormat($value);
$currencyModal = new CurrencyField($value);
$currencyModal->initialize();
$value = $currencyModal->appendCurrencySymbol($value, $currencyModal->currencySymbol);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'email') {
$current_user = vglobal('current_user');
if ($current_user->internal_mailer == 1) {
//check added for email link in user detailview
$value = "<a class='emailField' onclick=\"Vtiger_Helper_Js.getInternalMailer({$recordId}," . "'{$fieldName}','{$module}');\">" . textlength_check($value) . "</a>";
} else {
$value = '<a class="emailField" href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
示例12: getDetailViewDisplayValue
/**
* Function that converts the Number into Users Currency along with currency symbol
* @param Users $user
* @param Boolean $skipConversion
* @return Formatted Currency
*/
public function getDetailViewDisplayValue($value, $recordId, $uiType)
{
$currencyModal = new CurrencyField($value);
$currencyModal->initialize();
if ($uiType == '72' && $recordId) {
$moduleName = $this->get('field')->getModuleName();
if ($this->get('field')->getName() == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $moduleName);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($moduleName, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
} else {
$currencySymbol = $currencyModal->currencySymbol;
}
return $currencyModal->appendCurrencySymbol($value, $currencySymbol);
}
示例13: initialize
/**
* Initializes the User's Currency Details
* @global Users $current_user
* @param Users $user
*/
public function initialize($user = null)
{
global $current_user, $default_charset;
if (empty($user)) {
$user = $current_user;
}
if (!empty($user->currency_grouping_pattern)) {
$this->currencyFormat = html_entity_decode($user->currency_grouping_pattern, ENT_QUOTES, $default_charset);
$this->currencySeparator = str_replace(" ", ' ', html_entity_decode($user->currency_grouping_separator, ENT_QUOTES, $default_charset));
$this->decimalSeparator = str_replace(" ", ' ', html_entity_decode($user->currency_decimal_separator, ENT_QUOTES, $default_charset));
}
if (!empty($user->currency_id)) {
$this->currencyId = $user->currency_id;
} else {
$this->currencyId = self::getDBCurrencyId();
}
$currencyRateAndSymbol = getCurrencySymbolandCRate($this->currencyId);
$this->currencySymbol = $currencyRateAndSymbol['symbol'];
$this->conversionRate = $currencyRateAndSymbol['rate'];
$this->currencySymbolPlacement = $user->currency_symbol_placement;
$this->numberOfDecimal = getCurrencyDecimalPlaces();
}
示例14: getPDFMakerFieldValue
public function getPDFMakerFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName)
{
global $current_user, $default_charset;
$db = PearDatabase::getInstance();
$value = $valueArray[$fieldName];
$fld_type = $dbField->type;
list($module, $fieldLabel) = explode('_', $dbField->name, 2);
$fieldInfo = $this->getFieldByPDFMakerLabel($module, $fieldLabel);
$fieldType = null;
$fieldvalue = $value;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($db, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency' && $value != '') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$curid_value = explode("::", $value);
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
if ($value != '') {
if ($dbField->name == 'Products_Unit_Price') {
// need to do this only for Products Unit Price
if ($currency_id != 1) {
$currency_value = (double) $cur_sym_rate['rate'] * (double) $currency_value;
}
}
$formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true);
$fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']);
}
} else {
$currencyField = new CurrencyField($value);
$fieldvalue = $currencyField->getDisplayValue();
}
} elseif ($dbField->name == "PurchaseOrder_Currency" || $dbField->name == "SalesOrder_Currency" || $dbField->name == "Invoice_Currency" || $dbField->name == "Quotes_Currency" || $dbField->name == "PriceBooks_Currency") {
if ($value != '') {
$fieldvalue = getTranslatedCurrencyString($value);
}
} elseif (in_array($dbField->name, $this->ui101_fields) && !empty($value)) {
$entityNames = getEntityName('Users', $value);
$fieldvalue = $entityNames[$value];
} elseif ($fieldType == 'date' && !empty($value)) {
if ($module == 'Calendar' && $field->getFieldName() == 'due_date') {
$endTime = $valueArray['calendar_end_time'];
if (empty($endTime)) {
$recordId = $valueArray['calendar_id'];
$endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId);
}
$date = new DateTimeField($value . ' ' . $endTime);
$fieldvalue = $date->getDisplayDate();
} else {
$fieldvalue = DateTimeField::convertToUserFormat($value);
}
} elseif ($fieldType == "datetime" && !empty($value)) {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayDateTimeValue();
} elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours') {
if ($field->getFieldName() == "time_start" || $field->getFieldName() == "time_end") {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayTime();
} else {
$fieldvalue = $value;
}
} elseif ($fieldType == "picklist" && !empty($value)) {
if (is_array($picklistArray)) {
if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) {
$fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$fieldvalue = $this->getTranslatedString($value, $module);
}
} else {
$fieldvalue = $this->getTranslatedString($value, $module);
}
} elseif ($fieldType == "multipicklist" && !empty($value)) {
if (is_array($picklistArray[1])) {
$valueList = explode(' |##| ', $value);
$translatedValueList = array();
foreach ($valueList as $value) {
if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) {
$translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$translatedValueList[] = $this->getTranslatedString($value, $module);
}
}
}
if (!is_array($picklistArray[1]) || !is_array($picklistArray[1][$dbField->name])) {
$fieldvalue = str_replace(' |##| ', ', ', $value);
} else {
implode(', ', $translatedValueList);
}
} elseif ($fieldType == 'double') {
if ($current_user->truncate_trailing_zeros == true) {
$fieldvalue = decimalFormat($fieldvalue);
}
}
if ($fieldvalue == "") {
return "-";
}
$fieldvalue = str_replace("<", "<", $fieldvalue);
//.........这里部分代码省略.........
示例15: importRecord
function importRecord($obj, $inventoryFieldData, $lineItems)
{
global $adb, $log;
$moduleName = $obj->module;
$inventoryHandler = vtws_getModuleHandlerFromName($moduleName, $obj->user);
$inventoryMeta = $inventoryHandler->getMeta();
$currency = '';
if (isset($inventoryFieldData['currency_id'])) {
$currency = $inventoryFieldData['currency_id'];
unset($inventoryFieldData['currency_id']);
}
$fieldData = $obj->transformForImport($inventoryFieldData, $inventoryMeta);
$fieldData['pdoInformation'] = $lineItems;
if (empty($fieldData) || empty($fieldData['pdoInformation'])) {
return null;
}
$wsrs = $adb->pquery('select id from vtiger_ws_entity where name=?', array('Currency'));
if ($wsrs and $adb->num_rows($wsrs) == 1) {
$wsid = $adb->query_result($wsrs, 0, 0);
} else {
$wsid = 0;
}
if ($currency == ' ' or empty($currency)) {
$currid = 1;
} else {
$currid = getCurrencyId($currency);
}
$cur_sym_rate = getCurrencySymbolandCRate($currid);
$fieldData['currency_id'] = $wsid . 'x' . $currid;
$fieldData['conversion_rate'] = $cur_sym_rate['rate'];
$entityInfo = vtws_create($moduleName, $fieldData, $obj->user);
$entityInfo['status'] = $obj->getImportRecordStatus('created');
return $entityInfo;
}