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


PHP fetchCurrency函数代码示例

本文整理汇总了PHP中fetchCurrency函数的典型用法代码示例。如果您正苦于以下问题:PHP fetchCurrency函数的具体用法?PHP fetchCurrency怎么用?PHP fetchCurrency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: 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;
    }
}
开发者ID:p6,项目名称:VF,代码行数:60,代码来源:ListViewTop.php

示例2: 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;
    }
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:60,代码来源:ListViewTop.php

示例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;
    }
}
开发者ID:hardikk,项目名称:HNH,代码行数:58,代码来源:ListViewTop.php

示例4: vtigerCRM_Smarty

 ************************************************************************************/
global $app_strings, $mod_strings, $current_language, $currentModule, $theme, $adb, $log, $current_user;
require_once 'Smarty_setup.php';
require_once 'data/Tracker.php';
require_once 'include/CustomFieldUtil.php';
require_once 'include/utils/utils.php';
$focus = CRMEntity::getInstance($currentModule);
$smarty = new vtigerCRM_Smarty();
$category = getParentTab($currentModule);
$record = vtlib_purify($_REQUEST['record']);
$isduplicate = vtlib_purify($_REQUEST['isDuplicate']);
//added to fix the issue4600
$searchurl = getBasic_Advance_SearchURL();
$smarty->assign("SEARCH", $searchurl);
//4600 ends
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
if (isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
    $focus->id = $record;
    $focus->mode = 'edit';
    $focus->retrieve_entity_info($record, 'PurchaseOrder');
    $focus->name = $focus->column_fields['subject'];
}
if ($isduplicate == 'true') {
    $smarty->assign('DUPLICATE_FROM', $focus->id);
    $PO_associated_prod = getAssociatedProducts($currentModule, $focus);
    $inventory_cur_info = getInventoryCurrencyInfo($currentModule, $focus->id);
    $currencyid = $inventory_cur_info['currency_id'];
    $focus->id = '';
    $focus->mode = '';
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:EditView.php

示例5: isset

$image_error = isset($_REQUEST['image_error']) ? vtlib_purify($_REQUEST['image_error']) : "false";
$smarty = new vtigerCRM_Smarty();
$category = getParentTab($currentModule);
$record = $_REQUEST['record'];
$isduplicate = vtlib_purify($_REQUEST['isDuplicate']);
//added to fix the issue4600
$searchurl = getBasic_Advance_SearchURL();
$smarty->assign("SEARCH", $searchurl);
//4600 ends
if ($record) {
    $focus->id = $record;
    $focus->mode = 'edit';
    $focus->retrieve_entity_info($record, $currentModule);
    $product_base_currency = getProductBaseCurrency($focus->id, $currentModule);
} else {
    $product_base_currency = fetchCurrency($current_user->id);
}
if ($image_error == "true") {
    $explode_decode_val = explode("&", $decode_val);
    for ($i = 1; $i < count($explode_decode_val); $i++) {
        $test = $explode_decode_val[$i];
        $values = explode("=", $test);
        $field_name_val = $values[0];
        $field_value = $values[1];
        $focus->column_fields[$field_name_val] = $field_value;
    }
}
if ($isduplicate == 'true') {
    $focus->id = '';
    $focus->mode = '';
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:31,代码来源:EditView.php

示例6: getBaseConversionRateForProduct

/**	Function used to get the conversion rate for the product base currency with respect to the CRM base currency
 *	@param int $productid - product id for which we want to get the conversion rate of the base currency
 *  @param string $mode - Mode in which the function is called
 *  @return number $conversion_rate - conversion rate of the base currency for the given product based on the CRM base currency
 */
function getBaseConversionRateForProduct($productid, $mode = 'edit', $module = 'Products')
{
    global $adb, $log, $current_user;
    if ($mode == 'edit') {
        if ($module == 'Services') {
            $sql = "select conversion_rate from vtiger_service inner join vtiger_currency_info\n\t\t\t\t\ton vtiger_service.currency_id = vtiger_currency_info.id where vtiger_service.serviceid=?";
        } else {
            $sql = "select conversion_rate from vtiger_products inner join vtiger_currency_info\n\t\t\t\t\ton vtiger_products.currency_id = vtiger_currency_info.id where vtiger_products.productid=?";
        }
        $params = array($productid);
    } else {
        $sql = "select conversion_rate from vtiger_currency_info where id=?";
        $params = array(fetchCurrency($current_user->id));
    }
    $res = $adb->pquery($sql, $params);
    $conv_rate = $adb->query_result($res, 0, 'conversion_rate');
    return 1 / $conv_rate;
}
开发者ID:jaimeaga84,项目名称:corebos,代码行数:23,代码来源:InventoryUtils.php

示例7: insertPriceInformation

 /**	function to save the service price information in vtiger_servicecurrencyrel table
  *	@param string $tablename - vtiger_tablename to save the service currency relationship (servicecurrencyrel)
  *	@param string $module	 - current module name
  *	$return void
  */
 function insertPriceInformation($tablename, $module)
 {
     $adb = PearDatabase::getInstance();
     $current_user = vglobal('current_user');
     $log = vglobal('log');
     $log->debug("Entering into insertPriceInformation({$tablename}, {$module}) method ...");
     //removed the update of currency_id based on the logged in user's preference : fix 6490
     $currency_details = getAllCurrencies('all');
     //Delete the existing currency relationship if any
     if ($this->mode == 'edit' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') {
         for ($i = 0; $i < count($currency_details); $i++) {
             $curid = $currency_details[$i]['curid'];
             $sql = "delete from vtiger_productcurrencyrel where productid=? and currencyid=?";
             $adb->pquery($sql, array($this->id, $curid));
         }
     }
     $service_base_conv_rate = getBaseConversionRateForProduct($this->id, $this->mode, $module);
     //Save the Product - Currency relationship if corresponding currency check box is enabled
     for ($i = 0; $i < count($currency_details); $i++) {
         $curid = $currency_details[$i]['curid'];
         $curname = $currency_details[$i]['currencylabel'];
         $cur_checkname = 'cur_' . $curid . '_check';
         $cur_valuename = 'curname' . $curid;
         $base_currency_check = 'base_currency' . $curid;
         $requestPrice = CurrencyField::convertToDBFormat($_REQUEST['unit_price'], null, true);
         $actualPrice = CurrencyField::convertToDBFormat($_REQUEST[$cur_valuename], null, true);
         if ($_REQUEST[$cur_checkname] == 'on' || $_REQUEST[$cur_checkname] == 1) {
             $conversion_rate = $currency_details[$i]['conversionrate'];
             $actual_conversion_rate = $service_base_conv_rate * $conversion_rate;
             $converted_price = $actual_conversion_rate * $requestPrice;
             $log->debug("Going to save the Product - {$curname} currency relationship");
             $query = "insert into vtiger_productcurrencyrel values(?,?,?,?)";
             $adb->pquery($query, array($this->id, $curid, $converted_price, $actualPrice));
             // Update the Product information with Base Currency choosen by the User.
             if ($_REQUEST['base_currency'] == $cur_valuename) {
                 $adb->pquery("update vtiger_service set currency_id=?, unit_price=? where serviceid=?", array($curid, $actualPrice, $this->id));
             }
         } else {
             $curid = fetchCurrency($current_user->id);
             $adb->pquery("update vtiger_service set currency_id=? where serviceid=?", array($curid, $this->id));
         }
     }
     $log->debug("Exiting from insertPriceInformation({$tablename}, {$module}) method ...");
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:49,代码来源:Services.php

示例8: getParentTab

$category = getParentTab();
$action = vtlib_purify($_REQUEST['action']);
$record = vtlib_purify($_REQUEST['record']);
$isduplicate = vtlib_purify($_REQUEST['isDuplicate']);
if ($singlepane_view == 'true' && $action == 'CallRelatedList') {
    echo "<script>document.location='index.php?action=DetailView&module={$currentModule}&record={$record}&parenttab={$category}';</script>";
    die;
} else {
    $tool_buttons = Button_Check($currentModule);
    $focus = CRMEntity::getInstance($currentModule);
    if ($record != '') {
        $focus->retrieve_entity_info($record, $currentModule);
        $focus->id = $record;
        $service_base_currency = getProductBaseCurrency($focus->id, $currentModule);
    } else {
        $service_base_currency = fetchCurrency($current_user->id);
    }
    $smarty = new vtigerCRM_Smarty();
    if ($isduplicate == 'true') {
        $focus->id = '';
    }
    if (isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') {
        $smarty->assign("OP_MODE", vtlib_purify($_REQUEST['mode']));
    }
    if (!$_SESSION['rlvs'][$currentModule]) {
        unset($_SESSION['rlvs']);
    }
    // Identify this module as custom module.
    $smarty->assign('CUSTOM_MODULE', $focus->IsCustomModule);
    $smarty->assign('APP', $app_strings);
    $smarty->assign('MOD', $mod_strings);
开发者ID:kduqi,项目名称:corebos,代码行数:31,代码来源:CallRelatedList.php

示例9: getConvertedPriceFromDollar

/**	Function used to get the converted amount from dollar which will be showed to the user
 *	@param float $price - amount in dollor which we want to convert to the user configured amount
 *	@return float $conv_price  - amount in user configured currency
 */
function getConvertedPriceFromDollar($price)
{
    global $current_user;
    $currencyid = fetchCurrency($current_user->id);
    $rate_symbol = getCurrencySymbolandCRate($currencyid);
    $conv_price = convertFromDollar($price, $rate_symbol['rate']);
    return $conv_price;
}
开发者ID:p6,项目名称:VF,代码行数:12,代码来源:CommonUtils.php

示例10: save_module

 function save_module($module)
 {
     global $current_user, $log, $adb;
     $cypid = $this->id;
     $data = $this->column_fields;
     // Entity has been saved, take next action
     $currencyid = fetchCurrency($current_user->id);
     $rate_symbol = getCurrencySymbolandCRate($currencyid);
     $rate = $rate_symbol['rate'];
     $value = 0;
     if (isset($data['amount']) and isset($data['cost'])) {
         $value = convertToDollar($data['amount'] - $data['cost'], $rate);
     }
     $adb->query("update vtiger_cobropago set benefit='{$value}' where cobropagoid=" . $cypid);
     $relatedId = $this->column_fields['related_id'];
     if (!empty($relatedId) and self::invoice_control_installed()) {
         Invoice::updateAmountDue($relatedId);
     }
     // Calculate related module balance
     $this->calculateRelatedTotals($this->column_fields['parent_id']);
 }
开发者ID:jaimeaga84,项目名称:corebos,代码行数:21,代码来源:CobroPago.php

示例11: getBaseConversionRateForProduct

    function getBaseConversionRateForProduct($productid, $mode = 'edit', $module = 'Products')
    {
        $adb = PearDatabase::getInstance();
        $current_user = vglobal('current_user');
        if ($mode == 'edit') {
            if ($module == 'Services') {
                $sql = 'select conversion_rate from vtiger_service inner join vtiger_currency_info
					on vtiger_service.currency_id = vtiger_currency_info.id where vtiger_service.serviceid=?';
            } else {
                $sql = 'select conversion_rate from vtiger_products inner join vtiger_currency_info
					on vtiger_products.currency_id = vtiger_currency_info.id where vtiger_products.productid=?';
            }
            $params = array($productid);
        } else {
            $sql = 'select conversion_rate from vtiger_currency_info where id=?';
            $params = array(fetchCurrency($current_user->id));
        }
        $res = $adb->pquery($sql, $params);
        $conv_rate = $adb->query_result($res, 0, 'conversion_rate');
        return 1 / $conv_rate;
    }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:21,代码来源:Record.php

示例12: getOutputHtml


//.........这里部分代码省略.........
                $editview_label[] = array('Contacts' => $contact_selected, 'Accounts' => $account_selected, 'Vendors' => $vendor_selected, 'Leads' => $lead_selected, 'Users' => $user_selected);
                $fieldvalue[] = $parent_name;
                $fieldvalue[] = $parent_id;
            }
        } elseif ($uitype == 68) {
            if (isset($_REQUEST['parent_id']) && $_REQUEST['parent_id'] != '') {
                $value = $_REQUEST['parent_id'];
            }
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
                if ($parent_module == "Contacts") {
                    $parent_name = getContactName($value);
                    $contact_selected = "selected";
                } elseif ($parent_module == "Accounts") {
                    $sql = "select * from  vtiger_account where accountid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "accountname");
                    $account_selected = "selected";
                } else {
                    $parent_name = "";
                    $value = "";
                }
            }
            $editview_label[] = array($app_strings['COMBO_CONTACTS'], $app_strings['COMBO_ACCOUNTS']);
            $editview_label[] = array($contact_selected, $account_selected);
            $editview_label[] = array("Contacts", "Accounts");
            $fieldvalue[] = $parent_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 71 || $uitype == 72) {
            if ($col_fields['record_id'] != '' && $fieldname == 'unit_price') {
                $rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module_name));
                $fieldvalue[] = $value;
            } else {
                $currency_id = fetchCurrency($current_user->id);
                $rate_symbol = getCurrencySymbolandCRate($currency_id);
                $rate = $rate_symbol['rate'];
                $fieldvalue[] = convertFromDollar($value, $rate);
            }
            $currency = $rate_symbol['symbol'];
            $editview_label[] = getTranslatedString($fieldlabel, $module_name) . ': (' . $currency . ')';
        } 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';
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $vendor_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 76) {
            if ($value != '') {
                $potential_name = getPotentialName($value);
            } elseif (isset($_REQUEST['potential_id']) && $_REQUEST['potential_id'] != '') {
                $value = $_REQUEST['potental_id'];
                $potential_name = getPotentialName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $potential_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 78) {
            if ($value != '') {
开发者ID:joomlacorner,项目名称:vtigerthai,代码行数:67,代码来源:EditViewUtils.php

示例13: 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_potential.potentialname,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) " . "inner join vtiger_account on (vtiger_potential.related_to=vtiger_account.accountid) ";
    $list_query .= " WHERE vtiger_crmentity.deleted = 0 " . $where . " AND vtiger_potential.potentialid>0";
    $list_query .= " 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'] . "')";
    $list_query .= " group by vtiger_account.accountid, 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 . ')';
    $header[] = $current_module_strings['LBL_POTENTIAL_TITLE'];
    $entries = array();
    foreach ($open_accounts_list as $account) {
        $value = array();
        $account_fields = array('ACCOUNT_ID' => $account['accountid'], 'ACCOUNT_NAME' => $account['accountname'], 'AMOUNT' => $account['amount']);
        // JFV - fix wrongly truncationed utf8 string
        if (function_exists("mb_strimwidth")) {
            $Top_Accounts = mb_strimwidth($account['accountname'], 0, 30, '...', "UTF-8");
        } else {
            // JFV END
            $Top_Accounts = strlen($account['accountname']) > 20 ? substr($account['accountname'], 0, 20) . '...' : $account['accountname'];
            // JFV
        }
        // JFV END
        $value[] = '<a href="index.php?action=DetailView&module=Accounts&record=' . $account['accountid'] . '">' . $Top_Accounts . '</a>';
        $value[] = CurrencyField::convertToUserFormat($account['amount']);
        $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;
    }
}
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:67,代码来源:ListViewTop.php

示例14: insertPriceInformation

 /**	function to save the service price information in vtiger_servicecurrencyrel table
  *	@param string $tablename - vtiger_tablename to save the service currency relationship (servicecurrencyrel)
  *	@param string $module	 - current module name
  *	$return void
  */
 function insertPriceInformation($tablename, $module)
 {
     global $adb, $log, $current_user;
     $log->debug("Entering into insertPriceInformation({$tablename}, {$module}) method ...");
     // Update the currency_id based on the logged in user's preference
     $currencyid = fetchCurrency($current_user->id);
     $adb->pquery("update vtiger_service set currency_id=? where serviceid=?", array($currencyid, $this->id));
     $currency_details = getAllCurrencies('all');
     //Delete the existing currency relationship if any
     if ($this->mode == 'edit') {
         for ($i = 0; $i < count($currency_details); $i++) {
             $curid = $currency_details[$i]['curid'];
             $sql = "delete from vtiger_productcurrencyrel where productid=? and currencyid=?";
             $adb->pquery($sql, array($this->id, $curid));
         }
     }
     $service_base_conv_rate = getBaseConversionRateForProduct($this->id, $this->mode, $module);
     //Save the Product - Currency relationship if corresponding currency check box is enabled
     for ($i = 0; $i < count($currency_details); $i++) {
         $curid = $currency_details[$i]['curid'];
         $curname = $currency_details[$i]['currencylabel'];
         $cur_checkname = 'cur_' . $curid . '_check';
         $cur_valuename = 'curname' . $curid;
         $base_currency_check = 'base_currency' . $curid;
         if ($_REQUEST[$cur_checkname] == 'on' || $_REQUEST[$cur_checkname] == 1) {
             $conversion_rate = $currency_details[$i]['conversionrate'];
             $actual_conversion_rate = $service_base_conv_rate * $conversion_rate;
             $converted_price = $actual_conversion_rate * $_REQUEST['unit_price'];
             $actual_price = $_REQUEST[$cur_valuename];
             $log->debug("Going to save the Product - {$curname} currency relationship");
             $query = "insert into vtiger_productcurrencyrel values(?,?,?,?)";
             $adb->pquery($query, array($this->id, $curid, $converted_price, $actual_price));
             // Update the Product information with Base Currency choosen by the User.
             if ($_REQUEST['base_currency'] == $cur_valuename) {
                 $adb->pquery("update vtiger_service set currency_id=?, unit_price=? where serviceid=?", array($curid, $actual_price, $this->id));
             }
         }
     }
     $log->debug("Exiting from insertPriceInformation({$tablename}, {$module}) method ...");
 }
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:45,代码来源:Services.php

示例15: getBaseCurrencyDetails

 /**
  * Function to get base currency details
  * @return <Array>
  */
 public function getBaseCurrencyDetails()
 {
     $baseCurrencyDetails = $this->get('baseCurrencyDetails');
     if (!empty($baseCurrencyDetails)) {
         return $baseCurrencyDetails;
     }
     $recordId = $this->getId();
     if (!empty($recordId)) {
         $baseCurrency = getProductBaseCurrency($recordId, $this->getModuleName());
     } else {
         $currentUserModel = Users_Record_Model::getCurrentUserModel();
         $baseCurrency = fetchCurrency($currentUserModel->getId());
     }
     $baseCurrencyDetails = array('currencyid' => $baseCurrency);
     $baseCurrencySymbolDetails = getCurrencySymbolandCRate($baseCurrency);
     $baseCurrencyDetails = array_merge($baseCurrencyDetails, $baseCurrencySymbolDetails);
     $this->set('baseCurrencyDetails', $baseCurrencyDetails);
     return $baseCurrencyDetails;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:23,代码来源:Record.php


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