• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CurrencyField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: replaceProductTableNP

    function replaceProductTableNP($content, $pdftype, $id)
    {
        $current_language = Users_Record_Model::getCurrentUserModel()->get('language');
        require_once 'include/utils/utils.php';
        include "modules/OSSPdf/language/" . $current_language . ".lang.php";
        require_once 'include/utils/CommonUtils.php';
        require_once 'include/fields/CurrencyField.php';
        require_once 'modules/' . $pdftype . '/' . $pdftype . '.php';
        $db = PearDatabase::getInstance();
        $focus = new $pdftype();
        $focus->retrieve_entity_info($id, $pdftype);
        $focus->id = $focus->column_fields["record_id"];
        $associated_products = getAssociatedProducts($pdftype, $focus);
        $num_products = count($associated_products);
        $currency_id = $focus->column_fields['currency_id'];
        $pobierz = $db->query("select currency_symbol from vtiger_currency_info where id = '{$currency_id}'", true);
        $symbol_waluty = $db->query_result($pobierz, 0, "currency_symbol");
        //This $final_details array will contain the final total, discount, Group Tax, S&H charge, S&H taxes
        $final_details = $associated_products[1]['final_details'];
        //getting the Net Total
        $price_subtotal = number_format($final_details["hdnSubTotal"], 2, '.', ',');
        //Final discount amount/percentage
        $discount_amount = $final_details["discount_amount_final"];
        $discount_percent = $final_details["discount_percentage_final"];
        if ($discount_amount != "") {
            $price_discount = number_format($discount_amount, 2, '.', ',');
        } else {
            if ($discount_percent != "") {
                //This will be displayed near Discount label - used in include/fpdf/templates/body.php
                $final_price_discount_percent = "(" . number_format($discount_percent, 2, '.', ',') . " %)";
                $price_discount = number_format($discount_percent * $final_details["hdnSubTotal"] / 100, 2, '.', ',');
            } else {
                $price_discount = "0.00";
            }
        }
        //Grand Total
        $price_total = number_format($final_details["grandTotal"], 2, '.', ',');
        //To calculate the group tax amount
        if ($final_details['taxtype'] == 'group') {
            $group_tax_total = $final_details['tax_totalamount'];
            $price_salestax = number_format($group_tax_total, 2, '.', ',');
            $group_total_tax_percent = '0.00';
            $group_tax_details = $final_details['taxes'];
            for ($i = 0; $i < count($group_tax_details); $i++) {
                $group_total_tax_percent = $group_total_tax_percent + $group_tax_details[$i]['percentage'];
            }
        }
        $prod_line = array();
        $lines = 0;
        //This is to get all prodcut details as row basis
        for ($i = 1, $j = $i - 1; $i <= $num_products; $i++, $j++) {
            $product_name[$i] = $associated_products[$i]['productName' . $i];
            $subproduct_name[$i] = split("<br>", $associated_products[$i]['subprod_names' . $i]);
            //$prod_description[$i] = $associated_products[$i]['productDescription'.$i];
            $comment[$i] = $associated_products[$i]['comment' . $i];
            $product_id[$i] = $associated_products[$i]['hdnProductId' . $i];
            $qty[$i] = $associated_products[$i]['qty' . $i];
            $unit_price[$i] = number_format($associated_products[$i]['unitPrice' . $i], 2, '.', ',');
            $list_price[$i] = $associated_products[$i]['listPrice' . $i];
            // number_format($associated_products[$i]['listPrice'.$i],2,'.',',');
            $list_pricet[$i] = $associated_products[$i]['listPrice' . $i];
            $discount_total[$i] = $associated_products[$i]['discountTotal' . $i];
            //aded for 5.0.3 pdf changes
            $product_code[$i] = $associated_products[$i]['hdnProductcode' . $i];
            $taxable_total = $qty[$i] * $list_pricet[$i] - $discount_total[$i];
            $producttotal = $taxable_total;
            $total_taxes = '0.00';
            if ($focus->column_fields["hdnTaxType"] == "individual") {
                $total_tax_percent = '0.00';
                //This loop is to get all tax percentage and then calculate the total of all taxes
                for ($tax_count = 0; $tax_count < count($associated_products[$i]['taxes']); $tax_count++) {
                    $tax_percent = $associated_products[$i]['taxes'][$tax_count]['percentage'];
                    $total_tax_percent = $total_tax_percent + $tax_percent;
                    $tax_amount = $taxable_total * $tax_percent / 100;
                    $total_taxes = $total_taxes + $tax_amount;
                }
                $producttotal = $taxable_total + $total_taxes;
                $product_line[$j]["tax_percentage"] = $total_tax_percent;
                $product_line[$j]["Tax"] = $total_taxes;
                $price_salestax += $total_taxes;
            }
            $prod_total[$i] = $producttotal;
            $product_line[$j]["Product Code"] = $product_code[$i];
            $product_line[$j]["Qty"] = $qty[$i];
            $product_line[$j]["Price"] = $list_price[$i];
            $product_line[$j]["Discount"] = $discount_total[$i];
            $product_line[$j]["Total"] = $prod_total[$i];
            $lines++;
            $product_line[$j]["Product Name"] = decode_html($product_name[$i]);
            $prod_line[$j] = 1;
            for ($count = 0; $count < count($subproduct_name[$i]); $count++) {
                if ($lines % 12 != 0) {
                    $product_line[$j]["Product Name"] .= "\n" . decode_html($subproduct_name[$i][$count]);
                    $prod_line[$j]++;
                } else {
                    $j++;
                    $product_line[$j]["Product Name"] = decode_html($product_name[$i]);
                    $product_line[$j]["Product Name"] .= "\n" . decode_html($subproduct_name[$i][$count]);
                    $prod_line[$j] = 2;
                    $lines++;
//.........这里部分代码省略.........
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:101,代码来源:Record.php


示例17: sanitizeValues

 /**
  * this function takes in an array of values for an user and sanitizes it for export
  * @param array $arr - the array of values
  */
 function sanitizeValues($arr)
 {
     global $current_user, $adb;
     $roleid = fetchUserRole($current_user->id);
     $decimal = $current_user->currency_decimal_separator;
     $numsep = $current_user->currency_grouping_separator;
     foreach ($arr as $fieldlabel => &$value) {
         $fieldInfo = $this->fieldsArr[$fieldlabel];
         $uitype = $fieldInfo['uitype'];
         $fieldname = $fieldInfo['fieldname'];
         if ($uitype == 15 || $uitype == 16 || $uitype == 33) {
             //picklists
             if (empty($this->picklistValues[$fieldname])) {
                 $this->picklistValues[$fieldname] = getAssignedPicklistValues($fieldname, $roleid, $adb);
             }
             $value = trim($value);
         } elseif ($uitype == 10) {
             //have to handle uitype 10
             $value = trim($value);
             if (!empty($value)) {
                 $parent_module = getSalesEntityType($value);
                 $displayValueArray = getEntityName($parent_module, $value);
                 if (!empty($displayValueArray)) {
                     foreach ($displayValueArray as $k => $v) {
                         $displayValue = $v;
                     }
                 }
                 if (!empty($parent_module) && !empty($displayValue)) {
                     $value = $parent_module . "::::" . $displayValue;
                 } else {
                     $value = "";
                 }
             } else {
                 $value = '';
             }
         } elseif ($uitype == 71 || $uitype == 72) {
             $value = CurrencyField::convertToUserFormat($value, null, true);
         } elseif ($uitype == 7 || $fieldInfo['typeofdata'] == 'N~O' || $uitype == 9) {
             $value = number_format($value, 2, $decimal, $numsep);
         }
     }
     return $arr;
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:47,代码来源:export.php


示例18: implode

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Current类代码示例发布时间:2022-05-23
下一篇:
PHP CurrencyDisplay类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap