$connection = Yii::$app->getDb();
if ($dateFrom > '2022-12-07') {
- $command = $connection->createCommand("
+ if ($dateFrom > '2025-01-01') {
+ $command = $connection->createCommand("
SELECT
DISTINCT (sales.id),
sales.seller_id,
sales.seller_id IN ('$adminGuid')
AND
sales.id = p.check_id
- AND (
- sales.order_id=''
- OR
- sales.order_id='0'
- )
AND
p.product_id IN (
SELECT
sales.date ASC
",
- [
- ':date_from' => DateHelper::getDateTimeStartDay($dateFrom, $dateTimeStartDay, $adminId),
- ':date_to' => DateHelper::getDateTimeEndDay($dateTo, $dateTimeEndDay, $adminId),
- ]
- );
- } else if ($dateFrom > '2025-01-01') {
- $command = $connection->createCommand("
+ [
+ ':date_from' => DateHelper::getDateTimeStartDay($dateFrom, $dateTimeStartDay, $adminId),
+ ':date_to' => DateHelper::getDateTimeEndDay($dateTo, $dateTimeEndDay, $adminId),
+ ]);
+ } else {
+ $command = $connection->createCommand("
SELECT
DISTINCT (sales.id),
sales.seller_id,
sales.seller_id IN ('$adminGuid')
AND
sales.id = p.check_id
+ AND (
+ sales.order_id=''
+ OR
+ sales.order_id='0'
+ )
AND
p.product_id IN (
SELECT
sales.date ASC
",
- [
- ':date_from' => DateHelper::getDateTimeStartDay($dateFrom, $dateTimeStartDay, $adminId),
- ':date_to' => DateHelper::getDateTimeEndDay($dateTo, $dateTimeEndDay, $adminId),
- ]);
+ [
+ ':date_from' => DateHelper::getDateTimeStartDay($dateFrom, $dateTimeStartDay, $adminId),
+ ':date_to' => DateHelper::getDateTimeEndDay($dateTo, $dateTimeEndDay, $adminId),
+ ]
+ );
+ }
+
} else {
$command = $connection->createCommand("
SELECT