當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Opportunity::GetById方法代碼示例

本文整理匯總了PHP中Opportunity::GetById方法的典型用法代碼示例。如果您正苦於以下問題:PHP Opportunity::GetById方法的具體用法?PHP Opportunity::GetById怎麽用?PHP Opportunity::GetById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Opportunity的用法示例。


在下文中一共展示了Opportunity::GetById方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addAgreementProductsCalculation

 public function addAgreementProductsCalculation(Costbook $costbook, $quantity, $frequency, $optId)
 {
     $tQty = 0;
     $opportunityProduct = new OpportunityProduct();
     $opportunityProduct->Quantity = (double) $quantity;
     $opportunityProduct->Frequency = (double) $frequency;
     $opportunityProduct->name = 'Love Name - ' . $costbook->id;
     //$opportunityProduct->Product = $costbook;
     $tQty = (double) $quantity;
     if ($opportunityProduct->Frequency > 0) {
         $tQty *= $opportunityProduct->Frequency;
     }
     //Labor Product calculation
     if ($costbook->costofgoodssold == 'Labor') {
         $currencies = Currency::getAll();
         $opportunityProduct->Total_MHR = round($costbook->costperunit * $tQty);
         if ($costbook->departmentreference != null) {
             $deptReference = DepartmentReference::GetById(intval($costbook->departmentreference));
             $burdenCost = new CurrencyValue();
             $burdenCost->value = round($deptReference->burdonCost * $tQty, 2);
             $burdenCost->currency = $currencies[0];
             $opportunityProduct->Burden_Cost = $burdenCost;
             $laborCost = new CurrencyValue();
             $laborCost->value = round($deptReference->laborCost * $tQty, 2);
             $laborCost->currency = $currencies[0];
             $opportunityProduct->Labor_Cost = $laborCost;
         }
     }
     $opportunityProduct->Category_GPM = 40;
     $totalDirectCost = new CurrencyValue();
     $totalDirectCost->value = round($opportunityProduct->Labor_Cost->value + $opportunityProduct->Burden_Cost->value, 2);
     $totalDirectCost->currency = $currencies[0];
     $opportunityProduct->Total_Direct_Cost = $totalDirectCost;
     $finalCost = new CurrencyValue();
     $finalCost->value = round($opportunityProduct->Total_Direct_Cost->value / (1 - $opportunityProduct->Category_GPM / 100), 2);
     $finalCost->currency = $currencies[0];
     $opportunityProduct->Final_Cost = $finalCost;
     $opportunityProduct->opportunity = $opportunity = Opportunity::GetById(intval($optId));
     $opportunityProduct->save();
 }
開發者ID:RamaKavanan,項目名稱:BaseVersion,代碼行數:40,代碼來源:AgreementProductUtils.php

示例2: actionDelete

 public function actionDelete($id)
 {
     $opportunity = Opportunity::GetById(intval($id));
     $opportunity->delete();
     $this->redirect(array($this->getId() . '/index'));
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:6,代碼來源:DefaultController.php

示例3: addOpportunityProductsCalculation


//.........這裏部分代碼省略.........
                         $laborCost = new CurrencyValue();
                         $laborCost->value = 0.0;
                         $laborCost->currency = $currencies[0];
                         $opportunityProduct->Labor_Cost = $laborCost;
                     } else {
                         $burdenCost = new CurrencyValue();
                         $burdenCost->value = 0.0;
                         $burdenCost->currency = $currencies[0];
                         $opportunityProduct->Burden_Cost = $burdenCost;
                         $laborCost = new CurrencyValue();
                         $laborCost->value = 0.0;
                         $laborCost->currency = $currencies[0];
                         $opportunityProduct->Labor_Cost = $laborCost;
                     }
                 }
             }
             //$opportunityProduct->Total_MHR = $tQty;
         } else {
             $burdenCost = new CurrencyValue();
             $burdenCost->value = 0.0;
             $burdenCost->currency = $currencies[0];
             $opportunityProduct->Burden_Cost = $burdenCost;
             $laborCost = new CurrencyValue();
             $laborCost->value = 0.0;
             $laborCost->currency = $currencies[0];
             $opportunityProduct->Labor_Cost = $laborCost;
         }
         if ($costbook->costofgoodssold->value == 'Material') {
             // $opportunityProduct->Total_MHR = round($tQty);
             $materialCost = new CurrencyValue();
             $materialCost->value = round(intval($costbook->unitdirectcost) * $tQty, 2);
             $materialCost->currency = $currencies[0];
             $opportunityProduct->Materials_Cost = $materialCost;
         } else {
             $materialCost = new CurrencyValue();
             $materialCost->value = 0.0;
             $materialCost->currency = $currencies[0];
             $opportunityProduct->Materials_Cost = $materialCost;
         }
         if ($costbook->costofgoodssold->value == 'Equipment') {
             //$opportunityProduct->Total_MHR = round($tQty);
             $eqmtCost = new CurrencyValue();
             $eqmtCost->value = round($tQty, 2);
             $eqmtCost->currency = $currencies[0];
             $opportunityProduct->Equipment_Cost = $eqmtCost;
         } else {
             $eqmtCost = new CurrencyValue();
             $eqmtCost->value = 0.0;
             $eqmtCost->currency = $currencies[0];
             $opportunityProduct->Equipment_Cost = $eqmtCost;
         }
         if ($costbook->costofgoodssold->value == 'Subcontractor') {
             //$opportunityProduct->Total_MHR = round($tQty);
             $subcontCost = new CurrencyValue();
             $subcontCost->value = round(intval($costbook->unitdirectcost) * $tQty, 2);
             $subcontCost->currency = $currencies[0];
             $opportunityProduct->Sub_Cost = $subcontCost;
         } else {
             $subcontCost = new CurrencyValue();
             $subcontCost->value = 0.0;
             $subcontCost->currency = $currencies[0];
             $opportunityProduct->Sub_Cost = $subcontCost;
         }
         if ($costbook->costofgoodssold->value == 'Other') {
             // $opportunityProduct->Total_MHR = round($tQty);
             $otherCost = new CurrencyValue();
             $otherCost->value = round(intval($costbook->unitdirectcost) * $tQty, 2);
             $otherCost->currency = $currencies[0];
             $opportunityProduct->Other_Cost = $otherCost;
         } else {
             $otherCost = new CurrencyValue();
             $otherCost->value = 0.0;
             $otherCost->currency = $currencies[0];
             $opportunityProduct->Other_Cost = $otherCost;
         }
         $values = Category::getCategoryByName($category);
         if ($values != '') {
             $opportunityProduct->Category_GPM = $values[0]->targetgpm;
         } else {
             $opportunityProduct->Category_GPM = 40;
         }
         $totalDirectCost = new CurrencyValue();
         $totalDirectCost->value = round($opportunityProduct->Labor_Cost->value + $opportunityProduct->Burden_Cost->value + $opportunityProduct->Materials_Cost->value + $opportunityProduct->Equipment_Cost->value + $opportunityProduct->Sub_Cost->value + $opportunityProduct->Other_Cost->value, 2);
         $totalDirectCost->currency = $currencies[0];
         $opportunityProduct->Total_Direct_Cost = $totalDirectCost;
         $finalCost = new CurrencyValue();
         $finalCost->value = round($opportunityProduct->Total_Direct_Cost->value / (1 - $opportunityProduct->Category_GPM / 100), 2);
         $finalCost->currency = $currencies[0];
         $opportunityProduct->Final_Cost = $finalCost;
         $opportunityProduct->opportunity = $opportunity = Opportunity::GetById(intval($optId));
         if (!$opportunityProduct->save()) {
             throw new Exception();
         } else {
             return TRUE;
         }
     } catch (Exception $ex) {
         //echo 'Exception occured'.$ex;       die;
         return FALSE;
     }
 }
開發者ID:RamaKavanan,項目名稱:BaseVersion,代碼行數:101,代碼來源:OpportunityProductUtils.php

示例4: actionAddOpportunityRelation

 public function actionAddOpportunityRelation($relationModuleId, $portletId, $uniqueLayoutId, $id, $relationModelId, $relationAttributeName, $redirect)
 {
     $opportunityProduct = OpportunityProduct::GetById(intval($id));
     $opportunity = Opportunity::GetById(intval($relationModelId));
     if ($opportunityProduct->opportunity != $opportunity) {
         $opportunityProduct->opportunity = $opportunity;
         $opportunityProduct->save();
     }
     if ((bool) $redirect) {
         $isViewLocked = ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView');
         $redirectUrl = Yii::app()->createUrl('/' . $relationModuleId . '/default/details', array('id' => $relationModelId));
         $this->redirect(array('/' . $relationModuleId . '/defaultPortlet/modalRefresh', 'portletId' => $portletId, 'uniqueLayoutId' => $uniqueLayoutId, 'redirectUrl' => $redirectUrl, 'portletParams' => array('relationModuleId' => $relationModuleId, 'relationModelId' => $relationModelId), 'portletsAreRemovable' => !$isViewLocked));
     }
 }
開發者ID:RamaKavanan,項目名稱:BaseVersion,代碼行數:14,代碼來源:DefaultController.php


注:本文中的Opportunity::GetById方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。