create blade files
This commit is contained in:
@@ -10,10 +10,12 @@ class RoadItemReportService
|
|||||||
{
|
{
|
||||||
public function countryActivityPerSubItem(int $item, string $fromDate, string $toDate): array
|
public function countryActivityPerSubItem(int $item, string $fromDate, string $toDate): array
|
||||||
{
|
{
|
||||||
$subItems = InfoItem::query()->where('item', $item)->get(['sub_item', 'sub_item_str', 'sub_item_unit']);
|
$subItems = InfoItem::query()->where('item', $item)
|
||||||
|
->orderBy('sub_item')
|
||||||
|
->get(['sub_item', 'sub_item_str', 'sub_item_unit']);
|
||||||
|
|
||||||
$query = DB::table('road_items_projects')
|
$query = DB::table('road_items_projects')
|
||||||
->selectRaw('province_id, province_fa, sub_item');
|
->selectRaw('province_id, province_fa');
|
||||||
|
|
||||||
foreach ($subItems as $subItem) {
|
foreach ($subItems as $subItem) {
|
||||||
$query->selectRaw("
|
$query->selectRaw("
|
||||||
@@ -45,13 +47,15 @@ class RoadItemReportService
|
|||||||
'data' => $activities->push($totalItemCount),
|
'data' => $activities->push($totalItemCount),
|
||||||
'fromDate' => $fromDate,
|
'fromDate' => $fromDate,
|
||||||
'toDate' => $toDate,
|
'toDate' => $toDate,
|
||||||
'details' => $subItems,
|
'details' => $subItems->keyBy('sub_item'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceActivityPerSubItem(int $item, string $fromDate, string $toDate, int $provinceId): Collection
|
public function provinceActivityPerSubItem(int $item, string $fromDate, string $toDate, int $provinceId): Collection
|
||||||
{
|
{
|
||||||
$subItems = InfoItem::query()->where('item', $item)->get(['sub_item', 'sub_item_str', 'sub_item_unit']);
|
$subItems = InfoItem::query()->where('item', $item)
|
||||||
|
->orderBy('sub_item')
|
||||||
|
->get(['sub_item', 'sub_item_str', 'sub_item_unit']);
|
||||||
|
|
||||||
$query = DB::table('road_items_projects')
|
$query = DB::table('road_items_projects')
|
||||||
->selectRaw('province_id, province_fa, user_name as city_fa, city_id');
|
->selectRaw('province_id, province_fa, user_name as city_fa, city_id');
|
||||||
@@ -72,11 +76,22 @@ class RoadItemReportService
|
|||||||
|
|
||||||
$activities = $query->get();
|
$activities = $query->get();
|
||||||
|
|
||||||
|
$totalItemCount = [
|
||||||
|
'city_fa' => 'استانی'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($subItems as $subItem) {
|
||||||
|
$totalItemCount[] = [
|
||||||
|
"total_count_{$subItem->sub_item}" => $activities->sum("Count_{$subItem->sub_item}"),
|
||||||
|
"total_sum_{$subItem->sub_item}" => $activities->sum("Sum_{$subItem->sub_item}"),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return collect([
|
return collect([
|
||||||
'data' => $activities,
|
'data' => $activities->push($totalItemCount),
|
||||||
'fromDate' => $fromDate,
|
'fromDate' => $fromDate,
|
||||||
'toDate' => $toDate,
|
'toDate' => $toDate,
|
||||||
'details' => $subItems
|
'details' => $subItems->keyBy('sub_item')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="26" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
<th colspan="26" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
||||||
تعداد و احجام فعالیت های روزانه و جاری راهداری ثبت شده از تاریخ
|
تعداد و مجموع فعالیت های روزانه و جاری راهداری ثبت شده از تاریخ
|
||||||
{{verta($fromDate)->format('Y/n/j')}}
|
{{verta($fromDate)->format('Y/n/j')}}
|
||||||
تا
|
تا
|
||||||
تاریخ
|
تاریخ
|
||||||
@@ -33,34 +33,38 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th rowspan="3" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">اداره کل</th>
|
<th rowspan="3" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">اداره کل</th>
|
||||||
|
<th colspan="24" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">فعالیت های انجام شده</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
@foreach($details as $detail)
|
||||||
|
<th colspan="2" style="border:1px solid black;text-align:center;background-color:#C4D79B">{{ $detail->sub_item_str }}</th>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
@foreach($details as $detail)
|
||||||
|
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">تعداد</th>
|
||||||
|
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">مجموع ({{ $detail->sub_item_unit }})</th>
|
||||||
|
@endforeach
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@foreach($details as $detail)
|
|
||||||
<tr>
|
|
||||||
<th style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
|
||||||
<div style="display: flex; flex-direction: column; align-items: center;">
|
|
||||||
<span>{{ $detail->sub_item_str }}</span>
|
|
||||||
<div style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">
|
|
||||||
<span>تعداد</span>
|
|
||||||
<span>{{ $detail["sub_item_unit"] }}مجموع</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($activities as $activity)
|
@foreach ($activities as $activity)
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $activity["province_fa"] }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $activity->province_fa }}</td>
|
||||||
|
|
||||||
@if($activity["sub_item"] == $detail["sub_item"])
|
@foreach ($details as $index => $detail)
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $activity["Count_{$activity["sub_item"]}"] }}</td>
|
<td style="border: 1px solid black;text-align: center;">
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ round($activity["Sum_{$activity["sub_item"]}"], 1) }}</td>
|
{{ $activity->{'Count_' . ($index)} ?? '-' }}
|
||||||
@endif
|
</td>
|
||||||
</tr>
|
<td style="border: 1px solid black;text-align: center;">
|
||||||
|
{{ isset($activity->{'Sum_' . ($index)}) ? round($activity->{'Sum_' . ($index)}, 1) : '-' }}
|
||||||
@endforeach
|
</td>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>استانی</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="rtl" style="text-align: center;">
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="25" style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||||
|
تاریخ دریافت گزارش: {{verta()->now()->format('Y/m/d H:i')}}
|
||||||
|
</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="25" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;"></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="26" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
||||||
|
تعداد و مجموع فعالیت های روزانه و جاری راهداری ثبت شده از تاریخ
|
||||||
|
{{verta($fromDate)->format('Y/n/j')}}
|
||||||
|
تا
|
||||||
|
تاریخ
|
||||||
|
{{verta($toDate)->format('Y/n/j')}}
|
||||||
|
</th>>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th rowspan="3" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">اداره</th>
|
||||||
|
<th colspan="24" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">فعالیت های انجام شده</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
@foreach($details as $detail)
|
||||||
|
<th colspan="2" style="border:1px solid black;text-align:center;background-color:#C4D79B">{{ $detail->sub_item_str }}</th>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
@foreach($details as $detail)
|
||||||
|
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">تعداد</th>
|
||||||
|
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">مجموع ({{ $detail->sub_item_unit }})</th>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach ($activities as $activity)
|
||||||
|
<tr>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $activity->city_fa }}</td>
|
||||||
|
|
||||||
|
@foreach ($details as $index => $detail)
|
||||||
|
<td style="border: 1px solid black;text-align: center;">
|
||||||
|
{{ $activity->{'Count_' . ($index)} ?? '-' }}
|
||||||
|
</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">
|
||||||
|
{{ isset($activity->{'Sum_' . ($index)}) ? round($activity->{'Sum_' . ($index)}, 1) : '-' }}
|
||||||
|
</td>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user