Yii::$app->session->setFlash('error', 'Не установлен план для магазина');
}
+ if (!empty($salesWriteOffsPlan->online_sales_marketplace_plan)) {
+ $onlineMarketPlannedSales = self::calculatePlannedSales($tableOnline, $salesWriteOffsPlan->online_sales_marketplace_plan);
+ } else {
+ $onlineMarketPlannedSales = [];
+ Yii::$app->session->setFlash('error', 'Не установлен план для магазина');
+ }
+
$eit = ExportImportTable::find()->where(['entity' => 'city_store', 'export_id' => 1, 'entity_id' => $model->store_id])->one();
$store_id = $eit->export_val ?? '';
$categoryPlanNew->category = $type;
$categoryPlanNew->offline = $offlinePlannedSales[$model->store_id][$type] ?? 0;
$categoryPlanNew->internet_shop = $onlinePlannedSales[$model->store_id][$type] ?? 0;
- $categoryPlanNew->marketplace = 0;
+ $categoryPlanNew->marketplace = $onlineMarketPlannedSales[$model->store_id][$type] ?? 0;
$categoryPlanNew->write_offs = $plannedWriteOffs[$model->store_id][$type] ?? 0;
$categoryPlanNew->created_at = date('Y-m-d HH:i:s');
$categoryPlanNew->updated_at = date('Y-m-d HH:i:s');
<table id="categoryPlan" style="width:100%">
<?php
$offline_sale = $salesWriteOffsPlan->offline_sales_plan;
- $online_sale = $salesWriteOffsPlan->online_sales_shop_plan;
+ $online_sale = $salesWriteOffsPlan->online_sales_shop_plan + $salesWriteOffsPlan->online_sales_marketplace_plan;
$write_offs = $salesWriteOffsPlan->write_offs_plan;
?>
<thead>
<td data-p1-<?= $type ?> data-offline="<?= $offline_sale ?>" data-offline-type="<?= $type ?>"><?= Html::textInput('p1', number_format($p1, 2, '.', ''), ['type' => 'number', 'style' => 'max-width: 80px;', 'readonly' => !$isEditable, 'onchange' => 'editProcent(this);']) ?>%</td>
<td data-offline-type="<?= $type ?>"><?= Html::textInput('offline', number_format($categoryPlan[$type]['offline'], 0, '.', ''), ['type' => 'number', 'readonly' => true, ]) ?></td>
<?php
- $data2 = $categoryPlan[$type]['internet_shop'];
+ $data2 = $categoryPlan[$type]['internet_shop'] + $categoryPlan[$type]['marketplace'];
$p2 = $online_sale <= 0 ? 0 : round( $data2 / $online_sale, 4) * 100;
?>
<td data-p2-<?= $type ?> data-online="<?= $online_sale ?>" data-online-type="<?= $type ?>"><?= Html::textInput('p2', number_format($p2, 2, '.', ''), ['type' => 'number', 'style' => 'max-width: 80px;', 'readonly' => !$isEditable, 'onchange' => 'editProcent(this);']) ?>%</td>
- <td data-online-type="<?= $type ?>"><?= Html::textInput('internet_shop', number_format($categoryPlan[$type]['internet_shop'], 0, '.', ''), ['type' => 'number', 'readonly' => true, ]) ?></td>
+ <td data-online-type="<?= $type ?>"><?= Html::textInput('internet_shop', number_format($data2, 0, '.', ''), ['type' => 'number', 'readonly' => true, ]) ?></td>
<?php //<td></td><td></td> ?>
<?php
$data4 = $categoryPlan[$type]['write_offs'];