fix the blade
This commit is contained in:
@@ -2,12 +2,7 @@
|
||||
|
||||
namespace App\Exports\V3\RoadItemsProjects;
|
||||
|
||||
use App\Models\Province;
|
||||
use App\Models\RoadItemsProject;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||
@@ -18,17 +13,17 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class CountryActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||
{
|
||||
public function __construct(private Collection $activities){}
|
||||
public function __construct(private array $activities){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$activities = $this->activities;
|
||||
|
||||
return view('v3.Reports.RoadItems.CountryActivityPerSubItem', [
|
||||
'activities' => $activities->data,
|
||||
'fromDate' => $activities->fromDate,
|
||||
'toDate' => $activities->toDate,
|
||||
'details' => $activities->details
|
||||
'activities' => $activities["data"],
|
||||
'fromDate' => $activities["fromDate"],
|
||||
'toDate' => $activities["toDate"],
|
||||
'details' => $activities["details"]
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
namespace App\Services\Reports;
|
||||
|
||||
use App\Models\InfoItem;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RoadItemReportService
|
||||
{
|
||||
public function countryActivityPerSubItem(int $item, string $fromDate, string $toDate): Collection
|
||||
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']);
|
||||
|
||||
@@ -36,18 +35,18 @@ class RoadItemReportService
|
||||
];
|
||||
|
||||
foreach ($subItems as $subItem) {
|
||||
$totalItemCount = [
|
||||
$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 [
|
||||
'data' => $activities->push($totalItemCount),
|
||||
'fromDate' => $fromDate,
|
||||
'toDate' => $toDate,
|
||||
'details' => $subItems,
|
||||
]);
|
||||
];
|
||||
}
|
||||
|
||||
public function provinceActivityPerSubItem(int $item, string $fromDate, string $toDate, int $provinceId): Collection
|
||||
|
||||
Reference in New Issue
Block a user