From 8ab53542d04cddbbad2658885bed2020c82a7390 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 5 Sep 2024 11:37:03 +0300 Subject: [PATCH] =?utf8?q?[ERP-107]=20=D1=83=D0=BC=D0=BD=D0=BE=D0=B6=D0=B8?= =?utf8?q?=D0=BB=20=D0=BD=D0=B0=20100=20=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?utf8?q?=D0=B2=D0=B8=D0=BB=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D0=BD=D1=82?= =?utf8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/views/motivation/index.php | 35 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/erp24/views/motivation/index.php b/erp24/views/motivation/index.php index 99c18583..22f404da 100644 --- a/erp24/views/motivation/index.php +++ b/erp24/views/motivation/index.php @@ -141,80 +141,81 @@ $this->registerJsFile('/js/motivation/index.js', ['position' => \yii\web\View::P [ 'attribute' => 'plan', 'value' => function ($model) { - return $model["plan"] !== null ? FormatHelper::asDecimalMotivation($model["plan"]) : " "; + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["plan"] !== null ? FormatHelper::asDecimalMotivation($model["plan"] * $koef) . ($koef == 100 ? "%" : "") : " "; }, 'header' => 'План', ], [ 'attribute' => 'adjustment', 'value' => function ($model) { - return $model["adjustment"] !== null ? FormatHelper::asDecimalMotivation($model["adjustment"]) : " "; + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["adjustment"] !== null ? FormatHelper::asDecimalMotivation($model["adjustment"] * $koef) . ($koef == 100 ? "%" : "") : " "; }, 'header' => 'Корректировка', ], [ 'attribute' => 'week1', 'class' => 'kartik\grid\FormulaColumn', - 'header' => 'Неделя 1
(1-7)', 'value' => function ($model) { - return $model["week1"] !== null ? FormatHelper::asDecimalMotivation($model["week1"]) : "0"; + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["week1"] !== null ? FormatHelper::asDecimalMotivation($model["week1"] * $koef) . ($koef == 100 ? "%" : "") : "0"; }, ], [ 'attribute' => 'week2', 'class' => 'kartik\grid\FormulaColumn', - 'header' => 'Неделя 2
(8-14)', 'value' => function ($model) { - return $model["week2"] !== null ? FormatHelper::asDecimalMotivation($model["week2"]) : "0"; + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["week2"] !== null ? FormatHelper::asDecimalMotivation($model["week2"] * $koef) . ($koef == 100 ? "%" : "") : "0"; }, ], [ 'attribute' => 'week3', 'class' => 'kartik\grid\FormulaColumn', - 'header' => 'Неделя 3
(15-21)', 'value' => function ($model) { - return $model["week3"] !== null ? FormatHelper::asDecimalMotivation($model["week3"]) : "0"; + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["week3"] !== null ? FormatHelper::asDecimalMotivation($model["week3"] * $koef) . ($koef == 100 ? "%" : "") : "0"; }, ], [ 'attribute' => 'week4', 'class' => 'kartik\grid\FormulaColumn', - 'header' => 'Неделя 4
(22-28)', 'value' => function ($model) { - return $model["week4"] !== null ? FormatHelper::asDecimalMotivation($model["week4"]) : "0"; + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["week4"] !== null ? FormatHelper::asDecimalMotivation($model["week4"] * $koef) . ($koef == 100 ? "%" : "") : "0"; }, ], [ 'attribute' => 'week5', 'class' => 'kartik\grid\FormulaColumn', - 'header' => $week5Header, 'value' => function ($model) { - return $model["week5"] !== null ? FormatHelper::asDecimalMotivation($model["week5"]) : "0"; + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["week5"] !== null ? FormatHelper::asDecimalMotivation($model["week5"] * $koef) . ($koef == 100 ? "%" : "") : "0"; }, ], [ 'attribute' => 'forecast', 'header' => 'Прогноз за месяц', 'value' => function ($model) { - return $model["forecast"] !== null ? FormatHelper::asDecimalMotivation($model["forecast"]) : " "; - + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["forecast"] !== null ? FormatHelper::asDecimalMotivation($model["forecast"] * $koef) . ($koef == 100 ? "%" : "") : " "; }, - ], [ 'attribute' => 'fact', 'header' => 'Факт за месяц', 'value' => function ($model) { - return $model["fact"] !== null ? FormatHelper::asDecimalMotivation($model["fact"]) : " "; - + $koef = ($model['code'] == MotivationService::CODE_NET_PROFIT_MARGIN_PERCENT) ? 100 : 1; + return $model["fact"] !== null ? FormatHelper::asDecimalMotivation($model["fact"] * $koef) . ($koef == 100 ? "%" : "") : " "; }, ], [ -- 2.39.5