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


PHP money\Money类代码示例

本文整理汇总了PHP中skeeks\modules\cms\money\Money的典型用法代码示例。如果您正苦于以下问题:PHP Money类的具体用法?PHP Money怎么用?PHP Money使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: format

 /**
  * Formats a Money object using PHP's built-in NumberFormatter.
  *
  * @param  Money $money
  * @return string
  */
 public function format(Money $money = null)
 {
     if (!$money) {
         return null;
     } else {
         return $this->numberFormatter->formatCurrency($money->getAmount() / $money->getCurrency()->getSubUnit(), $money->getCurrency()->getCurrencyCode());
     }
 }
开发者ID:skeeks-cms,项目名称:cms-module-money,代码行数:14,代码来源:IntlFormatter.php

示例2: actions

 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $activeDataProvider) {
         $activeDataProvider->query->andWhere(['type' => ShopDiscount::TYPE_DEFAULT]);
     }, "gridConfig" => ['settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"]], "columns" => ['id', ['attribute' => 'name'], ['attribute' => 'value', 'class' => DataColumn::className(), 'value' => function (ShopDiscount $shopDiscount) {
         if ($shopDiscount->value_type == ShopDiscount::VALUE_TYPE_P) {
             return \Yii::$app->formatter->asPercent($shopDiscount->value / 100);
         } else {
             $money = Money::fromString((string) $shopDiscount->value, $shopDiscount->currency_code);
             return \Yii::$app->money->intlFormatter()->format($money);
         }
     }], ['attribute' => 'active', 'class' => BooleanColumn::className()], ['attribute' => 'active_from', 'class' => DateTimeColumnData::className()], ['attribute' => 'active_to', 'class' => DateTimeColumnData::className()], ['class' => UpdatedByColumn::className()], ['class' => UpdatedAtColumn::className()], 'priority']]]);
 }
开发者ID:BMOTech,项目名称:cms-shop,代码行数:16,代码来源:AdminDiscountController.php

示例3: assertSameCurrency

 /**
  * @param  Money $a
  * @param  Money $b
  * @throws CurrencyMismatchException
  */
 private function assertSameCurrency(Money $a, Money $b)
 {
     if ($a->getCurrency() != $b->getCurrency()) {
         throw new CurrencyMismatchException();
     }
 }
开发者ID:skeeks-cms,项目名称:cms-module-money,代码行数:11,代码来源:Money.php

示例4: getMoney

 /**
  * @return Money
  */
 public function getMoney()
 {
     return Money::fromString($this->price, $this->currency_code);
 }
开发者ID:skeeks-cms,项目名称:cms-shop,代码行数:7,代码来源:ShopProductPriceChange.php

示例5: function

/**
 * @author Semenov Alexander <semenov@skeeks.com>
 * @link http://skeeks.com/
 * @copyright 2010 SkeekS (СкикС)
 * @date 02.06.2015
 */
/* @var $this yii\web\View */
/* @var $searchModel \skeeks\cms\models\Search */
/* @var $dataProvider yii\data\ActiveDataProvider */
$dataProvider->query->andWhere(['type' => \skeeks\cms\shop\models\ShopDiscount::TYPE_DEFAULT]);
?>

<? $pjax = \skeeks\cms\modules\admin\widgets\Pjax::begin(); ?>

    <?php 
echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
?>

    <?php 
echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => $pjax, 'adminController' => \Yii::$app->controller, 'settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"], 'columns' => ['id', ['attribute' => 'name'], ['attribute' => 'value', 'class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\shop\models\ShopDiscount $shopDiscount) {
    if ($shopDiscount->value_type == \skeeks\cms\shop\models\ShopDiscount::VALUE_TYPE_P) {
        return \Yii::$app->formatter->asPercent($shopDiscount->value / 100);
    } else {
        $money = \skeeks\modules\cms\money\Money::fromString((string) $shopDiscount->value, $shopDiscount->currency_code);
        return \Yii::$app->money->intlFormatter()->format($money);
    }
}], ['attribute' => 'active', 'class' => \skeeks\cms\grid\BooleanColumn::className()], ['attribute' => 'active_from', 'class' => \skeeks\cms\grid\DateTimeColumnData::className()], ['attribute' => 'active_to', 'class' => \skeeks\cms\grid\DateTimeColumnData::className()], ['class' => \skeeks\cms\grid\UpdatedByColumn::className()], ['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], 'priority']]);
?>

<? $pjax::end(); ?>
开发者ID:skeeks-cms,项目名称:cms-shop,代码行数:30,代码来源:index.php

示例6: convertAndFormat

 /**
  * Сконвертировать и отформатировать для текущих настроек
  *
  * @param \skeeks\modules\cms\money\Money $money
  * @param null $language
  * @param null $currency
  * @return string
  */
 public function convertAndFormat(\skeeks\modules\cms\money\Money $money, $language = null, $currency = null)
 {
     if (!$currency) {
         $currency = $this->currencyCode;
     }
     $convertedMoney = $money->convertToCurrency($currency);
     return $this->intlFormatter($language)->format($convertedMoney);
 }
开发者ID:skeeks-cms,项目名称:cms-module-money,代码行数:16,代码来源:Money.php

示例7: getMoneyVat

 /**
  * Значение налога за одну единицу товара
  *
  * @return Money
  */
 public function getMoneyVat()
 {
     if ((double) $this->vat_rate == 0) {
         return Money::fromString("0", $this->currency_code);
     }
     $value = $this->money->getValue();
     $calculateValue = $value - $value * 100 / 118;
     return Money::fromString((string) $calculateValue, $this->currency_code);
 }
开发者ID:BMOTech,项目名称:cms-shop,代码行数:14,代码来源:ShopBasket.php

示例8: getMoneyDelivery

 /**
  * @return \skeeks\modules\cms\money\Money
  */
 public function getMoneyDelivery()
 {
     if ($this->isNewRecord) {
         return $this->moneyDeliveryFromApi;
     }
     return Money::fromString((string) $this->shipping_cost, "RUB");
 }
开发者ID:v3toys,项目名称:skeeks,代码行数:10,代码来源:V3toysOrder.php

示例9: getGuidingRealizeMoney

 /**
  * @return Money
  */
 public function getGuidingRealizeMoney()
 {
     return Money::fromString((string) $this->guidingRealizePriceAmount, "RUB");
 }
开发者ID:v3toys,项目名称:skeeks,代码行数:7,代码来源:V3toysOutletModel.php

示例10: getPickupMinPrice

 /**
  * TODO: to release
  * @return Money
  */
 public function getPickupMinPrice()
 {
     $minPrice = 0;
     if ($outlets = ArrayHelper::getValue($this->apiData, 'pickup.outlets')) {
         foreach ($outlets as $outletData) {
             if ($outletPrice = ArrayHelper::getValue($outletData, 'guiding_realize_price')) {
                 if ($minPrice == 0 && $outletPrice != 0) {
                     $minPrice = $outletPrice;
                     continue;
                 }
                 if ($outletPrice < $minPrice) {
                     $minPrice = $outletPrice;
                 }
             }
         }
     }
     $minPrice = $minPrice + (int) \Yii::$app->v3toysSettings->pickup_discaunt_value;
     return Money::fromString((string) $minPrice, 'RUB');
 }
开发者ID:v3toys,项目名称:skeeks,代码行数:23,代码来源:ShippingHelper.php

示例11: __construct

 public function __construct($amount)
 {
     parent::__construct($amount, new Currency('HKD'));
 }
开发者ID:skeeks-cms,项目名称:cms-module-money,代码行数:4,代码来源:HKD.php


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