]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-140] проценты в записи числа важны как и умножение на 100 при переводе в них 2
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 4 Sep 2024 15:52:05 +0000 (18:52 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 4 Sep 2024 15:52:05 +0000 (18:52 +0300)
erp24/views/motivation/index.php

index 9e375ad045c686ea5352c2c5ecb23bb663b0900b..99c185830de44dde2903d977b6e4648bab5f0492 100644 (file)
@@ -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 ? "%" : "") : " ";
                             },
                         ],
                     ],