From: Alexander Smirnov Date: Wed, 4 Sep 2024 09:06:02 +0000 (+0300) Subject: report/show_s добавлен matrix_per_day_percent X-Git-Tag: 1.4~9^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b0382ae613f418ae8d06b868376537cd9e787dcb;p=erp24_rep%2Fyii-erp24%2F.git report/show_s добавлен matrix_per_day_percent --- diff --git a/erp24/api3/core/services/ReportService.php b/erp24/api3/core/services/ReportService.php index 273d4711..496d88d9 100644 --- a/erp24/api3/core/services/ReportService.php +++ b/erp24/api3/core/services/ReportService.php @@ -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);