->andWhere(['=', 'active', PricesDynamic::ACTIVE])
->one();
/* @var PricesDynamic $priceModel */
- return $priceModel && !$forceDefault ? $priceModel->price : $this->getSelfCost($data) * 1.3 * BouquetCompositionPrice::SURCHARGE_ASSEMBLY;
+ return $priceModel && !$forceDefault ? $priceModel->price : $this->getSelfCost($data) * (1 + BouquetCompositionPrice::SELF_COST_MARKUP / 100) * 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.3 * $selfCost) - 1) * 100 : 0;
+ return $selfCost > 0 ? ($this->getBouquetCost($region_id, $data, $forceDefault) / ((1 + BouquetCompositionPrice::SELF_COST_MARKUP / 100) * $selfCost) - 1) * 100 : 0;
}
// /**
*/
class BouquetCompositionPrice extends \yii\db\ActiveRecord
{
- const SELF_COST_MARKUP = 30;
+ const SELF_COST_MARKUP = 30; //Наценка над себестоимостью. По умолчанию 30%
const SURCHARGE_ASSEMBLY = 1.15; // Коэффициент наценки за сборку - 15%
/**
* {@inheritdoc}