From: Alexander Smirnov Date: Thu, 5 Sep 2024 08:37:03 +0000 (+0300) Subject: [ERP-107] умножил на 100 и добавил проценты X-Git-Tag: 1.4~2^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=8ab53542d04cddbbad2658885bed2020c82a7390;p=erp24_rep%2Fyii-erp24%2F.git [ERP-107] умножил на 100 и добавил проценты --- 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 ? "%" : "") : " "; }, ], [