diff --git a/app/Services/StatisticsService.php b/app/Services/StatisticsService.php index 58cf0fb..ba0cfdf 100644 --- a/app/Services/StatisticsService.php +++ b/app/Services/StatisticsService.php @@ -104,11 +104,12 @@ class StatisticsService // 5. Собираем данные $groupedData = []; $totalsByType = []; - $grandRecipientPlan = 0; - $grandProgressPlan = 0; $departmentsPlans = $this->planCalculator->calculate($allDeptIds, $startDate, $endDate); + $grandRecipientPlan = collect($departmentsPlans)->sum('cumulative_plan'); + $grandProgressPlan = collect($departmentsPlans)->sum('actual_year_to_date'); + foreach ($departments as $typeName => $deptList) { $groupedData[$typeName] = []; $totalsByType[$typeName] = $this->initTypeTotals();