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


PHP Vtiger_Functions::getCurrencySymbolandRate方法代码示例

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


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

示例1: showTaxes

 function showTaxes(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $record = $request->get('record');
     $recordModule = $request->get('recordModule');
     $currency = $request->get('currency');
     $sourceRecord = $request->get('sourceRecord');
     $taxType = $request->get('taxType');
     $totalPrice = $request->get('totalPrice');
     $inventoryModel = Vtiger_Inventory_Model::getInstance($moduleName);
     $accountTaxs = $inventoryModel->getAccountTax($moduleName, $sourceRecord);
     $config = $inventoryModel->getTaxesConfig();
     $viewer = $this->getViewer($request);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('RECORD', $record);
     $viewer->assign('RECORD_MODULE', $recordModule);
     $viewer->assign('GLOBAL_TAXS', $inventoryModel->getGlobalTaxs());
     $viewer->assign('CURRENCY_SYMBOL', Vtiger_Functions::getCurrencySymbolandRate($currency)['symbol']);
     $viewer->assign('TOTAL_PRICE', $totalPrice);
     $viewer->assign('CONFIG', $config);
     $viewer->assign('TAX_TYPE', $taxType);
     $viewer->assign('TAX_FIELD', Vtiger_InventoryField_Model::getTaxField($recordModule));
     $viewer->assign('AGGREGATION_TYPE', $config['aggregation']);
     $viewer->assign('AGGREGATION_INPUT_TYPE', $config['aggregation'] == 0 ? 'radio' : 'checkbox');
     $viewer->assign('GROUP_TAXS', $accountTaxs['taxs']);
     $viewer->assign('ACCOUNT_NAME', $accountTaxs['name']);
     echo $viewer->view('InventoryTaxes.tpl', $moduleName, true);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:28,代码来源:Inventory.php

示例2: process

    public function process($module, $id, Vtiger_PDF_Model $pdf)
    {
        $html = '';
        $recordId = $id;
        $record = Vtiger_Record_Model::getInstanceById($recordId);
        $moduleModel = $record->getModule();
        if (!$moduleModel->isInventory()) {
            return $html;
        }
        $inventoryField = Vtiger_InventoryField_Model::getInstance($module);
        $fields = $inventoryField->getFields(true);
        if ($fields[0] != 0) {
            $columns = $inventoryField->getColumns();
            $inventoryRows = $record->getInventoryData();
            $mainParams = $inventoryField->getMainParams($fields[1]);
            $countFields0 = count($fields[0]);
            $countFields1 = count($fields[1]);
            $countFields2 = count($fields[2]);
            $baseCurrency = Vtiger_Util_Helper::getBaseCurrency();
        }
        if (in_array("currency", $columns)) {
            if (count($inventoryRows) > 0 && $inventoryRows[0]['currency'] != NULL) {
                $currency = $inventoryRows[0]['currency'];
            } else {
                $currency = $baseCurrency['id'];
            }
            $currencySymbolRate = Vtiger_Functions::getCurrencySymbolandRate($currency);
        }
        $html .= '<style>' . '.productTable{color:#000; font-size:10px}' . '.productTable th {text-transform: uppercase;font-weight:normal}' . '.productTable tbody tr:nth-child(odd){background:#eee}' . '.productTable tbody tr td{border-bottom: 1px solid #ddd; padding:5px}' . '.colapseBorder {border-collapse: collapse;}' . '.productTable td, th {padding-left: 5px; padding-right: 5px;}' . '.productTable .summaryContainer{background:#ccc;}' . '</style>';
        if (count($fields[0]) != 0) {
            $discount = 0;
            foreach ($inventoryRows as $key => &$inventoryRow) {
                $taxes = $inventoryField->getTaxParam($inventoryRow['taxparam'], $inventoryRow['net'], $taxes);
            }
            if (in_array('discount', $columns) && in_array('discountmode', $columns)) {
                $html .= '<table class="productTable colapseBorder">
							<thead>
								<tr>
									<th class="tBorder noBottomBorder tHeader">
										<strong>' . vtranslate('LBL_DISCOUNTS_SUMMARY', $module) . '</strong>
									</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td class="textAlignRight tBorder">' . CurrencyField::convertToUserFormat($discount, null, true) . ' ' . $currencySymbolRate['symbol'] . '</td>
								</tr>
							</tbody>
						</table>';
            }
        }
        return $html;
    }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:53,代码来源:TableDiscountSummary.php

示例3: checkLimits

	public function checkLimits(Vtiger_Request $request)
	{
		$moduleName = $request->getModule();
		$record = $request->get('record');
		$currency = $request->get('currency');
		$price = $request->get('price');
		$limitConfig = $request->get('limitConfig');
		$limitFieldName = 'creditlimit';
		$balanceFieldName = 'inventorybalance';

		$moduleInstance = Vtiger_Module_Model::getInstance('Accounts');
		$limitField = Vtiger_Field_Model::getInstance($limitFieldName, $moduleInstance);
		$balanceField = Vtiger_Field_Model::getInstance($balanceFieldName, $moduleInstance);
		if (!$limitField->isActiveField() || !$balanceField->isActiveField()) {
			$response = new Vtiger_Response();
			$response->setResult(['status' => true]);
			$response->emit();
			return;
		}
		$recordModel = Vtiger_Record_Model::getInstanceById($record, 'Accounts');
		$limitID = $recordModel->get($limitFieldName);
		$balance = $recordModel->get($balanceFieldName);
		$limit = reset(Vtiger_InventoryLimit_UIType::getValues($limitID))['value'];

		$baseCurrency = Vtiger_Util_Helper::getBaseCurrency();
		$symbol = $baseCurrency['currency_symbol'];
		if ($baseCurrency['id'] != $currency) {
			$selectedCurrency = Vtiger_Functions::getCurrencySymbolandRate($currency);
			$price = floatval($price) * $selectedCurrency['rate'];
			$symbol = $selectedCurrency['symbol'];
		}
		$totalPrice = $price + $balance;

		$status = $totalPrice > $limit ? false : true;
		if (!$status) {
			$viewer = new Vtiger_Viewer();
			$viewer->assign('PRICE', $price);
			$viewer->assign('BALANCE', $balance);
			$viewer->assign('SYMBOL', $symbol);
			$viewer->assign('LIMIT', $limit);
			$viewer->assign('TOTALS', $totalPrice);
			$viewer->assign('LIMIT_CONFIG', $limitConfig);
			$html = $viewer->view('InventoryLimitAlert.tpl', $moduleName, true);
		}
		$response = new Vtiger_Response();
		$response->setResult([
			'status' => $status,
			'html' => $html
		]);
		$response->emit();
	}
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:51,代码来源:Inventory.php

示例4: process

    public function process($module, $id, Vtiger_PDF_Model $pdf)
    {
        $html = '';
        $recordId = $id;
        $record = Vtiger_Record_Model::getInstanceById($recordId);
        $moduleModel = $record->getModule();
        if (!$moduleModel->isInventory()) {
            return $html;
        }
        $inventoryField = Vtiger_InventoryField_Model::getInstance($module);
        $fields = $inventoryField->getFields(true);
        if ($fields[0] != 0) {
            $columns = $inventoryField->getColumns();
            $inventoryRows = $record->getInventoryData();
            $mainParams = $inventoryField->getMainParams($fields[1]);
            $countFields0 = count($fields[0]);
            $countFields1 = count($fields[1]);
            $countFields2 = count($fields[2]);
            $baseCurrency = Vtiger_Util_Helper::getBaseCurrency();
        }
        if (in_array("currency", $columns)) {
            if (count($inventoryRows) > 0 && $inventoryRows[0]['currency'] != NULL) {
                $currency = $inventoryRows[0]['currency'];
            } else {
                $currency = $baseCurrency['id'];
            }
            $currencySymbolRate = Vtiger_Functions::getCurrencySymbolandRate($currency);
        }
        $html .= '<style>' . '.colapseBorder {border-collapse: collapse;}' . '.tBorder {border: 1px solid grey;}' . '.tHeader {background-color: lightgrey;}' . '.summaryBorder {border-left: 1px solid grey; border-bottom: 1px solid grey; border-right: 1px solid grey;}' . '.pTable td, th {padding-left: 5px; padding-right: 5px;}' . '.noBottomBorder {border-bottom: none;}' . '.noBorder {border: none !important;}' . '</style>';
        if (count($fields[0]) != 0) {
            $html .= '<table class="pTable colapseBorder">
				<thead>
					<tr>
						<th style="width: 65%;"></th>';
            foreach ($fields[0] as $field) {
                $html .= '<th colspan="' . $field->get('colspan') . '" class="tBorder noBottomBorder tHeader">
								<span>' . vtranslate($field->get('label'), $module) . ':</span>&nbsp;';
                switch ($field->getTemplateName('DetailView', $module)) {
                    case 'DetailViewBase.tpl':
                        $html .= $field->getDisplayValue($inventoryRows[0][$field->get('columnname')]);
                        break;
                    case 'DetailViewTaxMode.tpl':
                    case 'DetailViewDiscountMode.tpl':
                        $html .= vtranslate($field->getDisplayValue($inventoryRows[0][$field->get('columnname')]), $MODULE);
                        break;
                }
                $html .= '</th>';
            }
            $html .= '</tr>
				</thead>
			</table>';
            $fieldsTextAlignRight = ['TotalPrice', 'Tax', 'MarginP', 'Margin', 'Purchase', 'Discount', 'NetPrice', 'GrossPrice', 'UnitPrice', 'Quantity'];
            $html .= '<table class="pTable colapseBorder">
				<thead>
					<tr>';
            foreach ($fields[1] as $field) {
                if ($field->isVisible($inventoryRows)) {
                    $html .= '<th colspan="' . $field->get('colspan') . '" class="textAlignCenter tBorder tHeader">' . vtranslate($field->get('label'), $module) . '</th>';
                }
            }
            $html .= '</tr>
				</thead>
				<tbody>';
            //			for($i=0; $i<100; $i++) {
            foreach ($inventoryRows as $key => &$inventoryRow) {
                $rowNo = $key + 1;
                $html .= '<tr>';
                foreach ($fields[1] as $field) {
                    if ($field->isVisible($inventoryRows)) {
                        $itemValue = $inventoryRow[$field->get('columnname')];
                        $html .= '<td ' . ($field->getName() == 'Name' ? 'width="40%;" ' : '') . ' class="' . (in_array($field->getName(), $fieldsTextAlignRight) ? 'textAlignRight ' : '') . 'tBorder">';
                        switch ($field->getTemplateName('DetailView', $module)) {
                            case 'DetailViewName.tpl':
                                $html .= '<strong>' . $field->getDisplayValue($itemValue) . '</strong>';
                                if (isset($fields[2]['comment' . $rowNo])) {
                                    $COMMENT_FIELD = $fields[2]['comment' . $rowNo];
                                    $html .= '<br/>' . $COMMENT_FIELD->getDisplayValue($inventoryRow[$COMMENT_FIELD->get('columnname')]);
                                }
                                break;
                            case 'DetailViewBase.tpl':
                                $html .= $field->getDisplayValue($itemValue);
                                break;
                        }
                        $html .= '</td>';
                    }
                }
                $html .= '</tr>';
            }
            //			}
            $html .= '</tbody>
					<tfoot>
						<tr>';
            foreach ($fields[1] as $field) {
                if ($field->isVisible($inventoryRows)) {
                    $html .= '<td colspan="' . $field->get('colspan') . '" class="textAlignRight ';
                    if ($field->isSummary()) {
                        $html .= 'summaryBorder';
                    }
                    $html .= '">';
                    if ($field->isSummary()) {
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:ProductsTable.php

示例5: getCurrencySymbolandCRate

/** This function returns the conversion rate and vtiger_currency symbol
 * in array format for a given id.
 * param $id - vtiger_currency id.
 */
function getCurrencySymbolandCRate($id)
{
    return Vtiger_Functions::getCurrencySymbolandRate($id);
}
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:8,代码来源:CommonUtils.php


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