]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-258] отсортировать продукты, открыть детали если выбраны
authorAlexander Smirnov <fredeom@mail.ru>
Thu, 5 Dec 2024 14:22:19 +0000 (17:22 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Thu, 5 Dec 2024 14:22:19 +0000 (17:22 +0300)
erp24/controllers/ShiftTransferController.php
erp24/views/shift-transfer/_transfer.php
erp24/views/shift-transfer/update.php

index f601b015d0c6e7a5725931b210006bc72b4ba56c..c852059672b2346212cd33e1bf204773114ab91a 100644 (file)
@@ -53,8 +53,9 @@ class ShiftTransferController extends Controller
 
     public function buildLoadDataShiftRemains($groups, $storeGuid) {
         $productsClass = ProductsClass::find()->select(['category_id'])->where(['tip' => $groups])->column();
-        $products = ArrayHelper::map(Products1c::find()->select(['id', 'name'])
-            ->where(['parent_id' => $productsClass])->orderBy(['name' => SORT_ASC, 'parent_id' => SORT_DESC])->all(), 'id', 'name');
+        $products = ArrayHelper::map(Products1c::find()->alias('p')->select(['id', 'name'])->leftJoin('products_class pc', 'pc.category_id = p.parent_id')
+            ->where(['parent_id' => $productsClass])->orderBy(['(CASE WHEN pc.tip = \'other_items\' THEN 1 ELSE 0 END)' => SORT_DESC
+                ,'name' => SORT_ASC])->all(), 'id', 'name');
         $balance = ArrayHelper::map(Balances::find()->select(['quantity', 'product_id'])
             ->where(['store_id' => $storeGuid])->all(), 'product_id', 'quantity');
         $productGuids = [];
index 52d3b1b53acf3834feab40d2c51ee489ade41f00..b07dbc9cd022f76608ff80b6a387246ca5a2e5f5 100644 (file)
@@ -25,13 +25,13 @@ echo \kartik\grid\GridView::widget([
                 return $products[$data['product_guid']] ?? '';
             },
         ],
-        [
-            'attribute'  => 'group_label',
-            'label' => 'Название группы',
-            'value' => function($data) {
-                return ProductsClass::getHints()[$data['group_label']] ?? '';
-            },
-        ],
+//        [
+//            'attribute'  => 'group_label',
+//            'label' => 'Название группы',
+//            'value' => function($data) {
+//                return ProductsClass::getHints()[$data['group_label']] ?? '';
+//            },
+//        ],
         [
             'attribute'  => 'retail_price',
             'label' => 'Розничная цена, руб',
index 1d00f908a9bda98f863fe0c9930cde917d614f3b..58ac35d1f0f9387b3e7c729db7d79a65eaea8095 100644 (file)
@@ -73,7 +73,7 @@ $this->registerCss('
             <?php $hints2 = [ProductsClass::HINT_OTHER_ITEMS => 'Номенклатура 1%'] ?>
             <?= $form->field($shiftTransfer, 'groups2')->checkboxList($hints2, ['checked' => 1, 'onclick' => '$("#acceptDiv").removeClass("d-none");']) ?>
         </div>
-        <details>
+        <details <?= !empty($shiftTransfer->groups2) ? 'open' : '' ?> >
             <summary>Другие</summary>
             <div class="col-9">
                 <?php $hints1 = ProductsClass::getHints(); unset($hints1['other_items']); ?>
@@ -90,7 +90,7 @@ $this->registerCss('
         <div class="col-12">
         <?= $form->field($shiftTransfer, 'shiftRemainsCopy')->widget(MultipleInput::class, [
             'min' => 0,
-            'max' => 100,
+            'max' => 2000,
             'columns' => [
                 [
                     'name'  => 'product_guid',
@@ -98,8 +98,6 @@ $this->registerCss('
                     'type'  => Select2::class,
                     'options' => [
                         'data' => $productGuids,
-//                        ArrayHelper::map(Products1c::find()->select(['id', 'name'])
-//                            ->where(['tip' => 'products'])->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'),
                     ],
                     'value' => function($data) {
                         return $data['product_guid'] ?? '';