use yii\widgets\ActiveForm;
use yii\base\DynamicModel;
use kartik\grid\GridView;
+use yii_app\helpers\FormatHelper;
use yii_app\records\MotivationCostsItem;
/** @var $model DynamicModel */
/** @var $stores array */
<?php else : ?>
<?php
-
+ // CSS для фиксации ширины и переноса слов в первом столбце
+ $this->registerCss("
+ .grid-view td:first-child, .grid-view th:first-child {
+ width: 150px; /* Фиксированная ширина */
+ word-wrap: break-word; /* Перенос слов */
+ white-space: normal; /* Разрешаем перенос слов */
+ }
+ ");
// Функция для расчета значения недели
function calculateWeekValue($plan, $daysInMonth, $daysInWeek)
[
'attribute' => 'plan',
'value' => function ($model) {
- if ($model["plan"] !== null) {
- return Yii::$app->formatter->asDecimal($model["plan"], 2);
- } else {
- return " ";
- }
+
+ return $model["plan"] !== null ? FormatHelper::asDecimalMotivation($model["plan"]) : " ";
+
},
'header' => 'План',
],
[
'attribute' => 'correction',
'value' => function ($model) {
- if ($model["correction"] !== null && $model["correction"] !== '') {
- return Yii::$app->formatter->asDecimal($model["correction"], 2);
- } else {
- return " ";
- }
+
+ return $model["correction"] !== null ? FormatHelper::asDecimalMotivation($model["correction"]) : " ";
+
},
'header' => 'Корректировка',
'header' => 'Неделя 1<br>(1-7)',
'value' => function ($model) {
- if ($model["week1"] !== null) {
- return Yii::$app->formatter->asDecimal($model["week1"], 2);
- } else {
- return " ";
- }
+ return $model["week1"] !== null ? FormatHelper::asDecimalMotivation($model["week1"]) : " ";
+
},
],
'header' => 'Неделя 2<br>(8-14)',
'value' => function ($model) {
- if ($model["week2"] !== null) {
- return Yii::$app->formatter->asDecimal($model["week2"], 2);
- } else {
- return " ";
- }
+ return $model["week2"] !== null ? FormatHelper::asDecimalMotivation($model["week2"]) : " ";
+
},
],
'header' => 'Неделя 3<br>(15-21)',
'value' => function ($model) {
- if ($model["week3"] !== null) {
- return Yii::$app->formatter->asDecimal($model["week3"], 2);
- } else {
- return " ";
- }
+ return $model["week3"] !== null ? FormatHelper::asDecimalMotivation($model["week3"]) : " ";
+
},
],
'header' => 'Неделя 4<br>(22-28)',
'value' => function ($model) {
- if ($model["week4"] !== null) {
- return Yii::$app->formatter->asDecimal($model["week4"], 2);
- } else {
- return " ";
- }
+ return $model["week4"] !== null ? FormatHelper::asDecimalMotivation($model["week4"]) : " ";
+
},
],
'header' => $week5Header,
'value' => function ($model) {
- if ($model["week5"] !== null) {
- return Yii::$app->formatter->asDecimal($model["week5"], 2);
- } else {
- return " ";
- }
+ return $model["week5"] !== null ? FormatHelper::asDecimalMotivation($model["week5"]) : " ";
+
},
],
'header' => 'Прогноз за месяц',
'value' => function ($model) {
- if ($model["forecast"] !== null) {
- return Yii::$app->formatter->asDecimal($model["forecast"], 2);
- } else {
- return " ";
- }
+ return $model["forecast"] !== null ? FormatHelper::asDecimalMotivation($model["forecast"]) : " ";
+
},
],
'header' => 'Факт за месяц',
'value' => function ($model) {
- if ($model["fact"] !== null) {
- return Yii::$app->formatter->asDecimal($model["fact"], 2);
- } else {
- return " ";
- }
+ return $model["fact"] !== null ? FormatHelper::asDecimalMotivation($model["fact"]) : " ";
+
},
],
[
'header' => 'Отклонение, %',
'value' => function ($model) {
- if ($model["deviation"] !== null) {
- return Yii::$app->formatter->asDecimal($model["deviation"], 2);
- } else {
- return " ";
- }
+ return $model["deviation"] !== null ? FormatHelper::asDecimalMotivation($model["deviation"]) : " ";
+
},
]
$boldRows = [
'Стоимость товара', 'Услуги агентов (Расходы на закупку, хранение, доставку товара)',
'Брак, пересорт', 'Расходные материалы (обеспечение продаж)', 'Оплата труда', 'Содержание помещения',
- 'РаÑ\81Ñ\85одÑ\8b по доÑ\81Ñ\82авке', 'УÑ\81лÑ\83ги маÑ\80кеÑ\82плейÑ\81ов', 'СодеÑ\80жание и обÑ\81лÑ\83живание Ð\9eС и Ð\9dÐ\9cÐ\90',
+ 'Расходы по доставке', 'Содержание и обслуживание ОС и НМА',
'Услуги связи', 'Прочие операционные расходы', 'Бухгалтерия и финансы',
'Юридическое сопровождение', 'HR- услуги', 'IT услуги',
'Продвижение и продажа товара через сайт', 'Минимальный порог Чистой прибыли, руб.',
[
'attribute' => 'plan',
'header' => 'Значение',
- 'format' => ['decimal', 2],
+ 'value' => function ($model) {
+ return $model["plan"] !== null ? FormatHelper::asDecimalMotivation($model["plan"]) : " ";
+
+ },
],
],
'responsive' => true,