fix the blade
This commit is contained in:
@@ -2,12 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Exports\V3\RoadItemsProjects;
|
namespace App\Exports\V3\RoadItemsProjects;
|
||||||
|
|
||||||
use App\Models\Province;
|
|
||||||
use App\Models\RoadItemsProject;
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Maatwebsite\Excel\Concerns\FromView;
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||||
@@ -18,17 +13,17 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
|||||||
|
|
||||||
class CountryActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
class CountryActivityPerSubItemReport 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('v3.Reports.RoadItems.CountryActivityPerSubItem', [
|
return view('v3.Reports.RoadItems.CountryActivityPerSubItem', [
|
||||||
'activities' => $activities->data,
|
'activities' => $activities["data"],
|
||||||
'fromDate' => $activities->fromDate,
|
'fromDate' => $activities["fromDate"],
|
||||||
'toDate' => $activities->toDate,
|
'toDate' => $activities["toDate"],
|
||||||
'details' => $activities->details
|
'details' => $activities["details"]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
namespace App\Services\Reports;
|
namespace App\Services\Reports;
|
||||||
|
|
||||||
use App\Models\InfoItem;
|
use App\Models\InfoItem;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class RoadItemReportService
|
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']);
|
$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) {
|
foreach ($subItems as $subItem) {
|
||||||
$totalItemCount = [
|
$totalItemCount[] = [
|
||||||
"total_count_{$subItem->sub_item}" => $activities->sum("Count_{$subItem->sub_item}"),
|
"total_count_{$subItem->sub_item}" => $activities->sum("Count_{$subItem->sub_item}"),
|
||||||
"total_sum_{$subItem->sub_item}" => $activities->sum("Sum_{$subItem->sub_item}"),
|
"total_sum_{$subItem->sub_item}" => $activities->sum("Sum_{$subItem->sub_item}"),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return collect([
|
return [
|
||||||
'data' => $activities->push($totalItemCount),
|
'data' => $activities->push($totalItemCount),
|
||||||
'fromDate' => $fromDate,
|
'fromDate' => $fromDate,
|
||||||
'toDate' => $toDate,
|
'toDate' => $toDate,
|
||||||
'details' => $subItems,
|
'details' => $subItems,
|
||||||
]);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceActivityPerSubItem(int $item, string $fromDate, string $toDate, int $provinceId): Collection
|
public function provinceActivityPerSubItem(int $item, string $fromDate, string $toDate, int $provinceId): Collection
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
<span>{{ $detail->sub_item_str }}</span>
|
<span>{{ $detail->sub_item_str }}</span>
|
||||||
<div style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">
|
<div style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">
|
||||||
<span>تعداد</span>
|
<span>تعداد</span>
|
||||||
<span>{{ $detail->unit }}مجموع</span>
|
<span>{{ $detail["sub_item_unit"] }}مجموع</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
@@ -52,11 +52,11 @@
|
|||||||
<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)
|
@if($activity["sub_item"] == $detail["sub_item"])
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $activity->Count_ }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $activity["Count_{$activity["sub_item"]}"] }}</td>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ round($activity->Sum_, 1) }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ round($activity["Sum_{$activity["sub_item"]}"], 1) }}</td>
|
||||||
@endif
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user