From: Alexander Smirnov Date: Wed, 4 Sep 2024 15:52:05 +0000 (+0300) Subject: [ERP-140] проценты в записи числа важны как и умножение на 100 при переводе в них 2 X-Git-Tag: 1.4~3^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=e15485c836b04d576ad3106a27cc1eb3d9027e8e;p=erp24_rep%2Fyii-erp24%2F.git [ERP-140] проценты в записи числа важны как и умножение на 100 при переводе в них 2 --- diff --git a/erp24/views/motivation/index.php b/erp24/views/motivation/index.php index 9e375ad0..99c18583 100644 --- a/erp24/views/motivation/index.php +++ b/erp24/views/motivation/index.php @@ -2,14 +2,13 @@ use \yii\helpers\Html; use kartik\select2\Select2; -use yii\helpers\Json; use yii\widgets\ActiveForm; use yii\base\DynamicModel; use kartik\grid\GridView; use yii_app\helpers\FormatHelper; use yii_app\records\Admin; use yii_app\records\Motivation; -use yii_app\records\MotivationCostsItem; +use yii_app\services\MotivationService; /** @var $model DynamicModel */ /** @var $stores array */ @@ -308,8 +307,12 @@ $this->registerJsFile('/js/motivation/index.js', ['position' => \yii\web\View::P 'attribute' => 'plan', 'header' => 'Значение', 'value' => function ($model) { - return $model["plan"] !== null ? FormatHelper::asDecimalMotivation($model["plan"]) : " "; - + $koef = in_array(intval($model['code']), [ + MotivationService::CODE_AGENT_SERVICES_TARIFF, + MotivationService::CODE_BONUS_SIZE, + MotivationService::CODE_THRESHOLD_COEFFICIENT + ]) ? 100 : 1; + return $model["plan"] !== null ? FormatHelper::asDecimalMotivation($model["plan"] * $koef) . ($koef == 100 ? "%" : "") : " "; }, ], ],