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


PHP CurrencyField类代码示例

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


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

示例1: amount_in_words

function amount_in_words($module, $id, $templateid, $content, $tcpdf)
{
    $db = PearDatabase::getInstance();
    $current_language = Users_Record_Model::getCurrentUserModel()->get('language');
    if (!file_exists("languages/" . $current_language . "/OSSPdf.php")) {
        $current_language = "en_us";
    }
    $mod = $module;
    $module = strtolower($module);
    if ($module == 'quotes') {
        $idcol = "quoteid";
    } else {
        $idcol = $module . "id";
    }
    $sql = "SELECT total FROM vtiger_{$module} WHERE {$idcol} = " . $id;
    $result = $db->query($sql, true);
    $grand_total = $db->query_result($result, 0, 'total');
    $currfield = new CurrencyField($grand_total);
    $grand_total = $currfield->getDBInsertedValue($grand_total);
    require_once 'include/utils/utils.php';
    require_once 'include/utils/CommonUtils.php';
    require_once 'modules/' . $mod . '/' . $mod . '.php';
    $focus = new $mod();
    $focus->retrieve_entity_info($id, $mod);
    $currency_id = $focus->column_fields['currency_id'];
    $pobierz = $db->query("select currency_symbol, currency_code from vtiger_currency_info where id = '{$currency_id}'", true);
    $kod_aktualnej_waluty = $db->query_result($pobierz, 0, "currency_code");
    $recordModel = Vtiger_Record_Model::getCleanInstance('OSSPdf');
    $kwota = $recordModel->slownie($grand_total, $kod_aktualnej_waluty);
    return $kwota;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:31,代码来源:amount_in_words.php

示例2: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('PageBuilder');
     /* =========================================
        * Images
        =========================================*/
     $fields->addFieldToTab('Root.Main', new UploadField('Image'), 'Content');
     /* =========================================
        * Menu Item Details
        =========================================*/
     $fields->addFieldToTab('Root.Main', $price = new CurrencyField('Price'), 'Content');
     $price->setRightTitle('To add extra price options e.g Small, Large please add a variation under the "Variations" tab above');
     $fields->addFieldToTab('Root.Main', $ingredients = new HtmlEditorField('Ingredients'), 'Metadata');
     $ingredients->setRows(15);
     /* =========================================
        * Variations
        =========================================*/
     $config = GridFieldConfig_RelationEditor::create(10);
     $config->addComponent(new GridFieldSortableRows('SortOrder'))->addComponent(new GridFieldDeleteAction());
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title', 'Price' => 'Price'));
     $gridField = new GridField('Variations', 'Variations', $this->owner->MenuVariations(), $config);
     $fields->addFieldToTab('Root.Variations', $gridField);
     return $fields;
 }
开发者ID:ormandroid,项目名称:ss_boilerplate,代码行数:25,代码来源:MenuItem.php

示例3: Form

 public function Form()
 {
     $form = parent::Form();
     if ($this->VariableAmount) {
         $form->setSaveableFields(array("UnitPrice"));
         $form->Fields()->push($giftamount = new CurrencyField("UnitPrice", "Amount", $this->BasePrice));
         $giftamount->setForm($form);
     }
     $form->setValidator($validator = new GiftVoucherFormValidator(array("Quantity", "UnitPrice")));
     return $form;
 }
开发者ID:burnbright,项目名称:silverstripe-shop-discount,代码行数:11,代码来源:GiftVoucherProduct.php

示例4: getCMSFields

 public function getCMSFields($params = null)
 {
     //fields that shouldn't be changed once coupon is used
     $fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints")))));
     if (!$this->isInDB()) {
         $fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints");
     }
     $this->extend("updateCMSFields", $fields, $params);
     if ($count = $this->getUseCount()) {
         $fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), HeaderField::create("TotalSavings", sprintf("A total of %s has been saved by customers using this discount.", $this->SavingsTotal), "3"), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton"))));
     }
     if ($params && isset($params['forcetype'])) {
         $valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield;
         $fields->insertAfter($valuefield, "Type");
         $fields->removeByName("Type");
     } elseif ($this->Type && (double) $this->{$this->Type}) {
         $valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
         $fields->removeByName("Type");
         $fields->insertAfter($valuefield, "ActionTitle");
         $fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
         if ($this->Type == "Percent") {
             $fields->insertAfter($maxamountfield, "Percent");
         }
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:26,代码来源:Discount.php

示例5: 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

示例6: getCreateViewUrl

 public function getCreateViewUrl()
 {
     $createViewUrl = parent::getCreateViewUrl();
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $parentRecordModel = $this->getParentRecordModel();
     $currencyValue = $parentRecordModel->get('hdnGrandTotal');
     $parentRecordModelCurrencyId = $parentRecordModel->get('currency_id');
     if ($parentRecordModelCurrencyId == $currentUserModel->get('currency_id')) {
         $amount = CurrencyField::convertToUserFormat($currencyValue, null, true);
     } else {
         $baseCurrencyId = CurrencyField::getDBCurrencyId();
         $allCurrencies = getAllCurrencies();
         foreach ($allCurrencies as $currencyInfo) {
             if ($parentRecordModelCurrencyId == $currencyInfo['currency_id']) {
                 $currencyValue = CurrencyField::convertToDollar($currencyValue, $currencyInfo['conversionrate']);
             }
         }
         foreach ($allCurrencies as $currencyInfo) {
             if ($baseCurrencyId == $currencyInfo['currency_id']) {
                 $currencyValue = CurrencyField::convertFromMasterCurrency($currencyValue, $currencyInfo['conversionrate']);
             }
         }
         $amount = CurrencyField::convertToUserFormat($currencyValue);
     }
     return $createViewUrl . '&relatedcontact=' . $parentRecordModel->get('contact_id') . '&relatedorganization=' . $parentRecordModel->get('account_id') . '&amount=' . $amount;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:26,代码来源:RelationListView.php

示例7: 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']);
        $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[] = 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:casati-dolibarr,项目名称:corebos,代码行数:59,代码来源:ListViewTop.php

示例8: TypoForm

 function TypoForm()
 {
     $array = array('green', 'yellow', 'blue', 'pink', 'orange');
     $form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
     $textAreaField->setColumns(45);
     $form->setMessage('warning message', 'warning');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-typography,代码行数:8,代码来源:Typography.php

示例9: getCMSFields

 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Title'), TextareaField::create('Description'), CurrencyField::create('PricePerNight', 'Price (per night)'), DropdownField::create('Bedrooms')->setSource(ArrayLib::valuekey(range(1, 10))), DropdownField::create('Bathrooms')->setSource(ArrayLib::valuekey(range(1, 10))), DropdownField::create('RegionID', 'Region')->setSource(Region::get()->map('ID', 'Title'))->setEmptyString('-- Select a region --'), CheckboxField::create('FeaturedOnHomepage', 'Feature on homepage')));
     $fields->addFieldToTab('Root.Photos', $upload = UploadField::create('PrimaryPhoto', 'Primary photo'));
     $upload->getValidator()->setAllowedExtensions(array('png', 'jpeg', 'jpg', 'gif'));
     $upload->setFolderName('property-photos');
     return $fields;
 }
开发者ID:sachithranuwan,项目名称:one-ring-rentals,代码行数:9,代码来源:Property.php

示例10: 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

示例11: testDataValue

 function testDataValue()
 {
     $f = new CurrencyField('TestField');
     $f->setValue('$123.45');
     $this->assertEquals($f->dataValue(), 123.45);
     $f->setValue('-$123.45');
     $this->assertEquals($f->dataValue(), -123.45);
     $f->setValue('$-123.45');
     $this->assertEquals($f->dataValue(), -123.45);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:10,代码来源:CurrencyFieldTest.php

示例12: addListPrice

 /**
  * Function adds Products/Services-PriceBooks Relation
  * @param type $request
  */
 function addListPrice($request)
 {
     $sourceModule = $request->getModule();
     $sourceRecordId = $request->get('src_record');
     $relatedModule = $request->get('related_module');
     $relInfos = $request->get('relinfo');
     $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);
     $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);
     $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel);
     foreach ($relInfos as $relInfo) {
         $price = CurrencyField::convertToDBFormat($relInfo['price'], null, true);
         $relationModel->addListPrice($sourceRecordId, $relInfo['id'], $price);
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:18,代码来源:RelationAjax.php

示例13: getEntries

 public function getEntries($pagingModel)
 {
     $db = PearDatabase::getInstance();
     $parentModule = $this->getParentRecordModel()->getModule();
     $relationModel = $this->getRelationModel();
     $relationModule = $relationModel->getRelationModuleModel();
     $relatedColumnFieldMapping = $relationModel->getRelationFields(true, true);
     if (count($relatedColumnFieldMapping) <= 0) {
         $relatedColumnFieldMapping = $relationModule->getConfigureRelatedListFields();
     }
     if (count($relatedColumnFieldMapping) <= 0) {
         $relatedColumnFieldMapping = $relationModule->getRelatedListFields();
     }
     $query = $this->getRelationQuery();
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     $orderBy = $this->getForSql('orderby');
     $sortOrder = $this->getForSql('sortorder');
     if ($orderBy) {
         $query = "{$query} ORDER BY {$orderBy} {$sortOrder}";
     }
     $limitQuery = $query . ' LIMIT ' . $startIndex . ',' . $pageLimit;
     $result = $db->pquery($limitQuery, array());
     $relatedRecordList = array();
     for ($i = 0; $i < $db->num_rows($result); $i++) {
         $row = $db->fetch_row($result, $i);
         $newRow = array();
         foreach ($row as $col => $val) {
             if (array_key_exists($col, $relatedColumnFieldMapping)) {
                 $newRow[$relatedColumnFieldMapping[$col]] = $val;
             }
         }
         $recordId = $row['crmid'];
         $newRow['id'] = $recordId;
         //Added to support List Price
         $newRow['listprice'] = CurrencyField::convertToUserFormat($row['listprice'], null, true);
         $record = Vtiger_Record_Model::getCleanInstance($relationModule->get('name'));
         $relatedRecordList[$recordId] = $record->setData($newRow)->setModuleFromInstance($relationModule);
     }
     $pagingModel->calculatePageRange($relatedRecordList);
     $nextLimitQuery = $query . ' LIMIT ' . ($startIndex + $pageLimit) . ' , 1';
     $nextPageLimitResult = $db->pquery($nextLimitQuery, array());
     if ($db->num_rows($nextPageLimitResult) > 0) {
         $pagingModel->set('nextPageExists', true);
     } else {
         $pagingModel->set('nextPageExists', false);
     }
     return $relatedRecordList;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:49,代码来源:RelationListView.php

示例14: getCMSFields

 public function getCMSFields()
 {
     $fields = FieldList::create(new Tabset('Root', new Tab('Main'), new Tab('Modifiers')));
     // set variables from Product
     $productID = $this->ProductID != 0 ? $this->ProductID : Session::get('CMSMain.currentPage');
     $product = ProductPage::get()->byID($productID);
     $parentPrice = $product->obj('Price')->Nice();
     $parentWeight = $product->Weight;
     $parentCode = $product->Code;
     // ProductOptionGroup Dropdown field w/ add new
     $groups = function () {
         return OptionGroup::get()->map()->toArray();
     };
     $groupFields = singleton('OptionGroup')->getCMSFields();
     $groupField = DropdownField::create('ProductOptionGroupID', _t("OptionItem.Group", "Group"), $groups())->setEmptyString('')->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>'));
     if (class_exists('QuickAddNewExtension')) {
         $groupField->useAddNew('OptionGroup', $groups, $groupFields);
     }
     $fields->addFieldsToTab('Root.Main', array(HeaderField::create('DetailsHD', _t("OptionItem.DetailsHD", "Product Option Details"), 2), Textfield::create('Title')->setTitle(_t("OptionItem.Title", "Product Option Name")), CheckboxField::create('Available')->setTitle(_t("OptionItem.Available", "Available for purchase"))->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")), $groupField));
     $fields->addFieldsToTab('Root.Modifiers', array(HeaderField::create('ModifyHD', _t('OptionItem.ModifyHD', 'Product Option Modifiers'), 2), HeaderField::create('WeightHD', _t('OptionItem.WeightHD', 'Modify Weight'), 3), NumericField::create('WeightModifier')->setTitle(_t('OptionItem.WeightModifier', 'Weight')), DropdownField::create('WeightModifierAction', _t('OptionItem.WeightModifierAction', 'Weight Modification'), array('Add' => _t('OptionItem.WeightAdd', "Add to Base Weight ({weight})", 'Add to weight', array('weight' => $parentWeight)), 'Subtract' => _t('OptionItem.WeightSubtract', "Subtract from Base Weight ({weight})", 'Subtract from weight', array('weight' => $parentWeight)), 'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight')))->setEmptyString('')->setDescription(_t('OptionItem.WeightDescription', 'Does weight modify or replace base weight?')), HeaderField::create('PriceHD', _t('OptionItem.PriceHD', 'Modify Price'), 3), CurrencyField::create('PriceModifier')->setTitle(_t('OptionItem.PriceModifier', 'Price')), DropdownField::create('PriceModifierAction', _t('OptionItem.PriceModifierAction', 'Price Modification'), array('Add' => _t('OptionItem.PriceAdd', "Add to Base Price ({price})", 'Add to price', array('price' => $parentPrice)), 'Subtract' => _t('OptionItem.PriceSubtract', "Subtract from Base Price ({price})", 'Subtract from price', array('price' => $parentPrice)), 'Set' => _t('OptionItem.PriceSet', 'Set as a new Price')))->setEmptyString('')->setDescription(_t('OptionItem.PriceDescription', 'Does price modify or replace base price?')), HeaderField::create('CodeHD', _t('OptionItem.CodeHD', 'Modify Code'), 3), TextField::create('CodeModifier')->setTitle(_t('OptionItem.CodeModifier', 'Code')), DropdownField::create('CodeModifierAction', _t('OptionItem.CodeModifierAction', 'Code Modification'), array('Add' => _t('OptionItem.CodeAdd', "Add to Base Code ({code})", 'Add to code', array('code' => $parentCode)), 'Subtract' => _t('OptionItem.CodeSubtract', 'Subtract from Base Code ({code})', 'Subtract from code', array('code' => $parentCode)), 'Set' => _t('OptionItem.CodeSet', 'Set as a new Code')))->setEmptyString('')->setDescription(_t('OptionItem.CodeDescription', 'Does code modify or replace base code?'))));
     /*
     // Cateogry Dropdown field w/ add new
     // removed until relevance determined
     $categories = function(){
         return ProductCategory::get()->map()->toArray();
     };
     
     // to do - have OptionItem category override set ProductPage category if selected: issue #155
     $categoryField = DropdownField::create('CategoryID', 'Category', $categories())
         ->setEmptyString('')
         ->setDescription('Categories can be managed in <a href="admin/settings">Settings > FoxyStripe > Categories</a>');
     if (class_exists('QuickAddNewExtension')) $categoryField->useAddNew('ProductCategory', $categories);
     
     $fields->insertAfter($categoryField, 'ProductOptionGroupID');
     */
     // allow CMS fields to be extended
     $this->extend('getCMSFields', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:dynamic-foxystripe,代码行数:39,代码来源:OptionItem.php

示例15: wf_formatcurrency

 function wf_formatcurrency($value)
 {
     $currencyField = new CurrencyField($value);
     return $currencyField->getDisplayValue(null, true);
 }
开发者ID:swarnat,项目名称:Workflow-Designer-Developer,代码行数:5,代码来源:core.inc.php


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