From 62daf1f8093552cae2bd8e007e8d84cb9f00fc2d Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Tue, 20 May 2025 11:52:09 +0300 Subject: [PATCH] =?utf8?q?=D0=9A=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82?= =?utf8?q?=D1=8B=20=D0=BA=D0=BE=D1=8D=D1=84=D1=84=D0=B8=D1=86=D0=B8=D0=B5?= =?utf8?q?=D0=BD=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/BouquetComposition.php | 8 ++++---- erp24/records/BouquetCompositionPrice.php | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/erp24/records/BouquetComposition.php b/erp24/records/BouquetComposition.php index c453d69c..f0e1bc55 100644 --- a/erp24/records/BouquetComposition.php +++ b/erp24/records/BouquetComposition.php @@ -439,7 +439,7 @@ class BouquetComposition extends ActiveRecord $costModel->region_id = $region_id; $costModel->selfcost = $this->getSelfCost(); $costModel->selfcost_markup = BouquetCompositionPrice::SELF_COST_MARKUP; - $costModel->selfcost_markup_price = (BouquetCompositionPrice::SELF_COST_MARKUP * $costModel->selfcost) / 100; + $costModel->selfcost_markup_price = BouquetCompositionPrice::SELF_COST_MARKUP_PRICE_COEF * $costModel->selfcost; } $costModel->price = round($cost); $costModel->price_markup = $costModel->selfcost > 0 ? 100 * ($costModel->price / ($costModel->selfcost_markup_price + $costModel->selfcost) - 1) : 0; @@ -460,7 +460,7 @@ class BouquetComposition extends ActiveRecord // TODO не понятно как задается региональность цены - точнее как она от региона зависит $costModel->selfcost = $this->getSelfCost($data); $costModel->selfcost_markup = BouquetCompositionPrice::SELF_COST_MARKUP; - $costModel->selfcost_markup_price = (BouquetCompositionPrice::SELF_COST_MARKUP * $costModel->selfcost) / 100; + $costModel->selfcost_markup_price = BouquetCompositionPrice::SELF_COST_MARKUP_PRICE_COEF * $costModel->selfcost; $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(); @@ -477,12 +477,12 @@ class BouquetComposition extends ActiveRecord ->andWhere(['=', 'active', PricesDynamic::ACTIVE]) ->one(); /* @var PricesDynamic $priceModel */ - return $priceModel && !$forceDefault ? $priceModel->price : $this->getSelfCost($data) * (1 + BouquetCompositionPrice::SELF_COST_MARKUP / 100) * BouquetCompositionPrice::SURCHARGE_ASSEMBLY; + return $priceModel && !$forceDefault ? $priceModel->price : $this->getSelfCost($data) * BouquetCompositionPrice::SELF_COST_PRICE_COEF * BouquetCompositionPrice::SURCHARGE_ASSEMBLY; } public function getBouquetCostMarkup($region_id, $data = null, $forceDefault = false) { $selfCost = $this->getSelfCost($data); - return $selfCost > 0 ? ($this->getBouquetCost($region_id, $data, $forceDefault) / ((1 + BouquetCompositionPrice::SELF_COST_MARKUP / 100) * $selfCost) - 1) * 100 : 0; + return $selfCost > 0 ? ($this->getBouquetCost($region_id, $data, $forceDefault) / (BouquetCompositionPrice::SELF_COST_PRICE_COEF * $selfCost) - 1) * 100 : 0; } // /** diff --git a/erp24/records/BouquetCompositionPrice.php b/erp24/records/BouquetCompositionPrice.php index c181c293..3435a04c 100644 --- a/erp24/records/BouquetCompositionPrice.php +++ b/erp24/records/BouquetCompositionPrice.php @@ -26,6 +26,8 @@ use yii\db\Expression; class BouquetCompositionPrice extends \yii\db\ActiveRecord { const SELF_COST_MARKUP = 30; //Наценка над себестоимостью. По умолчанию 30% + const SELF_COST_MARKUP_PRICE_COEF = 0.3; //Наценка над себестоимостью коэффициент + const SELF_COST_PRICE_COEF = 1.3; //Наценка над себестоимостью коэффициент const SURCHARGE_ASSEMBLY = 1.15; // Коэффициент наценки за сборку - 15% /** * {@inheritdoc} -- 2.39.5