From 15d7b3e83fe2819a9bf07f80dc7d32b7321528a1 Mon Sep 17 00:00:00 2001 From: fomichev Date: Mon, 23 Jun 2025 10:13:22 +0300 Subject: [PATCH] =?utf8?q?=D0=A1=D0=BE=D1=80=D1=82=D0=B8=D1=80=D0=BE=D0=B2?= =?utf8?q?=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/CategoryPlanController.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/erp24/controllers/CategoryPlanController.php b/erp24/controllers/CategoryPlanController.php index 6e133592..710c819c 100644 --- a/erp24/controllers/CategoryPlanController.php +++ b/erp24/controllers/CategoryPlanController.php @@ -72,7 +72,7 @@ class CategoryPlanController extends Controller { ->leftJoin('products_1c_nomenclature p1cn', 'p1cn.id = sp.product_id') ->where(['between', 's.date', $date_start, $date_end]) ->andWhere(['order_id' => ['', '0']]) - ->andWhere(['not in', 'p1cn.category', ['', 'букет', 'сборка', 'сервис']]) + ->andWhere(['not in', 'p1cn.category', ['', 'сборка', 'сервис']]) ->andWhere(['s.store_id' => $model->store_id]) ->groupBy([ 's.store_id', @@ -118,7 +118,7 @@ class CategoryPlanController extends Controller { ->where(['between', 's.date', $date_start, $date_end]) ->andWhere(['not in', 'order_id', ['', '0']]) ->andWhere(['s.store_id' => $model->store_id]) - ->andWhere(['not in', 'p1cn.category', ['', 'букет', 'сборка', 'сервис']]) + ->andWhere(['not in', 'p1cn.category', ['', 'сборка', 'сервис']]) ->groupBy([ 's.store_id', "TO_CHAR(s.date, 'YYYY-MM')", @@ -151,7 +151,7 @@ class CategoryPlanController extends Controller { ->leftJoin('products_1c_nomenclature p1cn', 'p1cn.id = wop.product_id') ->where(['between', 'wo.date', $date_start, $date_end]) ->andWhere(['wo.type' => WriteOffsErp::WRITE_OFFS_TYPE_BRAK]) - ->andWhere(['not in', 'p1cn.category', ['', 'букет', 'сборка', 'сервис']]) + ->andWhere(['not in', 'p1cn.category', ['', 'сборка', 'сервис']]) ->andWhere(['wo.store_id' => $store_id]) ->groupBy([ "month", @@ -204,6 +204,18 @@ class CategoryPlanController extends Controller { $years [$year] = $year; } $stores = ArrayHelper::map(CityStore::find()->andWhere(['visible' => '1'])->all(), 'id', 'name'); + $order = [ + 'Срезка' => 1, + 'Сухоцветы' => 2, + 'Горшечные_растения' => 3, + 'Сопутствующие_товары' => 4, + 'Упаковка' => 5, + 'Матрица' => 6, + ]; + + usort($types, function ($a, $b) use ($order) { + return ($order[$a] ?? 999) <=> ($order[$b] ?? 999); + }); return $this->render('index', compact('model', 'years', 'stores', 'table', 'tableOnline', 'tableWriteOffs', 'types', 'salesWriteOffsPlan', 'isEditable', 'categoryPlan')); -- 2.39.5