diff --git a/app/Exports/V3/Mission/Report/Machine/machineDriverReport.php b/app/Exports/V3/Mission/Report/Machine/machineDriverReport.php
new file mode 100644
index 00000000..3bb74fdc
--- /dev/null
+++ b/app/Exports/V3/Mission/Report/Machine/machineDriverReport.php
@@ -0,0 +1,74 @@
+data as $r) {
+ $exportRows[] = [
+ 'driver_id' => $r->driver_id ?? '',
+ 'driver_name' => $r->driver_name ?? '',
+ 'missions' => $r->missions ?? 0,
+ 'func' => (int) ($r->func ?? 0),
+ ];
+ }
+
+ return view('v3.Reports.Mission.Report.Machine.MachineDriverReport', [
+ 'rows' => $exportRows,
+ ]);
+ }
+
+ public function registerEvents(): array
+ {
+ return [
+ AfterSheet::class => function (AfterSheet $event) {
+ $event->sheet->getDelegate()->setRightToLeft(true);
+ },
+ ];
+ }
+
+ /**
+ * @throws Exception
+ */
+ public function drawings(): array
+ {
+ $drawing = new Drawing();
+ $drawing->setName('Logo');
+ $drawing->setDescription('This is my logo');
+ $drawing->setPath(public_path('/dist/logo.png'));
+ $drawing->setWidth(50);
+ $drawing->setHeight(50);
+ $drawing->setOffsetX(5);
+ $drawing->setOffsetY(5);
+ $drawing->setCoordinates('A1');
+
+ $drawing2 = new Drawing();
+ $drawing2->setName('Logo');
+ $drawing2->setDescription('This is my logo');
+ $drawing2->setPath(public_path('/dist/141icon.png'));
+ $drawing2->setWidth(50);
+ $drawing2->setHeight(50);
+ $drawing2->setOffsetX(5);
+ $drawing2->setOffsetY(5);
+ $drawing2->setCoordinates('D1');
+
+ return [$drawing, $drawing2];
+ }
+}
diff --git a/app/Exports/V3/Mission/Report/Machine/machineReport.php b/app/Exports/V3/Mission/Report/Machine/machineReport.php
index 5d11323a..5b9daa15 100644
--- a/app/Exports/V3/Mission/Report/Machine/machineReport.php
+++ b/app/Exports/V3/Mission/Report/Machine/machineReport.php
@@ -18,14 +18,16 @@ class machineReport implements FromView, ShouldAutoSize, WithDrawings, WithEvent
}
public function view(): View
- { $exportRows = [];
+ {
+ $exportRows = [];
foreach ($this->data as $r) {
$exportRows[] = [
- 'city_name' => $r->c_name ?? '',
- 'province_name' => $r->p_name ?? '',
+ 'machine_id' => $r->c_name ?? '',
+ 'machine_code' => $r->machine_code ?? '',
+ 'car_name' => $r->car_name ?? '',
'missions' => $r->missions ?? 0,
- 'distance' => (int) ($r->distance ?? 0),
+ 'func' => (int) ($r->func ?? 0),
];
}
@@ -66,7 +68,7 @@ class machineReport implements FromView, ShouldAutoSize, WithDrawings, WithEvent
$drawing2->setHeight(50);
$drawing2->setOffsetX(5);
$drawing2->setOffsetY(5);
- $drawing2->setCoordinates('D1');
+ $drawing2->setCoordinates('E1');
return [$drawing, $drawing2];
}
diff --git a/app/Exports/V3/Mission/Report/Machine/machineTypeReport.php b/app/Exports/V3/Mission/Report/Machine/machineTypeReport.php
new file mode 100644
index 00000000..d376871e
--- /dev/null
+++ b/app/Exports/V3/Mission/Report/Machine/machineTypeReport.php
@@ -0,0 +1,73 @@
+data as $r) {
+ $exportRows[] = [
+ 'car_type' => $r->car_type ?? '',
+ 'missions' => $r->missions ?? 0,
+ 'func' => (int) ($r->func ?? 0),
+ ];
+ }
+
+ return view('v3.Reports.Mission.Report.Machine.MachineTypeReport', [
+ 'rows' => $exportRows,
+ ]);
+ }
+
+ public function registerEvents(): array
+ {
+ return [
+ AfterSheet::class => function (AfterSheet $event) {
+ $event->sheet->getDelegate()->setRightToLeft(true);
+ },
+ ];
+ }
+
+ /**
+ * @throws Exception
+ */
+ public function drawings(): array
+ {
+ $drawing = new Drawing();
+ $drawing->setName('Logo');
+ $drawing->setDescription('This is my logo');
+ $drawing->setPath(public_path('/dist/logo.png'));
+ $drawing->setWidth(50);
+ $drawing->setHeight(50);
+ $drawing->setOffsetX(5);
+ $drawing->setOffsetY(5);
+ $drawing->setCoordinates('A1');
+
+ $drawing2 = new Drawing();
+ $drawing2->setName('Logo');
+ $drawing2->setDescription('This is my logo');
+ $drawing2->setPath(public_path('/dist/141icon.png'));
+ $drawing2->setWidth(50);
+ $drawing2->setHeight(50);
+ $drawing2->setOffsetX(5);
+ $drawing2->setOffsetY(5);
+ $drawing2->setCoordinates('C1');
+
+ return [$drawing, $drawing2];
+ }
+}
diff --git a/app/Http/Controllers/V3/Dashboard/Mission/Report/ReportMachineController.php b/app/Http/Controllers/V3/Dashboard/Mission/Report/ReportMachineController.php
index ddcc0fd3..f39b46bf 100644
--- a/app/Http/Controllers/V3/Dashboard/Mission/Report/ReportMachineController.php
+++ b/app/Http/Controllers/V3/Dashboard/Mission/Report/ReportMachineController.php
@@ -2,7 +2,9 @@
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
+use App\Exports\V3\Mission\Report\Machine\machineDriverReport;
use App\Exports\V3\Mission\Report\Machine\machineReport;
+use App\Exports\V3\Mission\Report\Machine\machineTypeReport;
use App\Facades\DataTable\DataTableFacade;
use App\Http\Controllers\Controller;
use App\Http\Traits\ApiResponse;
@@ -62,7 +64,7 @@ class ReportMachineController extends Controller
*/
public function provinceMachinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
{
- $data = $reportMachineService->countryMachinesActivity($request);
+ $data = $reportMachineService->provinceMachinesActivity($request);
$name = 'گزارش ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
return Excel::download(new machineReport($data), $name);
@@ -83,9 +85,9 @@ class ReportMachineController extends Controller
public function countryMachineTypesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
{
$data = $reportMachineService->countryMachineTypesActivity($request);
- $name = 'گزارش ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
+ $name = 'گزارش نوع ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
- return Excel::download(new machineReport($data), $name);
+ return Excel::download(new machineTypeReport($data), $name);
}
public function provinceMachineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
@@ -123,9 +125,9 @@ class ReportMachineController extends Controller
public function provinceMachineTypesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
{
$data = $reportMachineService->provinceMachineTypesActivity($request);
- $name = 'گزارش ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
+ $name = 'گزارش نوع ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
- return Excel::download(new machineReport($data), $name);
+ return Excel::download(new machineTypeReport($data), $name);
}
public function countryMachineDriversActivity(Request $request, ReportMachineService $reportMachineService)
@@ -136,6 +138,18 @@ class ReportMachineController extends Controller
]);
}
+ /**
+ * @throws Exception
+ * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
+ */
+ public function countryMachineDriversActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
+ {
+ $data = $reportMachineService->countryMachineDriversActivity($request);
+ $name = 'گزارش نوع ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
+
+ return Excel::download(new machineDriverReport($data), $name);
+ }
+
public function provinceMachineDriversActivity(Request $request, ReportMachineService $reportMachineService)
{
return $this->successResponse([
@@ -150,6 +164,18 @@ class ReportMachineController extends Controller
]);
}
+ /**
+ * @throws Exception
+ * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
+ */
+ public function provinceMachineDriversActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
+ {
+ $data = $reportMachineService->provinceMachineDriversActivity($request);
+ $name = 'گزارش نوع ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
+
+ return Excel::download(new machineDriverReport($data), $name);
+ }
+
public function machineTypeDetailsReport(Request $request)
{
$machineIds = CMMSMachine::query()->where('car_type', '=', $request->query('car_type'))->pluck('machine_id');
diff --git a/resources/views/v3/Reports/Mission/Report/Machine/ActivityReport.blade.php b/resources/views/v3/Reports/Mission/Report/Machine/ActivityReport.blade.php
index a3ffc93b..53091d8b 100644
--- a/resources/views/v3/Reports/Mission/Report/Machine/ActivityReport.blade.php
+++ b/resources/views/v3/Reports/Mission/Report/Machine/ActivityReport.blade.php
@@ -46,19 +46,23 @@
|
- استان
+ کدیکتا
|
- شهر
+ مدل ماشین |
+
+ کد ماشین
+ |
+
+ کارکرد
|
تعداد ماموریت |
-
- جمع کارکرد
- |
+
@@ -66,10 +70,11 @@
@foreach ($rows as $item)
- | {{ $item['province_name'] ?? '-' }} |
- {{ $item['city_name'] ?? '-' }} |
+ {{ $item['machine_id'] ?? '-' }} |
+ {{ $item['car_name'] ?? '-' }} |
+ {{ $item['machine_code'] ?? '-' }} |
+ {{ $item['func'] ?? '-' }} |
{{ $item['missions'] ?? '-' }} |
- {{ $item['distance'] ?? '-' }} |
@endforeach
diff --git a/resources/views/v3/Reports/Mission/Report/Machine/MachineDriverReport.blade.php b/resources/views/v3/Reports/Mission/Report/Machine/MachineDriverReport.blade.php
new file mode 100644
index 00000000..9ed7b2c9
--- /dev/null
+++ b/resources/views/v3/Reports/Mission/Report/Machine/MachineDriverReport.blade.php
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+ گزارش کل تردد های راننده
+
+
+
+
+
+@php
+ // show a dot if key missing or value is 0/empty
+ function cell($row, $key) {
+ return array_key_exists($key, $row) ? ($row[$key] ?: '0') : '0';
+ }
+@endphp
+
+
+
+
+ |
+ تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
+ |
+
+
+ |
+ |
+
+
+ |
+ گزارش راندده ها در ماموریت
+ |
+
+
+ |
+ car_type
+ |
+
+ کارکرد
+ |
+
+ تعداد ماموریت |
+
+
+
+
+
+
+ @foreach ($rows as $item)
+
+ | {{ $item['driver_id'] ?? '-' }} |
+ {{ $item['driver_name'] ?? '-' }} |
+ {{ $item['func'] ?? '-' }} |
+ {{ $item['missions'] ?? '-' }} |
+
+ @endforeach
+
+
+
+
diff --git a/resources/views/v3/Reports/Mission/Report/Machine/MachineTypeReport.blade.php b/resources/views/v3/Reports/Mission/Report/Machine/MachineTypeReport.blade.php
new file mode 100644
index 00000000..46545ea6
--- /dev/null
+++ b/resources/views/v3/Reports/Mission/Report/Machine/MachineTypeReport.blade.php
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+ گزارش کل تردد های انواع ماشین ها
+
+
+
+
+
+@php
+ // show a dot if key missing or value is 0/empty
+ function cell($row, $key) {
+ return array_key_exists($key, $row) ? ($row[$key] ?: '0') : '0';
+ }
+@endphp
+
+
+
+
+ |
+ تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
+ |
+
+
+ |
+ |
+
+
+ |
+ گزارش نوع ماشین های ماموریت رفته
+ |
+
+
+
+ |
+ نوع ماشین |
+
+
+ کارکرد
+ |
+
+ تعداد ماموریت |
+
+
+
+
+
+
+ @foreach ($rows as $item)
+
+ | {{ $item['car_type'] ?? '-' }} |
+ {{ $item['func'] ?? '-' }} |
+ {{ $item['missions'] ?? '-' }} |
+
+ @endforeach
+
+
+
+