From 5905be161972ce3b8eb219a0043b93ea0cb2e1e4 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Wed, 12 Mar 2025 23:31:32 +0300 Subject: [PATCH] =?utf8?q?[ERP-370]=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?utf8?q?=D0=BA=D0=B0=20getPriceDynamic=20=D1=81=20=D0=BD=D0=BE=D0=B2?= =?utf8?q?=D1=8B=D0=BC=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80?= =?utf8?q?=D0=BE=D0=BC=20regionId?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/WriteOffs.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/erp24/records/WriteOffs.php b/erp24/records/WriteOffs.php index 97034630..ed50e996 100755 --- a/erp24/records/WriteOffs.php +++ b/erp24/records/WriteOffs.php @@ -430,15 +430,13 @@ class WriteOffs extends \yii\db\ActiveRecord return $writeOffProductsWithoutRetailPriceSetCounter; } - public static function getPriceDynamic($productId, $writeOffDate) + public static function getPriceDynamic($productId, $writeOffDate, $regionId = 52) { $query = PricesDynamic::find() ->select(['price']) - ->andWhere(['product_id' => $productId]) + ->where(['region_id' => $regionId, 'product_id' => $productId]) ->andWhere(['<=', 'date_from', $writeOffDate]) - ->andWhere(['>=', 'date_to', $writeOffDate]) - ->andWhere(['<=', 'date_from', $writeOffDate]) - ->andWhere(['>=', 'date_to', $writeOffDate]) + ->andWhere(['or', 'date_to IS NULL', ['>=', 'date_to', $writeOffDate]]) ; $pricesDynamic = $query->scalar(); -- 2.39.5