debug city export
This commit is contained in:
@@ -18,16 +18,17 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
|||||||
|
|
||||||
class ProvinceActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
class ProvinceActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||||
{
|
{
|
||||||
public function __construct(private Collection $activities){}
|
public function __construct(private array $activities){}
|
||||||
|
|
||||||
public function view(): View
|
public function view(): View
|
||||||
{
|
{
|
||||||
$activities = $this->activities;
|
$activities = $this->activities;
|
||||||
|
|
||||||
return view('', [
|
return view('v3.Reports.RoadItems.ProvinceActivityPerSubItem', [
|
||||||
'activities' => $activities->data,
|
'activities' => $activities["data"],
|
||||||
'fromDate' => $activities->fromDate,
|
'fromDate' => $activities["fromDate"],
|
||||||
'toDate' => $activities->toDate
|
'toDate' => $activities["toDate"],
|
||||||
|
'details' => $activities["details"]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ class RoadItemReportService
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceActivityPerSubItem(int $item, string $fromDate, string $toDate, int $provinceId): Collection
|
public function provinceActivityPerSubItem(int $item, string $fromDate, string $toDate, int $provinceId): array
|
||||||
{
|
{
|
||||||
$subItems = InfoItem::query()->where('item', $item)
|
$subItems = InfoItem::query()->where('item', $item)
|
||||||
->orderBy('sub_item')
|
->orderBy('sub_item')
|
||||||
->get(['sub_item', 'sub_item_str', 'sub_item_unit']);
|
->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, TRIM(SUBSTRING_INDEX(user_name, "استان", 1)) as city_fa, city_id');
|
||||||
|
|
||||||
foreach ($subItems as $subItem) {
|
foreach ($subItems as $subItem) {
|
||||||
$query->selectRaw("
|
$query->selectRaw("
|
||||||
@@ -83,11 +83,11 @@ class RoadItemReportService
|
|||||||
$totalItemCount["Sum_{$subItem->sub_item}"] = $activities->sum("Sum_{$subItem->sub_item}");
|
$totalItemCount["Sum_{$subItem->sub_item}"] = $activities->sum("Sum_{$subItem->sub_item}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return collect([
|
return [
|
||||||
'data' => $activities->push((object)$totalItemCount),
|
'data' => $activities->push((object)$totalItemCount),
|
||||||
'fromDate' => $fromDate,
|
'fromDate' => $fromDate,
|
||||||
'toDate' => $toDate,
|
'toDate' => $toDate,
|
||||||
'details' => $subItems->keyBy('sub_item')
|
'details' => $subItems->keyBy('sub_item')
|
||||||
]);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user