本文整理汇总了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();
}
示例2: actionDelete
public function actionDelete($id)
{
$opportunity = Opportunity::GetById(intval($id));
$opportunity->delete();
$this->redirect(array($this->getId() . '/index'));
}
示例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;
}
}
示例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));
}
}