diff --git a/resources/views/v3/Reports/RoadItems/CountryActivityPerSubItem.blade.php b/resources/views/v3/Reports/RoadItems/CountryActivityPerSubItem.blade.php
index 00c574d0..7f669bca 100644
--- a/resources/views/v3/Reports/RoadItems/CountryActivityPerSubItem.blade.php
+++ b/resources/views/v3/Reports/RoadItems/CountryActivityPerSubItem.blade.php
@@ -28,7 +28,7 @@
تا
تاریخ
{{verta($toDate)->format('Y/n/j')}}
- >
+
@@ -52,17 +52,41 @@
- @foreach ($provinces as $province)
-
- | {{ $province['name_fa'] }} |
+ @php
+ // محاسبه مقدار c و s برای هر سابآیتم در کل کشور
+ $countTotalsForCountry = [];
+ $sumTotalsForCountry = [];
- @foreach ($subItems as $subItem)
-
- {{ $province->{'Count_' . ($index)} ?? '-' }}
- |
-
- {{ isset($province->{'Sum_' . ($index)}) ? round($province->{'Sum_' . ($index)}, 1) : '-' }}
- |
+ foreach ($subItems as $subItem) {
+ $countTotalsForCountry[$subItem['sub_item']] = collect($data)->where('p', -1)->where('t', $subItem['sub_item'])->sum('c');
+ $sumTotalsForCountry[$subItem['sub_item']] = collect($data)->where('p', -1)->where('t', $subItem['sub_item'])->sum('s');
+ }
+ @endphp
+
+ {{-- ردیف کل کشور --}}
+
+ | کل کشور |
+ @foreach($subItems as $subItem)
+ {{ $countTotalsForCountry[$subItem['sub_item']] ?? '-' }} |
+ {{ $sumTotalsForCountry[$subItem['sub_item']] ?? '-' }} |
+ @endforeach
+
+
+ {{-- ردیفهای مربوط به هر استان --}}
+ @foreach($provinces as $province)
+ @php
+ $countTotalsForProvince = [];
+ $sumTotalsForProvince = [];
+ foreach ($subItems as $subItem) {
+ $countTotalsForProvince[$subItem['sub_item']] = collect($data)->where('p', $province['id'])->where('t', $subItem['sub_item'])->sum('c');
+ $sumTotalsForProvince[$subItem['sub_item']] = collect($data)->where('p', $province['id'])->where('t', $subItem['sub_item'])->sum('s');
+ }
+ @endphp
+
+ | {{ $province['name_fa'] }} |
+ @foreach($subItems as $subItem)
+ {{ $countTotalsForProvince[$subItem['sub_item']] ?? '-' }} |
+ {{ $sumTotalsForProvince[$subItem['sub_item']] ?? '-' }} |
@endforeach
@endforeach
diff --git a/resources/views/v3/Reports/RoadItems/ProvinceActivityPerSubItem.blade.php b/resources/views/v3/Reports/RoadItems/ProvinceActivityPerSubItem.blade.php
index 656bf81c..2b552d68 100644
--- a/resources/views/v3/Reports/RoadItems/ProvinceActivityPerSubItem.blade.php
+++ b/resources/views/v3/Reports/RoadItems/ProvinceActivityPerSubItem.blade.php
@@ -28,11 +28,11 @@
تا
تاریخ
{{verta($toDate)->format('Y/n/j')}}
- >
+
- | اداره |
+ اداره کل |
فعالیت های انجام شده |
@@ -52,23 +52,45 @@
- @foreach ($edarateShahri as $edareShahri)
-
- | {{ $activity->city_fa }} |
+ @php
+ // محاسبه مقدار c و s برای هر سابآیتم در کل کشور
+ $countTotalsForProvince = [];
+ $sumTotalsForProvince = [];
- @foreach ($subItems as $subItem)
-
- {{ $edareShahri->{'Count_' . ($subItem)} ?? '-' }}
- |
-
- {{ isset($edareShahri->{'Sum_' . ($subItem)}) ? round($edareShahri->{'Sum_' . ($subItem)}, 1) : '-' }}
- |
+ foreach ($subItems as $subItem) {
+ $countTotalsForProvince[$subItem['sub_item']] = collect($data)->where('ci', -1)->where('t', $subItem['sub_item'])->sum('c');
+ $sumTotalsForProvince[$subItem['sub_item']] = collect($data)->where('ci', -1)->where('t', $subItem['sub_item'])->sum('s');
+ }
+ @endphp
+
+ {{-- ردیف کل کشور --}}
+
+ | کل کشور |
+ @foreach($subItems as $subItem)
+ {{ $countTotalsForProvince[$subItem['sub_item']] ?? '-' }} |
+ {{ $sumTotalsForProvince[$subItem['sub_item']] ?? '-' }} |
+ @endforeach
+
+
+ {{-- ردیفهای مربوط به هر استان --}}
+ @foreach($edarateShahri as $edareShahri)
+ @php
+ $countTotalsForProvince = [];
+ $sumTotalsForProvince = [];
+ foreach ($subItems as $subItem) {
+ $countTotalsForProvince[$subItem['sub_item']] = collect($data)->where('ci', $edareShahri['id'])->where('t', $subItem['sub_item'])->sum('c');
+ $sumTotalsForProvince[$subItem['sub_item']] = collect($data)->where('ci', $edareShahri['id'])->where('t', $subItem['sub_item'])->sum('s');
+ }
+ @endphp
+
+ | {{ $edareShahri['name_fa'] }} |
+ @foreach($subItems as $subItem)
+ {{ $countTotalsForProvince[$subItem['sub_item']] ?? '-' }} |
+ {{ $sumTotalsForProvince[$subItem['sub_item']] ?? '-' }} |
@endforeach
@endforeach
-