{
$region = CityStoreParams::find()
->where(['store_id' => $storeId])
- ->one()->address_region;
+ ->one()->address_region ?? null;
if (!$region) {
$cityId = CityStore::find()->select('city_id')->where(['id' => $storeId])->scalar();
])
->innerJoin('sales_products sp', 's.id = sp.check_id')
->innerJoin('products_1c_nomenclature p1c', 'p1c.id = sp.product_id')
+ ->leftJoin('products_1c p1', 'p1.id = sp.product_id')
->where(['s.store_id' => $storeId])
->andWhere(['between', 's.date', $dateStart, $dateEnd])
->andWhere(['order_id' => ['', '0']])
+ ->andWhere(['p1.components' => ''])
+ ->andWhere(['not in', 'p1c.category', ['', 'букет', 'сборка', 'сервис']])
->andFilterWhere(['p1c.category' => $category])
->andFilterWhere(['p1c.subcategory' => $subcategory])
->andFilterWhere(['p1c.species' => $species])