本文整理汇总了PHP中Operation::getAmountForBudget方法的典型用法代码示例。如果您正苦于以下问题:PHP Operation::getAmountForBudget方法的具体用法?PHP Operation::getAmountForBudget怎么用?PHP Operation::getAmountForBudget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation::getAmountForBudget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calculate
/**
* Вычисляет вклад операции в статью бюджета
* @param Operation $operation
* @return BudgetArticleIncrement
*/
public function calculate(Operation $operation)
{
$increment = new BudgetArticleIncrement();
//получаем модуль вклада операции в бюджет:
//получаем без знака
$signed = false;
$operationContributionAmount = $operation->getAmountForBudget($this->_currency, $signed);
if ($operation->getDate() < $this->_startDate->format('Y-m-d')) {
$increment->mean += $operationContributionAmount / $this->_meanRateMonthsAmount;
} else {
if (!$operation->isFromCalendar()) {
$increment->adhoc += $operationContributionAmount;
} else {
if ($operation->isAccepted()) {
$increment->calendarAccepted += $operationContributionAmount;
} else {
$increment->calendarFuture += $operationContributionAmount;
}
}
}
return $increment;
}
示例2: setOperation
public function setOperation(Operation $operation)
{
$this->_levelValues["parentCategory"] = $operation->getCategory()->getParentCategory();
$this->_levelValues["category"] = $operation->getCategory();
$tags = array_map('trim', explode(',', $operation->getTags()));
$tag = isset($tags[0]) ? $tags[0] : null;
$this->_levelValues["tag"] = $tag;
$this->amount = $operation->getAmountForBudget($this->currency, true);
}