create blade files
This commit is contained in:
@@ -10,10 +10,12 @@ class RoadItemReportService
|
||||
{
|
||||
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')
|
||||
->selectRaw('province_id, province_fa, sub_item');
|
||||
->selectRaw('province_id, province_fa');
|
||||
|
||||
foreach ($subItems as $subItem) {
|
||||
$query->selectRaw("
|
||||
@@ -45,13 +47,15 @@ class RoadItemReportService
|
||||
'data' => $activities->push($totalItemCount),
|
||||
'fromDate' => $fromDate,
|
||||
'toDate' => $toDate,
|
||||
'details' => $subItems,
|
||||
'details' => $subItems->keyBy('sub_item'),
|
||||
];
|
||||
}
|
||||
|
||||
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')
|
||||
->selectRaw('province_id, province_fa, user_name as city_fa, city_id');
|
||||
@@ -72,11 +76,22 @@ class RoadItemReportService
|
||||
|
||||
$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([
|
||||
'data' => $activities,
|
||||
'data' => $activities->push($totalItemCount),
|
||||
'fromDate' => $fromDate,
|
||||
'toDate' => $toDate,
|
||||
'details' => $subItems
|
||||
'details' => $subItems->keyBy('sub_item')
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user