From: Vladimir Fomichev Date: Fri, 7 Nov 2025 09:21:45 +0000 (+0300) Subject: Добавление источников и чистка кода X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=23b01e4b3032f79e08fb55fc2dfdf4d1ba2cf3c4;p=erp24_rep%2Fyii-erp24%2F.git Добавление источников и чистка кода --- diff --git a/erp24/services/MarketplaceSalesMatchingService.php b/erp24/services/MarketplaceSalesMatchingService.php index 8815353b..85d5927e 100644 --- a/erp24/services/MarketplaceSalesMatchingService.php +++ b/erp24/services/MarketplaceSalesMatchingService.php @@ -489,8 +489,10 @@ class MarketplaceSalesMatchingService 's.operation', 'cc.marketplace_order_id', 'cc.is_marketplace', + 'COALESCE(cc.marketplace_name, mo.marketplace_name, \'Неизвестный МП\') as marketplace_name', ]) ->innerJoin('create_checks cc', 's.id = cc.guid') + ->leftJoin('marketplace_orders mo', 'cc.marketplace_order_id = mo.marketplace_order_id') ->andWhere(['cc.is_marketplace' => 1]) ->andWhere(['>=', 's.date', DateHelper::getDateTimeStartDay($dateFrom, true)]) ->andWhere(['<=', 's.date', DateHelper::getDateTimeEndDay($dateTo, true)]) @@ -532,6 +534,8 @@ class MarketplaceSalesMatchingService 'operation' => Sales::OPERATION_SALE, 'marketplace_order_id' => $order->marketplace_order_id, 'is_marketplace' => 1, + 'marketplace_name' => $order->marketplace_name ?? 'Неизвестный МП', + 'marketplace_id' => $order->marketplace_id, ]; } @@ -568,7 +572,7 @@ class MarketplaceSalesMatchingService } /** - * Группировка продаж МП по магазинам + * Группировка продаж МП по магазинам и маркетплейсам * * @param array $sales * @param string $source @@ -580,25 +584,40 @@ class MarketplaceSalesMatchingService foreach ($sales as $sale) { $storeId1c = $sale['store_id_1c']; + $marketplaceName = $sale['marketplace_name'] ?? 'Неизвестный МП'; + // Инициализируем структуру для магазина, если её нет if (!isset($grouped[$storeId1c])) { $grouped[$storeId1c] = [ 'store_id_1c' => $storeId1c, 'total_orders' => 0, 'total_summ' => 0, 'source' => $source, + 'marketplaces' => [], 'sales' => [], ]; } + // Инициализируем структуру для маркетплейса в этом магазине, если её нет + if (!isset($grouped[$storeId1c]['marketplaces'][$marketplaceName])) { + $grouped[$storeId1c]['marketplaces'][$marketplaceName] = [ + 'name' => $marketplaceName, + 'orders' => 0, + 'summ' => 0, + ]; + } + $saleAmount = $sale['summ'] - $sale['skidka']; // Применяем операцию (продажа или возврат) if ($sale['operation'] === Sales::OPERATION_SALE) { $grouped[$storeId1c]['total_summ'] += $saleAmount; $grouped[$storeId1c]['total_orders']++; + $grouped[$storeId1c]['marketplaces'][$marketplaceName]['summ'] += $saleAmount; + $grouped[$storeId1c]['marketplaces'][$marketplaceName]['orders']++; } elseif ($sale['operation'] === Sales::OPERATION_RETURN) { $grouped[$storeId1c]['total_summ'] -= $saleAmount; + $grouped[$storeId1c]['marketplaces'][$marketplaceName]['summ'] -= $saleAmount; } $grouped[$storeId1c]['sales'][] = $sale; diff --git a/erp24/views/dashboard/marketplace-sales-report.php b/erp24/views/dashboard/marketplace-sales-report.php index 97c257e9..9958b5dd 100644 --- a/erp24/views/dashboard/marketplace-sales-report.php +++ b/erp24/views/dashboard/marketplace-sales-report.php @@ -12,9 +12,19 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; +use yii\helpers\Url; + +$this->registerCssFile('/css/dashboard/sales.css'); ?> -

Отчет по заказам маркетплейсов и чекам продаж

+
+

Отчет по заказам маркетплейсов и чекам продаж

+ + + + Назад к продажам + +
'days-search-form-marketplace', @@ -340,72 +350,3 @@ use yii\widgets\ActiveForm; -registerCss(' -.marketplace-report-container { - padding: 15px; -} - -.accordion-button { - padding: 12px 15px; - font-size: 14px; -} - -.accordion-button:not(.collapsed) { - background-color: #f8f9fa; - color: #000; -} - -.card { - box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); -} - -.card-header { - font-weight: 500; - padding: 10px 15px; -} - -.table-hover tbody tr:hover { - background-color: #f5f5f5; -} - -.badge { - margin-left: 5px; - padding: 5px 8px; - font-size: 11px; -} - -.text-muted { - color: #999; -} - -.text-success { - color: #28a745; -} - -.text-danger { - color: #dc3545; -} - -.text-warning { - color: #ffc107; -} - -.text-info { - color: #17a2b8; -} - -h5 { - border-bottom: 2px solid #e0e0e0; - padding-bottom: 10px; - margin-bottom: 15px; -} - -h6 { - font-weight: 600; - color: #333; -} -'); -?> - diff --git a/erp24/views/dashboard/sales-detail.php b/erp24/views/dashboard/sales-detail.php index 9373ed57..52712ad5 100644 --- a/erp24/views/dashboard/sales-detail.php +++ b/erp24/views/dashboard/sales-detail.php @@ -13,9 +13,19 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; +use yii\helpers\Url; + +$this->registerCssFile('/css/dashboard/sales.css'); ?> -

Детальный просмотр продаж

+
+

Детальный просмотр продаж

+ + + + Назад к продажам + +
'days-search-form-detail', @@ -236,43 +246,3 @@ use yii\widgets\ActiveForm; -registerCss(' -.sales-detail-container { - padding: 15px; -} - -.accordion-button { - padding: 12px 15px; - font-size: 14px; -} - -.accordion-button:not(.collapsed) { - background-color: #f8f9fa; - color: #000; -} - -.table-hover tbody tr:hover { - background-color: #f5f5f5; -} - -.badge { - margin-left: 5px; - padding: 5px 8px; -} - -.text-muted { - color: #999; -} - -.text-success { - color: #28a745; -} - -.text-danger { - color: #dc3545; -} -'); -?> - diff --git a/erp24/views/dashboard/sales.php b/erp24/views/dashboard/sales.php index aa46d4c8..6d0c45b1 100755 --- a/erp24/views/dashboard/sales.php +++ b/erp24/views/dashboard/sales.php @@ -36,22 +36,10 @@ use yii_app\helpers\AppArrayHelper; +$this->registerCssFile('/css/dashboard/sales.css'); $this->registerCssFile('/azea/assets/plugins/time-picker/jquery.timepicker.css'); $this->registerJsFile('/azea/assets/plugins/time-picker/jquery.timepicker.js', ['position' => \yii\web\View::POS_END]); $this->registerJsFile('/js/dashboard/index.js', ['position' => \yii\web\View::POS_END]); -$this->registerCss(' -.ui-timepicker-wrapper { - z-index: 99999999; /* show timepicker over popup fix */ -} - -th, .line>td { - border-right: 1px solid #e8d5d5; - padding: 0px 4px 0 4px; -} -tr.line.bg-danger>td>a.btn { - border: 1px solid #e8d5d5; -} -'); ?>
@@ -325,6 +313,7 @@ echo" Магазин + Маркетплейс Количество заказов Сумма продаж Источник данных @@ -336,24 +325,37 @@ echo" $totalMpOrders = 0; foreach ($marketplaceSales as $storeId1c => $data): $storeName = $city_stores[$storeId1c] ?? 'Неизвестный магазин'; - $totalMpSumm += $data['total_summ']; - $totalMpOrders += $data['total_orders']; + $isFirstRow = true; + $rowCount = count($data['marketplaces']); + + foreach ($data['marketplaces'] as $marketplaceName => $mpData): + $totalMpSumm += $mpData['summ']; + $totalMpOrders += $mpData['orders']; ?> - - - руб - - - - - + + + + + + руб + + + + + + + - + - Итого + Итого руб diff --git a/erp24/web/css/dashboard/sales.css b/erp24/web/css/dashboard/sales.css new file mode 100644 index 00000000..ac758e5c --- /dev/null +++ b/erp24/web/css/dashboard/sales.css @@ -0,0 +1,115 @@ +/* Стили для страницы продаж (sales.php) */ +.ui-timepicker-wrapper { + z-index: 99999999; /* show timepicker over popup fix */ +} + +th, .line>td { + border-right: 1px solid #e8d5d5; + padding: 0px 4px 0 4px; +} + +tr.line.bg-danger>td>a.btn { + border: 1px solid #e8d5d5; +} + +/* Стили для детального просмотра продаж (sales-detail.php) */ +.sales-detail-container { + padding: 15px; +} + +.sales-detail-container .accordion-button { + padding: 12px 15px; + font-size: 14px; +} + +.sales-detail-container .accordion-button:not(.collapsed) { + background-color: #f8f9fa; + color: #000; +} + +.sales-detail-container .table-hover tbody tr:hover { + background-color: #f5f5f5; +} + +.sales-detail-container .badge { + margin-left: 5px; + padding: 5px 8px; +} + +.sales-detail-container .text-muted { + color: #999; +} + +.sales-detail-container .text-success { + color: #28a745; +} + +.sales-detail-container .text-danger { + color: #dc3545; +} + +/* Стили для отчета по маркетплейсам (marketplace-sales-report.php) */ +.marketplace-report-container { + padding: 15px; +} + +.marketplace-report-container .accordion-button { + padding: 12px 15px; + font-size: 14px; +} + +.marketplace-report-container .accordion-button:not(.collapsed) { + background-color: #f8f9fa; + color: #000; +} + +.marketplace-report-container .card { + box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); +} + +.marketplace-report-container .card-header { + font-weight: 500; + padding: 10px 15px; +} + +.marketplace-report-container .table-hover tbody tr:hover { + background-color: #f5f5f5; +} + +.marketplace-report-container .badge { + margin-left: 5px; + padding: 5px 8px; + font-size: 11px; +} + +.marketplace-report-container .text-muted { + color: #999; +} + +.marketplace-report-container .text-success { + color: #28a745; +} + +.marketplace-report-container .text-danger { + color: #dc3545; +} + +.marketplace-report-container .text-warning { + color: #ffc107; +} + +.marketplace-report-container .text-info { + color: #17a2b8; +} + +.marketplace-report-container h5 { + border-bottom: 2px solid #e0e0e0; + padding-bottom: 10px; + margin-bottom: 15px; +} + +.marketplace-report-container h6 { + font-weight: 600; + color: #333; +} +