]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
report/show_s добавлен matrix_per_day_percent feature_smirnov_2024_09_04_report_show_s_matrix_per_day_percent origin/feature_smirnov_2024_09_04_report_show_s_matrix_per_day_percent
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 4 Sep 2024 09:06:02 +0000 (12:06 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 4 Sep 2024 09:06:02 +0000 (12:06 +0300)
erp24/api3/core/services/ReportService.php

index 273d47118cb7670797786a47899a12d00c09a394..496d88d9bbea8ba9ab1579c735d0f8223b5a6d5a 100644 (file)
@@ -324,6 +324,9 @@ class ReportService
                     if (isset($adminNames[$store->id])) {
                         foreach ($adminNames[$store->id] as &$adminRecord) {
                             $adminRecord["total_" . $spec . "_per_day"] = 0;
+                            if ($spec == 'matrix') {
+                                $adminRecord["total_" . $spec . "_per_day_percent"] = 0;
+                            }
                         }
                     }
                     foreach ($specificSales[$spec] as $specificSale) {
@@ -334,6 +337,9 @@ class ReportService
                             foreach ($adminNames[$store->id] as &$adminRecord) {
                                 if ($specificSale['admin_id'] == $adminRecord['id']) {
                                     $adminRecord["total_" . $spec . "_per_day"] = (int)$specificSale['total'];
+                                    if ($spec == 'matrix') {
+                                        $adminRecord["total_" . $spec . "_per_day_percent"] = $adminRecord["sale_total"] > 0 ? floor((int)$specificSale['total'] / $adminRecord["sale_total"]  * 100) : 0;
+                                    }
                                 }
                             }
                         }
@@ -370,6 +376,7 @@ class ReportService
                     "total_payroll_days" => $totalPayrollDays,
                     "total_payroll_month" => $totalPayrollMonth,
                     "total_matrix_per_day" => $totalMatrixPerDay,
+                    "total_matrix_per_day_percent" => $storeSaleTotal > 0 ? floor($totalMatrixPerDay / $storeSaleTotal * 100) : 0,
                     "total_wrap_per_day" => $totalWrapPerDay,
                     "total_services_per_day" => $totalServicePerDay,
                     "total_potted_per_day" => $totalPottedPerDay,
@@ -399,6 +406,7 @@ class ReportService
                 "sale_return_quantity" => $storeSaleReturnQuantityTotal,
                 "sale_return_total" => $storeSaleReturnTotalTotal,
                 "total_matrix_per_day" => $totalMatrixPerDayTotal,
+                "total_matrix_per_day_percent" => $storeSaleTotalTotal > 0 ? floor($totalMatrixPerDayTotal / $storeSaleTotalTotal * 100) : 0,
                 "total_wrap_per_day" => $totalWrapPerDayTotal,
                 "total_services_per_day" => $totalServicePerDayTotal,
                 "total_potted_per_day" => $totalPottedPerDayTotal,
@@ -738,6 +746,7 @@ class ReportService
                     "sale_return_quantity" => $storeSaleReturnQuantityTotal[$store_id] ?? 0,
                     "sale_return_total" => $storeSaleReturnTotalTotal[$store_id] ?? 0,
                     "total_matrix_per_day" => $totalMatrixPerDayTotal[$store_id] ?? 0,
+                    "total_matrix_per_day_percent" => ($storeSaleTotalTotal[$store_id] ?? 0) > 0 ? floor(($totalMatrixPerDayTotal[$store_id] ?? 0) / $storeSaleTotalTotal[$store_id] * 100) : 0,
                     "total_wrap_per_day" => $totalWrapPerDayTotal[$store_id] ?? 0,
                     "total_services_per_day" => $totalServicePerDayTotal[$store_id] ?? 0,
                     "total_potted_per_day" => $totalPottedPerDayTotal[$store_id] ?? 0,
@@ -767,6 +776,7 @@ class ReportService
                 $total["sale_return_quantity"] = ($total["sale_return_quantity"] ?? 0) + ($storeSaleReturnQuantityTotal[$store_id] ?? 0);
                 $total["sale_return_total"] = ($total["sale_return_total"] ?? 0) + ($storeSaleReturnTotalTotal[$store_id] ?? 0);
                 $total["total_matrix_per_day"] = ($total["total_matrix_per_day"] ?? 0) + ($totalMatrixPerDayTotal[$store_id] ?? 0);
+                $total["total_matrix_per_day_percent"] = $total["sale_total"] > 0 ? floor($total["total_matrix_per_day"] / $total["sale_total"] * 100) : 0;
                 $total["total_wrap_per_day"] = ($total["total_wrap_per_day"] ?? 0) + ($totalWrapPerDayTotal[$store_id] ?? 0);
                 $total["total_services_per_day"] = ($total["total_services_per_day"] ?? 0) + ($totalServicePerDayTotal[$store_id] ?? 0);
                 $total["total_potted_per_day"] = ($total["total_potted_per_day"] ?? 0) + ($totalPottedPerDayTotal[$store_id] ?? 0);