From: fomichev Date: Mon, 23 Jun 2025 07:13:22 +0000 (+0300) Subject: Сортировка X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=15d7b3e83fe2819a9bf07f80dc7d32b7321528a1;p=erp24_rep%2Fyii-erp24%2F.git Сортировка --- 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'));