public function actionMonthGoalForecast()
{
$request = Yii::$app->request;
- $post = $request->post();
- $month = $post['DynamicModel']['month'] ?? 5;
- $year = $post['DynamicModel']['year'] ?? 2025;
- $storeId = $post['DynamicModel']['storeId'] ?? 2;
- $matrix = $post['DynamicModel']['matrix'] ?? [];
+ $params = array_merge(
+ $request->get('DynamicModel', []),
+ $request->post('DynamicModel', [])
+ );
+
+ $month = $params['month'] ?? 5;
+ $year = $params['year'] ?? 2025;
+ $storeId = $params['storeId'] ?? 2;
+ $matrix = $params['matrix'] ?? [];
$model = DynamicModel::validateData(
- ['month' => $month, 'year' => $year, 'storeId' => $storeId, 'matrix' => $matrix],
+ ['month'=>$month, 'year'=>$year, 'storeId'=>$storeId, 'matrix'=>$matrix],
[
- ['matrix', 'each', 'rule' => ['string']],
- [['month', 'year', 'storeId'], 'required'],
- ['month', 'integer', 'min' => 1, 'max' => 12],
- ['storeId', 'integer', 'min' => 1, 'max' => 100],
- ['year', 'integer', 'min' => 2000, 'max' => 2100],
+ ['matrix', 'each', 'rule'=>['string']],
+ [['month','year','storeId'], 'required'],
+ ['month','integer','min'=>1,'max'=>12],
+ ['storeId','integer','min'=>1],
+ ['year','integer','min'=>2000,'max'=>2100],
]
);
- if ($request->isPost && $model->validate()) {
- $month = $model->month;
- $year = $model->year;
- $storeId = $model->storeId;
- } else {
- $model->month = $month;
- $model->year = $year;
- $model->storeId = $storeId;
- }
+ $model->month = $month;
+ $model->year = $year;
+ $model->storeId = $storeId;
+ $model->matrix = $matrix;
$result = StorePlanService::getBouquetSpiecesMonthGoalFromForecast($month, $year, $storeId, $matrix);
-//var_dump($result); die();
+
$stores = CityStore::find()
->select(['id', 'name'])
->where(['visible' => CityStore::IS_VISIBLE])
<?php
-
+use kartik\export\ExportMenu;
use kartik\grid\GridView;
-use kartik\select2\Select2;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
-use kartik\export\ExportMenu;
+
use yii\data\ArrayDataProvider;
/* @var $model yii\base\DynamicModel */
<?php $form = ActiveForm::begin([
'action' => Url::to(['bouquet/month-goal-forecast']),
- 'method' => 'post',
+ 'method' => 'get',
]); ?>
<?= $form->field($model, 'month')->input('number')->label('Месяц') ?>
['attribute' => 'raw_calculation', 'label' => 'Базовый расчёт'],
['attribute' => 'rounded', 'label' => 'С наценкой за сборку'],
],
-// 'export' => [
-// 'fontAwesome' => true
-// ],
-// 'exportConfig' => [
-// 'html' => [],
-// 'csv' => [
-// 'label' => Yii::t('kvgrid', 'CSV'),
-// 'icon' => '',
-// 'iconOptions' => ['class' => 'text-primary'],
-// 'showHeader' => true,
-// 'showPageSummary' => true,
-// 'showFooter' => true,
-// 'showCaption' => true,
-// 'filename' => Yii::t('kvgrid', 'grid-export'),
-// 'alertMsg' => Yii::t('kvgrid', 'The CSV export file will be generated for download.'),
-// 'options' => ['title' => Yii::t('kvgrid', 'Comma Separated Values')],
-// 'mime' => 'application/csv',
-// 'config' => [
-// 'colDelimiter' => ",",
-// 'rowDelimiter' => "\r\n",
-// ],
-// ],
-// 'txt' => [],
-// 'xls' => [],
-// 'pdf' => [],
-// 'json' => [],
-// ],
-// 'panel' => [
-// 'after' => '',
-// 'heading' => Html::encode($storesMap[$storeId] ?? $storeId) ,
-// 'type' => 'primary',
-// 'before' => '',
-// ],
+
]) ?>
<?php endforeach; ?>
<?php endforeach; ?>
'allModels' => $flattenedDebug,
'pagination' => false,
]);
+ $fullDataProvider = clone $debugProvider;
+ $fullDataProvider->pagination = false;
$gridColumns = [
['attribute' => 'month', 'label' => 'Месяц'],
['attribute' => 'year', 'label' => 'Год'],
['attribute' => 'rounded', 'label' => 'С наценкой за сборку'],
];
$exportMenu = ExportMenu::widget([
- 'dataProvider' => $debugProvider,
+ 'dataProvider' => $fullDataProvider,
'columns' => $gridColumns,
'exportConfig' => [
ExportMenu::FORMAT_EXCEL => [
echo GridView::widget([
'dataProvider' => $debugProvider,
'columns' => $gridColumns,
-// 'exportConfig' => [
-// GridView::CSV => [
-// 'label' => 'CSV',
-// 'icon' => 'glyphicon glyphicon-download',
-// 'iconOptions' => ['class' => 'text-primary'],
-// 'showHeader' => true,
-// 'showPageSummary' => false,
-// 'showFooter' => false,
-// 'filename' => 'debug-export-' . date('Y-m-d_H-i-s'),
-// 'alertMsg' => 'CSV файл будет загружен в ближайшее время.',
-// 'options' => ['title' => 'CSV'],
-// 'mime' => 'application/csv',
-// 'config' => [
-// 'colDelimiter' => ",",
-// 'rowDelimiter' => "\r\n",
-// ],
-// ],
-// // Другие типы экспорта можно отключить, если не нужны:
-// GridView::HTML => false,
-// GridView::TEXT => false,
-// GridView::EXCEL => false,
-// GridView::PDF => false,
-// GridView::JSON => false,
-// ],
-// 'toolbar' => [
-// '{export}',
-// '{toggleData}',
-// ],
-// 'panel' => [
-// 'heading' => 'Детальный разбор (Debug) по всем магазинам',
-// 'type' => GridView::TYPE_PRIMARY,
-// ],
]);
?>