]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Ошибка с передачей id с передачей тестового магазина origin/feature_fomichev_erp-287_daily_report_telegram
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 24 Jan 2025 13:49:46 +0000 (16:49 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 24 Jan 2025 13:49:46 +0000 (16:49 +0300)
erp24/api3/core/services/ReportService.php

index 86462fdf32951b55482486d5f5ed96472b8b7e98..0f825c646ed5354aa79371144ed4d77bb4d3d13e 100644 (file)
@@ -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"]