From: Vladimir Fomichev Date: Tue, 20 May 2025 08:52:09 +0000 (+0300) Subject: Константы коэффициентов X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=62daf1f8093552cae2bd8e007e8d84cb9f00fc2d;p=erp24_rep%2Fyii-erp24%2F.git Константы коэффициентов --- 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}