From: fomichev Date: Mon, 19 May 2025 09:38:26 +0000 (+0300) Subject: Разметка констант X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=74b3442c1d8ab60ab929cd07086d4df5e9f89883;p=erp24_rep%2Fyii-erp24%2F.git Разметка констант --- diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index 155c7c2d..afa10159 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -26,6 +26,7 @@ use yii_app\records\WriteOffsErp; class StorePlanService { + const SURCHARGE_ASSEMBLY = 1.15; // Коэффициент наценки за сборку - 15% /** * @param int $month @@ -637,9 +638,9 @@ class StorePlanService if (CityStore::find()->where(['id' => $storeId])->one()->city_id == 1342) { - $region = 52; + $region = BouquetComposition::REGION_NN; } elseif (CityStore::find()->where(['id' => $storeId])->one()->city_id == 1) { - $region = 77; + $region = BouquetComposition::REGION_MSK; } else { $region = null; } @@ -869,7 +870,7 @@ class StorePlanService PricesDynamic::find() ->where(['product_id' => $productGuids]) ->andWhere(['active' => 1]) - ->andWhere(['region_id' => $storesParams[$storeForecast["type_sales_id"]] ?? 52]) + ->andWhere(['region_id' => $storesParams[$storeForecast["type_sales_id"]] ?? BouquetComposition::REGION_NN]) ->select(['price', 'product_id']) ->asArray() ->all(), @@ -881,7 +882,7 @@ class StorePlanService $species = ($productModel !== null) ? $productModel->species : 'Неизвестно'; $basePrice = isset($pricesData[$product['product_guid']]) ? $pricesData[$product['product_guid']] : 0; $rawCalculation = $basePrice * $product['count'] * $storeForecast["type_sales_value"]; - $productCost = round($rawCalculation * 1.15, 2); + $productCost = round($rawCalculation * self::SURCHARGE_ASSEMBLY, 2); if (!isset($resultData[$storeForecast["type_sales_id"]][$species][$storeForecast["type_sales"]])) { $resultData[$storeForecast["type_sales_id"]][$species][$storeForecast["type_sales"]] = 0; @@ -1005,9 +1006,9 @@ class StorePlanService } $regionId = $params['address_region'] ?: match ($storeCities[$sid] ?? null) { - 1342 => 52, - 1 => 77, - default => 52, + 1342 => BouquetComposition::REGION_NN, + 1 => BouquetComposition::REGION_MSK, + default => BouquetComposition::REGION_NN, }; $priceKey = $regionId . ':' . md5(implode(',', $productGuids)); @@ -1030,7 +1031,7 @@ class StorePlanService $species = $speciesCache[$guid]['species'] ?? 'Неизвестно'; $price = $prices[$guid] ?? 0; $raw = $price * $product['count'] * $typeSalesValue; - $cost = round($raw * 1.15, 2); + $cost = round($raw * self::SURCHARGE_ASSEMBLY, 2); $resultData[$sid][$species][$typeSales] = ($resultData[$sid][$species][$typeSales] ?? 0) + $cost; $debugData[$sid][$species][$typeSales][] = [