From 1ba6f1e5c270fdb9474016b125ef6fb9ed1a29e0 Mon Sep 17 00:00:00 2001 From: fomichev Date: Mon, 19 May 2025 13:01:58 +0300 Subject: [PATCH] =?utf8?q?=20=D0=A0=D0=B0=D0=B7=D0=BC=D0=B5=D1=82=D0=BA?= =?utf8?q?=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/BouquetComposition.php | 12 ++++++------ erp24/records/BouquetCompositionPrice.php | 2 ++ erp24/services/StorePlanService.php | 6 ++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/erp24/records/BouquetComposition.php b/erp24/records/BouquetComposition.php index 873f9781..606d0120 100644 --- a/erp24/records/BouquetComposition.php +++ b/erp24/records/BouquetComposition.php @@ -438,8 +438,8 @@ class BouquetComposition extends ActiveRecord $costModel->bouquet_id = $this->id; $costModel->region_id = $region_id; $costModel->selfcost = $this->getSelfCost(); - $costModel->selfcost_markup = 30; - $costModel->selfcost_markup_price = 0.3 * $costModel->selfcost; + $costModel->selfcost_markup = BouquetCompositionPrice::SELF_COST_MARKUP; + $costModel->selfcost_markup_price = (BouquetCompositionPrice::SELF_COST_MARKUP * $costModel->selfcost) / 100; } $costModel->price = round($cost); $costModel->price_markup = $costModel->selfcost > 0 ? 100 * ($costModel->price / ($costModel->selfcost_markup_price + $costModel->selfcost) - 1) : 0; @@ -459,9 +459,9 @@ class BouquetComposition extends ActiveRecord } // TODO не понятно как задается региональность цены - точнее как она от региона зависит $costModel->selfcost = $this->getSelfCost($data); - $costModel->selfcost_markup = 30; - $costModel->selfcost_markup_price = 0.3 * $costModel->selfcost; - $costModel->price = round(1.15 * ($costModel->selfcost_markup_price + $costModel->selfcost)); + $costModel->selfcost_markup = BouquetCompositionPrice::SELF_COST_MARKUP; + $costModel->selfcost_markup_price = (BouquetCompositionPrice::SELF_COST_MARKUP * $costModel->selfcost) / 100; + $costModel->price = round(BouquetCompositionPrice::SURCHARGE_ASSEMBLY * ($costModel->selfcost_markup_price + $costModel->selfcost)); $costModel->price_markup = $costModel->selfcost > 0 ? 100 * ($costModel->price / ($costModel->selfcost_markup_price + $costModel->selfcost) - 1): 0; $costModel->save(); if ($costModel->getErrors()) { @@ -477,7 +477,7 @@ class BouquetComposition extends ActiveRecord ->andWhere(['=', 'active', PricesDynamic::ACTIVE]) ->one(); /* @var PricesDynamic $priceModel */ - return $priceModel && !$forceDefault ? $priceModel->price : $this->getSelfCost($data) * 1.3 * 1.15; + return $priceModel && !$forceDefault ? $priceModel->price : $this->getSelfCost($data) * 1.3 * BouquetCompositionPrice::SURCHARGE_ASSEMBLY; } public function getBouquetCostMarkup($region_id, $data = null, $forceDefault = false) { diff --git a/erp24/records/BouquetCompositionPrice.php b/erp24/records/BouquetCompositionPrice.php index a7f27c6c..ac5507d2 100644 --- a/erp24/records/BouquetCompositionPrice.php +++ b/erp24/records/BouquetCompositionPrice.php @@ -25,6 +25,8 @@ use yii\db\Expression; */ class BouquetCompositionPrice extends \yii\db\ActiveRecord { + const SELF_COST_MARKUP = 30; + const SURCHARGE_ASSEMBLY = 1.15; // Коэффициент наценки за сборку - 15% /** * {@inheritdoc} */ diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index afa10159..26165020 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -26,8 +26,6 @@ use yii_app\records\WriteOffsErp; class StorePlanService { - const SURCHARGE_ASSEMBLY = 1.15; // Коэффициент наценки за сборку - 15% - /** * @param int $month * @param int $year @@ -882,7 +880,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 * self::SURCHARGE_ASSEMBLY, 2); + $productCost = round($rawCalculation * BouquetCompositionPrice::SURCHARGE_ASSEMBLY, 2); if (!isset($resultData[$storeForecast["type_sales_id"]][$species][$storeForecast["type_sales"]])) { $resultData[$storeForecast["type_sales_id"]][$species][$storeForecast["type_sales"]] = 0; @@ -1031,7 +1029,7 @@ class StorePlanService $species = $speciesCache[$guid]['species'] ?? 'Неизвестно'; $price = $prices[$guid] ?? 0; $raw = $price * $product['count'] * $typeSalesValue; - $cost = round($raw * self::SURCHARGE_ASSEMBLY, 2); + $cost = round($raw * BouquetCompositionPrice::SURCHARGE_ASSEMBLY, 2); $resultData[$sid][$species][$typeSales] = ($resultData[$sid][$species][$typeSales] ?? 0) + $cost; $debugData[$sid][$species][$typeSales][] = [ -- 2.39.5