]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Константы коэффициентов
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 20 May 2025 08:52:09 +0000 (11:52 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 20 May 2025 08:52:09 +0000 (11:52 +0300)
erp24/records/BouquetComposition.php
erp24/records/BouquetCompositionPrice.php

index c453d69ce2a99cb790d82a6495d52931168056c8..f0e1bc55c275c9c5ac9c92eb9526b46b813edd4b 100644 (file)
@@ -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;
     }
 
 //    /**
index c181c293e734cdcd6140690a94aa07326625bacd..3435a04c6394e0b82e4d7be787ddf95fdd1d18fa 100644 (file)
@@ -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}