[
'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<br>(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<br>(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<br>(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<br>(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 ? "%" : "") : " ";
},
],
[