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


PHP Vtiger_Functions::getUnitPrice方法代码示例

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


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

示例1: initializeListViewContents

 public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
 {
     $moduleName = $request->getModule();
     $cvId = $request->get('cvid');
     $pageNumber = $request->get('page');
     $orderBy = $request->get('orderby');
     $sortOrder = $request->get('sortorder');
     $sourceModule = $request->get('src_module');
     $sourceField = $request->get('src_field');
     $sourceRecord = $request->get('src_record');
     $searchKey = $request->get('search_key');
     $searchValue = $request->get('search_value');
     if (empty($cvId)) {
         $cvId = '0';
     }
     if (empty($pageNumber)) {
         $pageNumber = '1';
     }
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $pageNumber);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName, $sourceModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
     if (empty($orderBy) && empty($sortOrder)) {
         $moduleInstance = CRMEntity::getInstance($moduleName);
         $orderBy = $moduleInstance->default_order_by;
         $sortOrder = $moduleInstance->default_sort_order;
     }
     if (!empty($orderBy)) {
         $listViewModel->set('orderby', $orderBy);
         $listViewModel->set('sortorder', $sortOrder);
     }
     if (!empty($sourceModule)) {
         $listViewModel->set('src_module', $sourceModule);
         $listViewModel->set('src_field', $sourceField);
         $listViewModel->set('src_record', $sourceRecord);
         $sourceRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
     }
     if (!empty($searchKey) && !empty($searchValue)) {
         $listViewModel->set('search_key', $searchKey);
         $listViewModel->set('search_value', $searchValue);
     }
     if (!$this->listViewHeaders) {
         $this->listViewHeaders = $listViewModel->getListViewHeaders();
     }
     if (!$this->listViewEntries) {
         $this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
     }
     //get the unit prices for the pricebooks based on the product currency
     $productUnitPrice = Vtiger_Functions::getUnitPrice($sourceRecord, $sourceModule);
     $productPriceDetails = getPriceDetailsForProduct($sourceRecord, $productUnitPrice, 'available', $sourceModule);
     $productCurrencyPrice = array();
     foreach ($productPriceDetails as $priceDetails) {
         $productCurrencyPrice[$priceDetails['curid']] = $priceDetails['curvalue'];
     }
     foreach ($this->listViewEntries as $recordId => $recordModel) {
         $recordDetails = $recordModel->getRawData();
         $priceBookCurrencyId = $recordDetails['currency_id'];
         $recordModel->set('unit_price', $productCurrencyPrice[$priceBookCurrencyId]);
     }
     $noOfEntries = count($this->listViewEntries);
     if (empty($sortOrder)) {
         $sortOrder = "ASC";
     }
     if ($sortOrder == "ASC") {
         $nextSortOrder = "DESC";
         $sortImage = "downArrowSmall.png";
     } else {
         $nextSortOrder = "ASC";
         $sortImage = "upArrowSmall.png";
     }
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('SOURCE_MODULE', $sourceModule);
     $viewer->assign('SOURCE_FIELD', $sourceField);
     $viewer->assign('SOURCE_RECORD', $sourceRecord);
     $viewer->assign('SOURCE_RECORD_MODEL', $sourceRecordModel);
     //PARENT_MODULE is used for only translations
     $viewer->assign('PARENT_MODULE', 'PriceBooks');
     $viewer->assign('SEARCH_KEY', $searchKey);
     $viewer->assign('SEARCH_VALUE', $searchValue);
     $viewer->assign('ORDER_BY', $orderBy);
     $viewer->assign('SORT_ORDER', $sortOrder);
     $viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
     $viewer->assign('SORT_IMAGE', $sortImage);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('PAGING_MODEL', $pagingModel);
     $viewer->assign('PAGE_NUMBER', $pageNumber);
     $viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
     $viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
     $viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
     $viewer->assign('VIEW', 'ProductPriceBookPopup');
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:93,代码来源:ProductPriceBookPopup.php


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