Skip to content

Commit

Permalink
Add Monthly cap formula example
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Nov 18, 2020
1 parent a767f1f commit 0ab612d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/messages/ru/hipanel.finance.price.php
Expand Up @@ -65,6 +65,7 @@
'Formula usage examples' => 'Примеры использования формул',
'Applicable for overuse prices. The example will compensate up to 5 TB of overuse as discount. Make sure to use appropriate unit, such as <code>items</code>, <code>gbps</code> or <code>hours</code>.' => 'Применим для цен на перебор. Этот пример компенсирует до 5 Тб перебора в виде скидки. Убедитесь, что использете единицу измерения, которая соответствует типу цены, например <code>items</code>, <code>gbps</code> или <code>hours</code>.',
'Applicable for overuse prices. Will compensate up to 5 TB of overuse as a separate Compensation bill. You can use any other bill type in option <code>.as()</code>, such as <code>deposit,creditnote</code> or <code>correction,positive</code>.' => 'Применим для цен на перебор. Этот пример компенсирует до 5 Тб перебора в виде отдельного счёта "Компенсация". Вы можете указывать любой другой тип счёта в опции <code>.as()</code>, например <code>deposit,creditnote</code> или <code>correction,positive</code>.',
'The given formula is useful only for monthly prices. When the monthly invoice consumption exceeds the given cap, two charges will be produced: first at the price amount for 28 days, and second for 0 cents for the rest days of month' => 'Применима только для абонплат. Когда услуга был активна больше указанного лимита (28 дней), будет начислено два списания: одно на сумму указанную в цене за 28 дней, второе – на 0 центов за остаток дней в месяце.',
'Calculate aggregated traffic' => 'Считать агрегировано траффик',
'(reasonable for grouping tariffs only)' => 'применимо только для группирующих тарифов',
'Aggregated' => 'Агрегирован',
Expand Down
10 changes: 10 additions & 0 deletions src/providers/FormulaExamplesProvider.php
Expand Up @@ -24,6 +24,7 @@ public function getGroups()
$result[] = $this->groupOf(Yii::t('hipanel.finance.price', 'Fixed discount'), $this->fixedDiscountFormulas());
$result[] = $this->groupOf(Yii::t('hipanel.finance.price', 'Growing discount'), $this->growingDiscountFormulas());
$result[] = $this->groupOf(Yii::t('hipanel.finance.price', 'Leasing'), $this->leasingFormulas());
$result[] = $this->groupOf(Yii::t('hipanel.finance.price', 'Monthly Cap'), $this->leasingFormulas());

return $result;
}
Expand Down Expand Up @@ -56,6 +57,15 @@ private function leasingFormulas()
];
}

private function mpnthlyCapFomulas()
{
return [
"cap.monthly('28 days')" => Yii::t('hipanel.finance.price',
'The given formula is useful only for monthly prices. When the monthly invoice consumption exceeds the given cap, two charges will be produced: first at the price amount for 28 days, and second for 0 cents for the rest days of month.'
),
];
}

private function groupOf($name, $formulas)
{
return ['name' => $name, 'formulas' => $formulas];
Expand Down

0 comments on commit 0ab612d

Please sign in to comment.