'store_type_id' => null,
'territory_manager_id' => null,
'kshf_id' => null,
+ 'statuses' => null,
], [
[[
'year', 'month', 'store_id', 'city_id', 'region_id', 'raion_id', 'store_type_id',
- 'territory_manager_id', 'kshf_id'
+ 'territory_manager_id', 'kshf_id', 'statuses'
], 'safe']
]);
$saleCountPlan = [];
foreach ($boquetCompositionMatrixTypeHistory as $bcmth) {
/** @var BouquetCompositionMatrixTypeHistory $bcmth */
- $bouquetForecastQuery = BouquetForecast::find()->where([
- 'bouquet_id' => $bcmth->bouquet_id,
+ $bouquetForecastQuery = BouquetForecast::find()->alias('bf')->joinWith(['bouquetHistory bh'])->where([
+ 'bf.bouquet_id' => $bcmth->bouquet_id,
'year' => $model->year,
'month' => $model->month
]);
+ if (!empty($model->statuses)) {
+ $bouquetForecastQuery->andWhere(['bh.matrix_type_id' => $model->statuses]);
+ }
if ($model->sale_type) {
$bouquetForecastQuery->andWhere(['type_sales' => $model->sale_type]);
}
])->label(false) ?>
</div>
</div>
-
<div class="row mt-2">
<div class="col-4">
<?= $form->field($model, 'sale_type')->dropDownList([0 => 'Типы продаж', 1 => 'Оффлайн',
])->label(false) ?>
</div>
</div>
+ <div class="row mt-3">
+ <div class="col-4">
+ <?= $form->field($model, 'statuses')->widget(Select2::class, [
+ 'data' => ArrayHelper::map($matrixTypes, 'id', 'name'),
+ 'language' => 'ru',
+ 'options' => ['placeholder' => 'Статусы...'],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ 'multiple' => true,
+ ]
+ ])->label(false) ?>
+ </div>
+
+ </div>
</div>
<div class="col-4">
<div class="row">
</div>
<?php foreach ($matrixTypes as $matrixType): ?>
<?php /** @var $matrixType MatrixType */ ?>
+ <?php if (empty($model->statuses) || in_array($matrixType->id, $model->statuses)): ?>
<div class="row">
<div class="col-1"></div>
<div class="col-1"><?= Html::a($matrixType->name, ['/bouquet/index' , 'matrix_type_id' => $matrixType->id], ['class' => 'btn btn-link']) ?></div>
<div class="col-2"><?= number_format($cost, 0, '.', ' ')?>р.</div>
<div class="col-2"><?= number_format($total == 0 ? 0 : $cost * 100.0 / $total, 0, '.', '')?>%</div>
</div>
+ <?php endif; ?>
<?php endforeach; ?>
<div class="row">
<div class="col-10"></div>