]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавление фильтрации по созданным чекам
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 22 Oct 2025 13:10:57 +0000 (16:10 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 22 Oct 2025 13:10:57 +0000 (16:10 +0300)
erp24/services/SalesService.php

index f31f17227043337e1164f3285eca019bf75b762b..3dc0e94a2140f513adece017e8375e3a03fe5977 100755 (executable)
@@ -110,10 +110,15 @@ class SalesService
 
         if (!$salesTotal) {
             if ($salesDelivery) {
-                $query->andFilterWhere(['or',
-                    ['not in', 's.order_id', ['', '0']],
-                    ['not in', 'sc.order_id', ['', '0']]
-                ]);
+                $query->leftJoin('create_checks cc', 'CAST(cc.order_id AS TEXT) = s.order_id')
+                    ->andFilterWhere(['or',
+                        ['not in', 's.order_id', ['', '0']],
+                        ['not in', 'sc.order_id', ['', '0']]
+                    ])
+                    ->andWhere(['or',
+                        ['cc.date' => null],
+                        ['DATE(cc.date)' => new \yii\db\Expression('DATE(s.date)')]
+                    ]);
             } else {
                 $query->andWhere([
                     'and',