->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',
->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')",
->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",
$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'));