]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-261] убрал себестоимость, штуки, добавил артикул
authorAlexander Smirnov <fredeom@mail.ru>
Mon, 16 Dec 2024 17:17:38 +0000 (20:17 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Mon, 16 Dec 2024 17:17:38 +0000 (20:17 +0300)
erp24/controllers/ShiftTransferController.php
erp24/views/shift-transfer/_transfer.php

index fb0cdf2b81136d3ba7434d2251e38b39c95f8be1..1812db842893a91d737a9c5bf12346d64a1cd4f3 100644 (file)
@@ -65,9 +65,9 @@ class ShiftTransferController extends Controller
     public function buildLoadDataShiftRemains($groups, $storeGuid, $normal = true)
     {
         $productsClass = ProductsClass::find()->select(['category_id'])->where(['tip' => $groups])->column();
-        $products = ArrayHelper::map(
+        $products =
             Products1c::find()->alias('p')
-                ->select(['p.id', 'p.name'])
+                ->select(['p.id', 'p.name', 'p.articule'])
                 ->leftJoin('products_class pc', 'pc.category_id = p.parent_id')
                 ->where(['parent_id' => $productsClass])
                 ->orderBy([
@@ -78,18 +78,17 @@ class ShiftTransferController extends Controller
                     // Обычная алфавитная сортировка
                     'p.name' => SORT_ASC,
                 ])
-                ->all(), 'id', 'name'
-        );
+                ->indexBy('id')->asArray()->all();
         $balance = ArrayHelper::map(Balances::find()->select(['quantity', 'product_id'])
             ->where(['store_id' => $storeGuid])->all(), 'product_id', 'quantity');
         $productGuids = [];
-        foreach ($products as $key => $name) {
+        foreach ($products as $key => $data) {
             if (isset($balance[$key]) && $balance[$key] > 0) {
-                $productGuids[$key] = $name . ' (' . $balance[$key] . ' шт.)';
+                $productGuids[$key] = $data['name'] . ' (арт. ' . $data['articule'] . ')';
             }
             else {
                 if (!$normal) {
-                    $productGuids[$key] = $name;
+                    $productGuids[$key] = $data['name'];
                 }
             }
         }
index bd721647256180081f3ba4b6a887af58942125ae..f69332c29e309b0b7be684935326558799cdf2a6 100644 (file)
@@ -17,7 +17,6 @@ echo \kartik\grid\GridView::widget([
         'allModels' => $shiftTransfer->shiftRemains,
         'pagination' => false,
     ]),
-//                'showFooter' => true,
     'columns' => [
         ['class' => 'yii\grid\SerialColumn'],
         [
@@ -25,10 +24,10 @@ echo \kartik\grid\GridView::widget([
             'label' => 'Продукт',
             'pageSummary' => 'Итого:',
             'value' => function($data) {
-                $products = ArrayHelper::map(Products1c::find()->select(['id', 'name'])
-                    ->where(['id' => $data['product_guid']])->all(), 'id', 'name');
+                $products = Products1c::find()->select(['id', 'name', 'articule'])
+                    ->where(['id' => $data['product_guid']])->indexBy('id')->asArray()->all();
 
-                return ($products[$data['product_guid']] ?? '') . ' (' . ($data['retail_price'] ?? '') . ' руб.)';
+                return ($products[$data['product_guid']]['name'] ?? '') . ' (арт.' . ($products[$data['product_guid']]['articule'] ?? '') . ')';
             },
         ],
         [
@@ -68,14 +67,14 @@ echo \kartik\grid\GridView::widget([
                 return number_format($data['remains_summ'] ?? '', 2, '.', ' ');
             },
         ],
-        [
-            'attribute'  => 'self_cost',
-            'label' => 'Себестоимость, руб',
-            'pageSummary' => true,
-            'value' => function($data) {
-                return number_format($data['self_cost'] ?? '', 2, '.', ' ');
-            },
-        ],
+//        [
+//            'attribute'  => 'self_cost',
+//            'label' => 'Себестоимость, руб',
+//            'pageSummary' => true,
+//            'value' => function($data) {
+//                return number_format($data['self_cost'] ?? '', 2, '.', ' ');
+//            },
+//        ],
     ],
     'layout' => '{items}',
     'showPageSummary' => true,