]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-433 Отчет по остаткам букетов для МП и причинам, если логика не проходит. Возможн...
authormarina <m.zozirova@gmail.com>
Thu, 3 Jul 2025 07:56:03 +0000 (10:56 +0300)
committermarina <m.zozirova@gmail.com>
Thu, 3 Jul 2025 07:56:03 +0000 (10:56 +0300)
erp24/actions/marketplace/ReportAction.php
erp24/views/marketplace/report.php

index 12214b56839ee2dfa16f2b71311c18f4d03fcafe..404173f37bade6a2e868c9c5d289a8c3bbd3b612 100644 (file)
@@ -16,9 +16,9 @@ class ReportAction extends Action
 {
     public function run()
     {
-        $storeId = Yii::$app->request->post('store', 'dbd70103-2c7b-11e9-9b87-c85b76f0e893');
-        $isValid = Yii::$app->request->post('is_valid');
-        $productId = Yii::$app->request->post('product_id');
+        $storeId = Yii::$app->request->get('store', Yii::$app->request->post('store', 'dbd70103-2c7b-11e9-9b87-c85b76f0e893'));
+        $isValid = Yii::$app->request->get('is_valid', Yii::$app->request->post('is_valid'));
+        $productId = Yii::$app->request->get('product_id', Yii::$app->request->post('product_id'));
 
         $subQuery = Products1c::find()
             ->alias('p1n')
@@ -62,7 +62,8 @@ class ReportAction extends Action
                 'p1n.name',
                 'p1n.articule',
                 new \yii\db\Expression("
-            (
+        CASE 
+            WHEN mep.id IS NULL OR p.price IS NULL OR mp_check.has_insufficient_quantity THEN
                 'Коэффициент: ' || COALESCE(mp.reminder_koef::text, '-') || E'\n' ||
                 concat_ws(
                     E'\n',
@@ -70,14 +71,16 @@ class ReportAction extends Action
                     CASE WHEN p.price IS NULL THEN 'Нет имеет цены' ELSE NULL END,
                     CASE WHEN mp_check.has_insufficient_quantity THEN mp_check.insuff_reason ELSE NULL END
                 )
-            ) AS reason
-        "),
+            ELSE
+                ''
+        END AS reason
+    "),
                 new \yii\db\Expression("
-            CASE 
-                WHEN mep.id IS NULL OR p.price IS NULL OR mp_check.has_insufficient_quantity THEN FALSE
-                ELSE TRUE
-            END AS is_valid
-        "),
+        CASE 
+            WHEN mep.id IS NULL OR p.price IS NULL OR mp_check.has_insufficient_quantity THEN FALSE
+            ELSE TRUE
+        END AS is_valid
+    "),
             ])
             ->where(['in', 'parent_id', $subQuery])
             ->andFilterWhere(['p1n.id' => $productId])
@@ -89,19 +92,16 @@ class ReportAction extends Action
             ->orderBy(['is_valid' => SORT_ASC])
             ->all();
 
-
         $dataProvider = new ArrayDataProvider([
             'allModels' => $products,
             'pagination' => ['pageSize' => 20],
         ]);
 
-
         return $this->controller->render('report', [
             'dataProvider' => $dataProvider,
             'isValid' => $isValid,
             'storeId' => $storeId,
             'productId' => $productId,
         ]);
-
     }
 }
\ No newline at end of file
index be7bfb9fb8d161ca490c01972ddcc9941924190e..6db472f35f4dd9e2a8abb0028fb60f33f3a2303d 100644 (file)
@@ -21,7 +21,7 @@ $this->params['breadcrumbs'][] = $this->title;
     <h1><?= Html::encode($this->title) ?></h1>
 
     <div class="filters">
-        <?php $form = ActiveForm::begin([]) ?>
+        <?php $form = ActiveForm::begin(['method' => 'get']) ?>
         <div class="row">
             <div class="col-md">
                 <?= Select2::widget([
@@ -29,7 +29,7 @@ $this->params['breadcrumbs'][] = $this->title;
                     'value' => $storeId,
                     'data' => CityStore::getAllActiveGuidName(),
                     'options' => [
-                            'required' => true,
+                        'required' => true,
                         'placeholder' => 'Выберите магазин',
                     ],
                     'pluginOptions' => [