$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;
}
// 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()) {
->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) {
class StorePlanService
{
- const SURCHARGE_ASSEMBLY = 1.15; // Коэффициент наценки за сборку - 15%
-
/**
* @param int $month
* @param int $year
$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;
$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][] = [