From 558f93faae971a63f244e99daa6b33af49cc9bd7 Mon Sep 17 00:00:00 2001 From: fomichev Date: Fri, 24 Jan 2025 16:49:46 +0300 Subject: [PATCH] =?utf8?q?=D0=9E=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20=D1=81=20?= =?utf8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B5=D0=B9=20id=20?= =?utf8?q?=D1=81=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B5=D0=B9?= =?utf8?q?=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE=20?= =?utf8?q?=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api3/core/services/ReportService.php | 245 +++++++++++---------- 1 file changed, 126 insertions(+), 119 deletions(-) diff --git a/erp24/api3/core/services/ReportService.php b/erp24/api3/core/services/ReportService.php index 86462fdf..0f825c64 100644 --- a/erp24/api3/core/services/ReportService.php +++ b/erp24/api3/core/services/ReportService.php @@ -836,7 +836,9 @@ class ReportService $store_guids = []; foreach ($data->stores as $store_id) { - $store_guids[$store_id] = $eitStores[$store_id]['export_val']; + if (!empty($eitStores[$store_id])) { + $store_guids[$store_id] = $eitStores[$store_id]['export_val']; + } } $cond = ['or']; @@ -1090,45 +1092,48 @@ class ReportService $storeSaleNewBonusCount = []; $storeSaleRepeatBonusCount = []; foreach ($data->stores as $store_id) { - $storeVisitorsQuantity[$store_id] = (int)($storeVisitors[$store_id]['counter'] ?? 0); - $storeSaleQuantity[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['cnt'] ?? 0); - $storeSaleTotal[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['total'] ?? 0); - $storeSaleReturnQuantity[$store_id] = (int)($salesReturn[$eitStores[$store_id]['export_val']]['cnt'] ?? 0); - $storeSaleReturnTotal[$store_id] = (int)($salesReturn[$eitStores[$store_id]['export_val']]['total'] ?? 0); - $storeSaleBonusCount[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['bonusUserCount'] ?? 0); - $storeSaleNewBonusCount[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['newBonusUserCount'] ?? 0); - $storeSaleRepeatBonusCount[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['repeatBonusUserCount'] ?? 0); - - $storeVisitorsQuantityTotal[$store_id] = ($storeVisitorsQuantityTotal[$store_id] ?? 0) + $storeVisitorsQuantity[$store_id]; - $storeSaleQuantityTotal[$store_id] = ($storeSaleQuantityTotal[$store_id] ?? 0) + $storeSaleQuantity[$store_id]; - $storeSaleTotalTotal[$store_id] = ($storeSaleTotalTotal[$store_id] ?? 0) + $storeSaleTotal[$store_id]; - $storeSaleReturnQuantityTotal[$store_id] = ($storeSaleReturnQuantityTotal[$store_id] ?? 0) + $storeSaleReturnQuantity[$store_id]; - $storeSaleReturnTotalTotal[$store_id] = ($storeSaleReturnTotalTotal[$store_id] ?? 0) + $storeSaleReturnTotal[$store_id]; - $storeSaleBonusCountTotal[$store_id] = ($storeSaleBonusCountTotal[$store_id] ?? 0) + $storeSaleBonusCount[$store_id]; - $storeSaleNewBonusCountTotal[$store_id] = ($storeSaleNewBonusCountTotal[$store_id] ?? 0) + $storeSaleNewBonusCount[$store_id]; - $storeSaleRepeatBonusCountTotal[$store_id] = ($storeSaleRepeatBonusCountTotal[$store_id] ?? 0) + $storeSaleRepeatBonusCount[$store_id]; - - $totalWriteOffsPerDateTotal[$store_id] = ($totalWriteOffsPerDateTotal[$store_id] ?? 0) + (int)($writeOffs[$store_guids[$store_id]]["total"] ?? 0); - $totalPayrollDaysTotal[$store_id] = ($totalPayrollDaysTotal[$store_id] ?? 0) + (int)($adminPayrollDays[$store_id]['total'] ?? 0); + if (!empty($eitStores[$store_id])){ + $storeVisitorsQuantity[$store_id] = (int)($storeVisitors[$store_id]['counter'] ?? 0); + $storeSaleQuantity[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['cnt'] ?? 0); + $storeSaleTotal[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['total'] ?? 0); + $storeSaleReturnQuantity[$store_id] = (int)($salesReturn[$eitStores[$store_id]['export_val']]['cnt'] ?? 0); + $storeSaleReturnTotal[$store_id] = (int)($salesReturn[$eitStores[$store_id]['export_val']]['total'] ?? 0); + $storeSaleBonusCount[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['bonusUserCount'] ?? 0); + $storeSaleNewBonusCount[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['newBonusUserCount'] ?? 0); + $storeSaleRepeatBonusCount[$store_id] = (int)($sales[$eitStores[$store_id]['export_val']]['repeatBonusUserCount'] ?? 0); - $totalSpecificPerDay = []; - foreach (['matrix', 'wrap', 'services', 'potted'] as $spec) { - $totalSpecificPerDay[$store_id][$spec] = 0.0; - if (isset($specificSales[$spec][$store_id])) { - $totalSpecificPerDay[$store_id][$spec] += (float)$specificSales[$spec][$store_id]['total']; + $storeVisitorsQuantityTotal[$store_id] = ($storeVisitorsQuantityTotal[$store_id] ?? 0) + $storeVisitorsQuantity[$store_id]; + $storeSaleQuantityTotal[$store_id] = ($storeSaleQuantityTotal[$store_id] ?? 0) + $storeSaleQuantity[$store_id]; + $storeSaleTotalTotal[$store_id] = ($storeSaleTotalTotal[$store_id] ?? 0) + $storeSaleTotal[$store_id]; + $storeSaleReturnQuantityTotal[$store_id] = ($storeSaleReturnQuantityTotal[$store_id] ?? 0) + $storeSaleReturnQuantity[$store_id]; + $storeSaleReturnTotalTotal[$store_id] = ($storeSaleReturnTotalTotal[$store_id] ?? 0) + $storeSaleReturnTotal[$store_id]; + $storeSaleBonusCountTotal[$store_id] = ($storeSaleBonusCountTotal[$store_id] ?? 0) + $storeSaleBonusCount[$store_id]; + $storeSaleNewBonusCountTotal[$store_id] = ($storeSaleNewBonusCountTotal[$store_id] ?? 0) + $storeSaleNewBonusCount[$store_id]; + $storeSaleRepeatBonusCountTotal[$store_id] = ($storeSaleRepeatBonusCountTotal[$store_id] ?? 0) + $storeSaleRepeatBonusCount[$store_id]; + + $totalWriteOffsPerDateTotal[$store_id] = ($totalWriteOffsPerDateTotal[$store_id] ?? 0) + (int)($writeOffs[$store_guids[$store_id]]["total"] ?? 0); + $totalPayrollDaysTotal[$store_id] = ($totalPayrollDaysTotal[$store_id] ?? 0) + (int)($adminPayrollDays[$store_id]['total'] ?? 0); + + $totalSpecificPerDay = []; + foreach (['matrix', 'wrap', 'services', 'potted'] as $spec) { + $totalSpecificPerDay[$store_id][$spec] = 0.0; + if (isset($specificSales[$spec][$store_id])) { + $totalSpecificPerDay[$store_id][$spec] += (float)$specificSales[$spec][$store_id]['total']; + } + //Yii::warning($totalSpecificPerDay[$store_id][$spec], 'specificSales'); } - Yii::warning($totalSpecificPerDay[$store_id][$spec], 'specificSales'); - } - $totalMatrixPerDay[$store_id] = $totalSpecificPerDay[$store_id]['matrix']; - $totalWrapPerDay[$store_id] = $totalSpecificPerDay[$store_id]['wrap']; - $totalServicePerDay[$store_id] = $totalSpecificPerDay[$store_id]['services']; - $totalPottedPerDay[$store_id] = $totalSpecificPerDay[$store_id]['potted']; + $totalMatrixPerDay[$store_id] = $totalSpecificPerDay[$store_id]['matrix']; + $totalWrapPerDay[$store_id] = $totalSpecificPerDay[$store_id]['wrap']; + $totalServicePerDay[$store_id] = $totalSpecificPerDay[$store_id]['services']; + $totalPottedPerDay[$store_id] = $totalSpecificPerDay[$store_id]['potted']; + + $totalMatrixPerDayTotal[$store_id] = ($totalMatrixPerDayTotal[$store_id] ?? 0) + $totalMatrixPerDay[$store_id]; + $totalWrapPerDayTotal[$store_id] = ($totalWrapPerDayTotal[$store_id] ?? 0) + $totalWrapPerDay[$store_id]; + $totalServicePerDayTotal[$store_id] = ($totalServicePerDayTotal[$store_id] ?? 0) + $totalServicePerDay[$store_id]; + $totalPottedPerDayTotal[$store_id] = ($totalPottedPerDayTotal[$store_id] ?? 0) + $totalPottedPerDay[$store_id]; + } - $totalMatrixPerDayTotal[$store_id] = ($totalMatrixPerDayTotal[$store_id] ?? 0) + $totalMatrixPerDay[$store_id]; - $totalWrapPerDayTotal[$store_id] = ($totalWrapPerDayTotal[$store_id] ?? 0) + $totalWrapPerDay[$store_id]; - $totalServicePerDayTotal[$store_id] = ($totalServicePerDayTotal[$store_id] ?? 0) + $totalServicePerDay[$store_id]; - $totalPottedPerDayTotal[$store_id] = ($totalPottedPerDayTotal[$store_id] ?? 0) + $totalPottedPerDay[$store_id]; } @@ -1136,91 +1141,93 @@ class ReportService $total = []; foreach ($data->stores as $store_id) { - $store = [ - "sale_month_total" => ($salesMonth[$store_guids[$store_id]]["total"] ?? 0), - "sale_total" => $storeSaleTotalTotal[$store_id] ?? 0, - "sale_quantity" => $storeSaleQuantityTotal[$store_id] ?? 0, - "sale_avg" => $storeSaleQuantityTotal[$store_id] ?? 0 > 0 ? floor( - $storeSaleTotalTotal[$store_id] / $storeSaleQuantityTotal[$store_id] - ) : 0, - "total_write_offs_per_date" => $totalWriteOffsPerDateTotal[$store_id] ?? 0, - "total_write_offs_per_date_percent" => $storeSaleTotalTotal[$store_id] ?? 0 > 0 ? floor( - $totalWriteOffsPerDateTotal[$store_id] / $storeSaleTotalTotal[$store_id] * 100 - ) : 0, - "total_write_offs_per_month" => (int)($writeOffsMonth[$store_guids[$store_id]]["total"] ?? 0), - //$totalWriteOffsPerMonthTotal[$store_id] ?? 0, + if (!empty($eitStores[$store_id])){ + $store = [ + "sale_month_total" => ($salesMonth[$store_guids[$store_id]]["total"] ?? 0), + "sale_total" => $storeSaleTotalTotal[$store_id] ?? 0, + "sale_quantity" => $storeSaleQuantityTotal[$store_id] ?? 0, + "sale_avg" => $storeSaleQuantityTotal[$store_id] ?? 0 > 0 ? floor( + $storeSaleTotalTotal[$store_id] / $storeSaleQuantityTotal[$store_id] + ) : 0, + "total_write_offs_per_date" => $totalWriteOffsPerDateTotal[$store_id] ?? 0, + "total_write_offs_per_date_percent" => $storeSaleTotalTotal[$store_id] ?? 0 > 0 ? floor( + $totalWriteOffsPerDateTotal[$store_id] / $storeSaleTotalTotal[$store_id] * 100 + ) : 0, + "total_write_offs_per_month" => (int)($writeOffsMonth[$store_guids[$store_id]]["total"] ?? 0), + //$totalWriteOffsPerMonthTotal[$store_id] ?? 0, // "total_write_offs_per_month_percent" => $storeSaleTotalTotal[$store_id] ?? 0 > 0 ? floor((int)($writeOffsMonth[$store_guids[$store_id]]["total"] ?? 0) / $storeSaleTotalTotal[$store_id] * 100) : 0, - "total_write_offs_per_month_percent" => ($salesMonth[$store_guids[$store_id]]["total"] ?? 0) > 0 ? floor( - (int)($writeOffsMonth[$store_guids[$store_id]]["total"] ?? 0) / ($salesMonth[$store_guids[$store_id]]["total"] ?? 0) * 100 - ) : 0, - "total_payroll_days" => $totalPayrollDaysTotal[$store_id] ?? 0, - "total_payroll_days_percent" => $storeSaleTotalTotal[$store_id] ?? 0 > 0 ? floor( - $totalPayrollDaysTotal[$store_id] / $storeSaleTotalTotal[$store_id] * 100 - ) : 0, - "total_payroll_month" => (int)($adminPayrollDaysMonth[$store_id]['total'] ?? 0), - //$totalPayrollMonthTotal[$store_id] ?? 0, + "total_write_offs_per_month_percent" => ($salesMonth[$store_guids[$store_id]]["total"] ?? 0) > 0 ? floor( + (int)($writeOffsMonth[$store_guids[$store_id]]["total"] ?? 0) / ($salesMonth[$store_guids[$store_id]]["total"] ?? 0) * 100 + ) : 0, + "total_payroll_days" => $totalPayrollDaysTotal[$store_id] ?? 0, + "total_payroll_days_percent" => $storeSaleTotalTotal[$store_id] ?? 0 > 0 ? floor( + $totalPayrollDaysTotal[$store_id] / $storeSaleTotalTotal[$store_id] * 100 + ) : 0, + "total_payroll_month" => (int)($adminPayrollDaysMonth[$store_id]['total'] ?? 0), + //$totalPayrollMonthTotal[$store_id] ?? 0, // "total_payroll_month_percent" => $storeSaleTotalTotal[$store_id] ?? 0 > 0 ? floor(($adminPayrollDaysMonth[$store_id]['total'] ?? 0) / $storeSaleTotalTotal[$store_id] * 100) : 0, - "total_payroll_month_percent" => ($salesMonth[$store_guids[$store_id]]["total"] ?? 0) > 0 ? floor( - ($adminPayrollDaysMonth[$store_id]['total'] ?? 0) / ($salesMonth[$store_guids[$store_id]]["total"] ?? 0) * 100 - ) : 0, - "employee_sale_avg" => $employeeCount[$store_id] ?? 0 > 0 ? floor( - $storeSaleTotalTotal[$store_id] / $employeeCount[$store_id] - ) : 0, - "visitors_quantity" => $storeVisitorsQuantityTotal[$store_id] ?? 0, - "conversion" => $storeSaleQuantityTotal[$store_id] ?? 0 > 0 ? floor( - $storeVisitorsQuantityTotal[$store_id] / $storeSaleQuantityTotal[$store_id] * 100 - ) : 0, - "bonus_user_count" => $storeSaleBonusCountTotal[$store_id] ?? 0, - "bonus_user_per_sale_percent" => $storeSaleQuantityTotal[$store_id] ?? 0 > 0 ? floor( - $storeSaleBonusCountTotal[$store_id] / $storeSaleQuantityTotal[$store_id] * 100 - ) : 0, - "bonus_new_user_count" => $storeSaleNewBonusCountTotal[$store_id] ?? 0, - "bonus_repeat_user_count" => $storeSaleRepeatBonusCountTotal[$store_id] ?? 0, - "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, - ]; - $stores [] = [ - 'id' => $store_id, - 'guid' => $eitStores[$store_id]['export_val'], - 'name' => $cityStoreNames[$store_id], - 'data' => $store - ]; - - $total["sale_month_total"] = ($total["sale_month_total"] ?? 0) + ($salesMonth[$store_guids[$store_id]]["total"] ?? 0); - $total["sale_total"] = ($total["sale_total"] ?? 0) + ($storeSaleTotalTotal[$store_id] ?? 0); - $total["sale_quantity"] = ($total["sale_quantity"] ?? 0) + ($storeSaleQuantityTotal[$store_id] ?? 0); - $total["sale_avg"] = 0; - $total["total_write_offs_per_date"] = ($total["total_write_offs_per_date"] ?? 0) + ($totalWriteOffsPerDateTotal[$store_id] ?? 0); - $total["total_write_offs_per_date_percent"] = 0; - $total["total_write_offs_per_month"] = ($total["total_write_offs_per_month"] ?? 0) + (int)($writeOffsMonth[$store_guids[$store_id]]["total"] ?? 0); //($totalWriteOffsPerMonthTotal[$store_id] ?? 0); - $total["total_write_offs_per_month_percent"] = 0; - $total["total_payroll_days"] = ($total["total_payroll_days"] ?? 0) + ($totalPayrollDaysTotal[$store_id] ?? 0); - $total["total_payroll_days_percent"] = 0; - $total["total_payroll_month"] = ($total["total_payroll_month"] ?? 0) + (int)($adminPayrollDaysMonth[$store_id]['total'] ?? 0);//($totalPayrollMonthTotal[$store_id] ?? 0); - $total["total_payroll_month_percent"] = 0; - $total["employee_sale_avg"] = 0; - $total["visitors_quantity"] = ($total["visitors_quantity"] ?? 0) + ($storeVisitorsQuantityTotal[$store_id] ?? 0); - $total["conversion"] = 0; - $total["bonus_user_count"] = ($total["bonus_user_count"] ?? 0) + ($storeSaleBonusCountTotal[$store_id] ?? 0); - $total["bonus_user_per_sale_percent"] = 0; - $total["bonus_new_user_count"] = ($total["bonus_new_user_count"] ?? 0) + ($storeSaleNewBonusCountTotal[$store_id] ?? 0); - $total["bonus_repeat_user_count"] = ($total["bonus_repeat_user_count"] ?? 0) + ($storeSaleRepeatBonusCountTotal[$store_id] ?? 0); - $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); + "total_payroll_month_percent" => ($salesMonth[$store_guids[$store_id]]["total"] ?? 0) > 0 ? floor( + ($adminPayrollDaysMonth[$store_id]['total'] ?? 0) / ($salesMonth[$store_guids[$store_id]]["total"] ?? 0) * 100 + ) : 0, + "employee_sale_avg" => $employeeCount[$store_id] ?? 0 > 0 ? floor( + $storeSaleTotalTotal[$store_id] / $employeeCount[$store_id] + ) : 0, + "visitors_quantity" => $storeVisitorsQuantityTotal[$store_id] ?? 0, + "conversion" => $storeSaleQuantityTotal[$store_id] ?? 0 > 0 ? floor( + $storeVisitorsQuantityTotal[$store_id] / $storeSaleQuantityTotal[$store_id] * 100 + ) : 0, + "bonus_user_count" => $storeSaleBonusCountTotal[$store_id] ?? 0, + "bonus_user_per_sale_percent" => $storeSaleQuantityTotal[$store_id] ?? 0 > 0 ? floor( + $storeSaleBonusCountTotal[$store_id] / $storeSaleQuantityTotal[$store_id] * 100 + ) : 0, + "bonus_new_user_count" => $storeSaleNewBonusCountTotal[$store_id] ?? 0, + "bonus_repeat_user_count" => $storeSaleRepeatBonusCountTotal[$store_id] ?? 0, + "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, + ]; + $stores [] = [ + 'id' => $store_id, + 'guid' => $eitStores[$store_id]['export_val'], + 'name' => $cityStoreNames[$store_id], + 'data' => $store + ]; + + $total["sale_month_total"] = ($total["sale_month_total"] ?? 0) + ($salesMonth[$store_guids[$store_id]]["total"] ?? 0); + $total["sale_total"] = ($total["sale_total"] ?? 0) + ($storeSaleTotalTotal[$store_id] ?? 0); + $total["sale_quantity"] = ($total["sale_quantity"] ?? 0) + ($storeSaleQuantityTotal[$store_id] ?? 0); + $total["sale_avg"] = 0; + $total["total_write_offs_per_date"] = ($total["total_write_offs_per_date"] ?? 0) + ($totalWriteOffsPerDateTotal[$store_id] ?? 0); + $total["total_write_offs_per_date_percent"] = 0; + $total["total_write_offs_per_month"] = ($total["total_write_offs_per_month"] ?? 0) + (int)($writeOffsMonth[$store_guids[$store_id]]["total"] ?? 0); //($totalWriteOffsPerMonthTotal[$store_id] ?? 0); + $total["total_write_offs_per_month_percent"] = 0; + $total["total_payroll_days"] = ($total["total_payroll_days"] ?? 0) + ($totalPayrollDaysTotal[$store_id] ?? 0); + $total["total_payroll_days_percent"] = 0; + $total["total_payroll_month"] = ($total["total_payroll_month"] ?? 0) + (int)($adminPayrollDaysMonth[$store_id]['total'] ?? 0);//($totalPayrollMonthTotal[$store_id] ?? 0); + $total["total_payroll_month_percent"] = 0; + $total["employee_sale_avg"] = 0; + $total["visitors_quantity"] = ($total["visitors_quantity"] ?? 0) + ($storeVisitorsQuantityTotal[$store_id] ?? 0); + $total["conversion"] = 0; + $total["bonus_user_count"] = ($total["bonus_user_count"] ?? 0) + ($storeSaleBonusCountTotal[$store_id] ?? 0); + $total["bonus_user_per_sale_percent"] = 0; + $total["bonus_new_user_count"] = ($total["bonus_new_user_count"] ?? 0) + ($storeSaleNewBonusCountTotal[$store_id] ?? 0); + $total["bonus_repeat_user_count"] = ($total["bonus_repeat_user_count"] ?? 0) + ($storeSaleRepeatBonusCountTotal[$store_id] ?? 0); + $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); + } } $total["sale_avg"] = $total["sale_quantity"] > 0 ? floor( $total["sale_total"] / $total["sale_quantity"] -- 2.39.5