Compare commits
13 Commits
develop
...
43a8acca14
| Author | SHA1 | Date | |
|---|---|---|---|
| 43a8acca14 | |||
| 75c2fce369 | |||
|
|
ec1358e85f | ||
|
|
21e9931298 | ||
|
|
23ab4d2bff | ||
| 4138ac7620 | |||
|
|
4a2612837b | ||
|
|
7651920494 | ||
|
|
aa90d151c1 | ||
|
|
a5a464d4fe | ||
|
|
73771adabf | ||
|
|
7ba487a8be | ||
|
|
c6c3675073 |
@@ -1,77 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exports\V3\Mission\Report\Machine;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Maatwebsite\Excel\Concerns\FromView;
|
|
||||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
|
||||||
use Maatwebsite\Excel\Events\AfterSheet;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Exception;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
|
||||||
|
|
||||||
class machineDetailsReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
|
||||||
{
|
|
||||||
public function __construct(private array $data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function view(): View
|
|
||||||
{
|
|
||||||
$exportRows = [];
|
|
||||||
|
|
||||||
foreach ($this->data as $r) {
|
|
||||||
$exportRows[] = [
|
|
||||||
'id' => $r->id,
|
|
||||||
'province_name' => $r->province_name,
|
|
||||||
'city_name' => $r->city_name,
|
|
||||||
'station_name' => $r->station_name ?? 0,
|
|
||||||
'driver_name' => $r->driver_name ?? '',
|
|
||||||
'km' => $r->km ?? '',
|
|
||||||
'end_km' => $r->end_km ?? '',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return view('v3.Reports.Mission.Report.Machine.ActivityDetailsReport', [
|
|
||||||
'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(+90);
|
|
||||||
$drawing2->setOffsetY(5);
|
|
||||||
$drawing2->setCoordinates('E1');
|
|
||||||
|
|
||||||
return [$drawing, $drawing2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exports\V3\Mission\Report\Machine;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Maatwebsite\Excel\Concerns\FromView;
|
|
||||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
|
||||||
use Maatwebsite\Excel\Events\AfterSheet;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Exception;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
|
||||||
|
|
||||||
class machineDriverDetailsReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
|
||||||
{
|
|
||||||
public function __construct(private array $data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function view(): View
|
|
||||||
{
|
|
||||||
$exportRows = [];
|
|
||||||
|
|
||||||
foreach ($this->data as $r) {
|
|
||||||
$exportRows[] = [
|
|
||||||
'id' => $r->id,
|
|
||||||
'province_name' => $r->province_name,
|
|
||||||
'city_name' => $r->city_name,
|
|
||||||
'station_name' => $r->station_name ?? 0,
|
|
||||||
'driver_name' => $r->driver_name ?? '',
|
|
||||||
'km' => $r->km ?? '',
|
|
||||||
'end_km' => $r->end_km ?? '',
|
|
||||||
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return view('v3.Reports.Mission.Report.Machine.MachineDriverDetailsReport', [
|
|
||||||
'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(+90);
|
|
||||||
$drawing2->setOffsetY(5);
|
|
||||||
$drawing2->setCoordinates('D1');
|
|
||||||
|
|
||||||
return [$drawing, $drawing2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exports\V3\Mission\Report\Machine;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Maatwebsite\Excel\Concerns\FromView;
|
|
||||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
|
||||||
use Maatwebsite\Excel\Events\AfterSheet;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Exception;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
|
||||||
|
|
||||||
class machineTypeDetailsReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
|
||||||
{
|
|
||||||
public function __construct(private array $data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function view(): View
|
|
||||||
{
|
|
||||||
$exportRows = [];
|
|
||||||
|
|
||||||
foreach ($this->data as $r) {
|
|
||||||
$exportRows[] = [
|
|
||||||
'id' => $r->id,
|
|
||||||
'province_name' => $r->province_name,
|
|
||||||
'city_name' => $r->city_name,
|
|
||||||
'station_name' => $r->station_name ?? 0,
|
|
||||||
'driver_name' => $r->driver_name ?? '',
|
|
||||||
'km' => $r->km ?? '',
|
|
||||||
'end_km' => $r->end_km ?? '',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return view('v3.Reports.Mission.Report.Machine.MachineTypeDetailsReport', [
|
|
||||||
'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(+90);
|
|
||||||
$drawing2->setOffsetY(5);
|
|
||||||
$drawing2->setCoordinates('C1');
|
|
||||||
|
|
||||||
return [$drawing, $drawing2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,17 +2,20 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
||||||
|
|
||||||
use App\Exports\V3\Mission\Report\Machine\machineDetailsReport;
|
|
||||||
use App\Exports\V3\Mission\Report\Machine\machineDriverDetailsReport;
|
|
||||||
use App\Exports\V3\Mission\Report\Machine\machineDriverReport;
|
use App\Exports\V3\Mission\Report\Machine\machineDriverReport;
|
||||||
use App\Exports\V3\Mission\Report\Machine\machineReport;
|
use App\Exports\V3\Mission\Report\Machine\machineReport;
|
||||||
use App\Exports\V3\Mission\Report\Machine\machineTypeDetailsReport;
|
|
||||||
use App\Exports\V3\Mission\Report\Machine\machineTypeReport;
|
use App\Exports\V3\Mission\Report\Machine\machineTypeReport;
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Traits\ApiResponse;
|
use App\Http\Traits\ApiResponse;
|
||||||
|
use App\Models\City;
|
||||||
|
use App\Models\CMMSMachine;
|
||||||
|
use App\Models\Mission;
|
||||||
|
use App\Models\Province;
|
||||||
use App\Services\Cartables\Mission\Report\ReportMachineService;
|
use App\Services\Cartables\Mission\Report\ReportMachineService;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use PhpOffice\PhpSpreadsheet\Exception;
|
use PhpOffice\PhpSpreadsheet\Exception;
|
||||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||||
@@ -21,114 +24,184 @@ class ReportMachineController extends Controller
|
|||||||
{
|
{
|
||||||
use ApiResponse;
|
use ApiResponse;
|
||||||
|
|
||||||
public function machineDetailsReport(Request $request, ReportMachineService $reportMachineService,int $machine_id): JsonResponse
|
public function countryMachinesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->machineDetailActivity($request,$machine_id);
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMachineService->countryMachinesActivity($request),
|
||||||
return response()->json($data);
|
// 'provinces' => Province::all(['id', 'name_fa']),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function machineDetailsReportExcel(Request $request, int $machine_id, ReportMachineService $reportMachineService): BinaryFileResponse
|
public function countryMachinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->machineDetailActivity($request,$machine_id);
|
$data = $reportMachineService->countryMachinesActivity($request);
|
||||||
$name = 'گزارش عملکرد ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
|
||||||
|
|
||||||
return Excel::download(new machineDetailsReport($data['data']), $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function machinesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
|
||||||
{
|
|
||||||
return response()->json($reportMachineService->machinesActivity($request));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function machinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
|
||||||
{
|
|
||||||
$data = $reportMachineService->machinesActivity($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 machineReport($data), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function provinceMachinesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
public function machineTypeDetailsReport(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->machineTypeDetailActivity($request);
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMachineService->provinceMachinesActivity($request),
|
||||||
return response()->json($data);
|
// 'city' => City::query()
|
||||||
|
// ->where('province_id', $request->province_id)
|
||||||
|
// ->where(function ($query) {
|
||||||
|
// $query->where('type_id', 1)
|
||||||
|
// ->orWhereIn('name_fa', ['اداره ماشينآلات', 'اداره نقلیه']);
|
||||||
|
// })
|
||||||
|
// ->get(['id', 'name_fa'])
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function machineTypeDetailsReportExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
public function provinceMachinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->machineTypeDetailActivity($request);
|
$data = $reportMachineService->provinceMachinesActivity($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 machineTypeDetailsReport($data['data']), $name);
|
return Excel::download(new machineReport($data), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function machineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
public function countryMachineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
{
|
{
|
||||||
return response()->json($reportMachineService->machineTypesActivity($request));
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMachineService->countryMachineTypesActivity($request),
|
||||||
|
// 'provinces' => Province::all(['id', 'name_fa']),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function machineTypesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
public function countryMachineTypesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->machineTypesActivity($request);
|
$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 machineTypeReport($data), $name);
|
return Excel::download(new machineTypeReport($data), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function machineDriverDetailsReport(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
public function provinceMachineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->machineDriverDetailActivity($request);
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMachineService->provinceMachineTypesActivity($request),
|
||||||
|
// 'city' => City::query()
|
||||||
|
// ->where('province_id', $request->province_id)
|
||||||
|
// ->where(function ($query) {
|
||||||
|
// $query->where('type_id', 1)
|
||||||
|
// ->orWhereIn('name_fa', ['اداره ماشينآلات', 'اداره نقلیه']);
|
||||||
|
// })
|
||||||
|
// ->get(['id', 'name_fa'])
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json($data);
|
public function machineDetailsReport(Request $request, int $machine_id)
|
||||||
|
{
|
||||||
|
return DataTableFacade::run(
|
||||||
|
Mission::query()->where('machine_id', '=', $machine_id),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
allowedSelects: [
|
||||||
|
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
||||||
|
'end_km', 'km', 'driver_name', 'state_id', 'station_name'
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function machineDriverDetailsReportExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
public function provinceMachineTypesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->machineDriverDetailActivity($request);
|
$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(
|
return Excel::download(new machineTypeReport($data), $name);
|
||||||
new machineDriverDetailsReport($data['data']), $name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function machineDriversActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
public function countryMachineDriversActivity(Request $request, ReportMachineService $reportMachineService)
|
||||||
{
|
{
|
||||||
return response()->json($reportMachineService->machineDriversActivity($request));
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMachineService->countryMachineDriversActivity($request),
|
||||||
|
// 'provinces' => Province::all(['id', 'name_fa']),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function machineDriversActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
public function countryMachineDriversActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->machineDriversActivity($request);
|
$data = $reportMachineService->countryMachineDriversActivity($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 machineDriverReport($data), $name);
|
return Excel::download(new machineDriverReport($data), $name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function provinceMachineDriversActivity(Request $request, ReportMachineService $reportMachineService)
|
||||||
|
{
|
||||||
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMachineService->provinceMachineDriversActivity($request),
|
||||||
|
// 'city' => City::query()
|
||||||
|
// ->where('province_id', $request->province_id)
|
||||||
|
// ->where(function ($query) {
|
||||||
|
// $query->where('type_id', 1)
|
||||||
|
// ->orWhereIn('name_fa', ['اداره ماشينآلات', 'اداره نقلیه']);
|
||||||
|
// })
|
||||||
|
// ->get(['id', 'name_fa'])
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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');
|
||||||
|
return DataTableFacade::run(
|
||||||
|
Mission::query()->whereIn('machine_id', $machineIds),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
allowedSelects: [
|
||||||
|
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
||||||
|
'end_km', 'km', 'driver_name', 'state_name', 'station_name'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function machineDriverDetailsReport(Request $request, int $driver_id)
|
||||||
|
{
|
||||||
|
return DataTableFacade::run(
|
||||||
|
Mission::query()->where('driver_id', '=', $driver_id),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
allowedSelects: [
|
||||||
|
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
||||||
|
'end_km', 'km', 'driver_name', 'state_id', 'station_name'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -197,67 +197,18 @@ class NotificationController extends Controller
|
|||||||
'control' => 0,
|
'control' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($user->hasPermissionTo('manage-transportation-unit-station')) {
|
if ($user->hasPermissionTo('manage-transportation-unit')) {
|
||||||
$missions['transportation'] = Mission::query()->where([
|
$missions['transportation'] = Mission::query()->where([
|
||||||
['state_id', '=', MissionStates::REQUEST_CREATED->value],
|
['state_id', '=', MissionStates::REQUEST_CREATED->value],
|
||||||
['station_id', '=', $user->station_id],
|
['edare_shahri_id', '=', $user->edarate_shahri_id],
|
||||||
])->count();
|
])->count();
|
||||||
}
|
}
|
||||||
if ($user->hasPermissionTo('manage-transportation-unit-country')) {
|
if ($user->hasPermissionTo('manage-control-unit')) {
|
||||||
$missions['transportation'] = Mission::query()->where([
|
$missions['control'] = Mission::query()->where([
|
||||||
['state_id', '=', MissionStates::REQUEST_CREATED->value],
|
['state_id', '=', MissionStates::PENDING_CONFIRMATION->value],
|
||||||
|
['edare_shahri_id', '=', $user->edarate_shahri_id],
|
||||||
])->count();
|
])->count();
|
||||||
}
|
}
|
||||||
if ($user->hasPermissionTo('manage-transportation-unit-province')) {
|
|
||||||
$missions['transportation'] = Mission::query()->where([
|
|
||||||
['state_id', '=', MissionStates::REQUEST_CREATED->value],
|
|
||||||
['province_id', '=', $user->province_id],
|
|
||||||
|
|
||||||
])->count();
|
|
||||||
}
|
|
||||||
if ($user->hasPermissionTo('manage-transportation-unit-city')) {
|
|
||||||
$missions['transportation'] = Mission::query()->where([
|
|
||||||
['state_id', '=', MissionStates::REQUEST_CREATED->value],
|
|
||||||
['city_id', '=', $user->city_id],
|
|
||||||
|
|
||||||
])->count();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($user->hasPermissionTo('manage-control-unit-station')) {
|
|
||||||
$missions['control'] = Mission::query()
|
|
||||||
->whereIn('state_id', [
|
|
||||||
MissionStates::PENDING_CONFIRMATION->value,
|
|
||||||
MissionStates::START_MISSION->value,
|
|
||||||
])
|
|
||||||
->where('station_id', $user->station_id)
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($user->hasPermissionTo('manage-control-unit-country')) {
|
|
||||||
$missions['control'] = Mission::query()
|
|
||||||
->whereIn('state_id', [
|
|
||||||
MissionStates::PENDING_CONFIRMATION->value,
|
|
||||||
MissionStates::START_MISSION->value,
|
|
||||||
])->count();
|
|
||||||
}
|
|
||||||
if ($user->hasPermissionTo('manage-control-unit-province')) {
|
|
||||||
$missions['control'] = Mission::query()
|
|
||||||
->whereIn('state_id', [
|
|
||||||
MissionStates::PENDING_CONFIRMATION->value,
|
|
||||||
MissionStates::START_MISSION->value,
|
|
||||||
])
|
|
||||||
->where('province_id', '=', $user->province_id)
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($user->hasPermissionTo('manage-control-unit-city')) {
|
|
||||||
$missions['control'] = Mission::query()
|
|
||||||
->whereIn('state_id', [
|
|
||||||
MissionStates::PENDING_CONFIRMATION->value,
|
|
||||||
MissionStates::START_MISSION->value,
|
|
||||||
])
|
|
||||||
->where('city_id', '=', $user->city_id
|
|
||||||
)->count();
|
|
||||||
}
|
|
||||||
|
|
||||||
$missions['total'] = $missions['request_portal'] + $missions['transportation'] + $missions['control'];
|
$missions['total'] = $missions['request_portal'] + $missions['transportation'] + $missions['control'];
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Requests\V3\Mission\ControlUnit;
|
namespace App\Http\Requests\V3\Mission\ControlUnit;
|
||||||
|
|
||||||
use App\Enums\MissionStates;
|
use App\Enums\MissionStates;
|
||||||
use App\Models\CMMSMachine;
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
@@ -15,7 +14,7 @@ class FinishRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return $this->mission->state_id === MissionStates::START_MISSION->value;
|
return $this->mission->state_id == MissionStates::START_MISSION->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +34,6 @@ class FinishRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
function (Validator $validator) {
|
function (Validator $validator) {
|
||||||
|
|
||||||
$mission = $this->mission;
|
$mission = $this->mission;
|
||||||
if (strtotime($this->time) < strtotime($mission->start_time)) {
|
if (strtotime($this->time) < strtotime($mission->start_time)) {
|
||||||
$validator->errors()->add(
|
$validator->errors()->add(
|
||||||
@@ -43,25 +41,12 @@ class FinishRequest extends FormRequest
|
|||||||
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->end_km <= $mission->km) {
|
if ($this->end_km <= $mission->km) {
|
||||||
$validator->errors()->add(
|
$validator->errors()->add(
|
||||||
'end_km',
|
'end_km',
|
||||||
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
|
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$machine = CMMSMachine::find($mission->machine_id);
|
|
||||||
|
|
||||||
$distance = $this->end_km - $mission->km;
|
|
||||||
|
|
||||||
if ($distance > $machine->max_mission_duration)
|
|
||||||
{
|
|
||||||
$validator->errors()->add(
|
|
||||||
'end_km',
|
|
||||||
'کیلومتر /ساعت کار از حد نصاب بیشتر هست.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class AllocateRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return ($this->mission->station_id == auth()->user()->station_id && $this->mission->state_id == MissionStates::REQUEST_CREATED->value)
|
return $this->mission->station_id == auth()->user()->station_id && $this->mission->state_id == MissionStates::REQUEST_CREATED->value
|
||||||
|| auth()->user()->username === 'witel';
|
|| auth()->user()->username === 'witel';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,130 +3,135 @@
|
|||||||
namespace App\Services\Cartables\Mission\Report;
|
namespace App\Services\Cartables\Mission\Report;
|
||||||
|
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Models\CMMSMachine;
|
use App\Models\MissionViolation;
|
||||||
use App\Models\Mission;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class ReportMachineService
|
class ReportMachineService
|
||||||
{
|
{
|
||||||
public function machineDetailActivity(Request $request, int $machine_id): array
|
public function countryMachinesActivity(Request $request): array
|
||||||
{
|
{
|
||||||
return DataTableFacade::run(
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
Mission::query()->where('machine_id', '=', $machine_id),
|
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||||
$request,
|
|
||||||
allowedFilters: ['*'],
|
$sql = "SELECT
|
||||||
allowedSortings: ['*'],
|
m.machine_id,
|
||||||
allowedSelects: [
|
m.machine_code,
|
||||||
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
cm.car_name,
|
||||||
'end_km', 'km', 'driver_name', 'state_id', 'station_name'
|
COUNT(*) AS missions,
|
||||||
]
|
SUM(m.end_km - m.km) AS func
|
||||||
);
|
FROM missions m
|
||||||
|
JOIN cmms_machines cm ON cm.id = m.machine_id
|
||||||
|
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to
|
||||||
|
GROUP BY machine_id ORDER BY missions DESC;";
|
||||||
|
|
||||||
|
return DB::select($sql, [
|
||||||
|
'from' => $from,
|
||||||
|
'to' => $to,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function machinesActivity(Request $request): array
|
public function provinceMachinesActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$query = Mission::query()
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
->join('cmms_machines as cm', 'cm.id', '=', 'missions.machine_id')
|
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||||
->where('state_id', '=', 4)
|
$province = $request->province_id;
|
||||||
->when($request->province_id, function ($q) use ($request) {
|
|
||||||
$q->where('missions.province_id', '=', $request->province_id);
|
|
||||||
})
|
|
||||||
->selectRaw(
|
|
||||||
'cm.car_name,
|
|
||||||
missions.machine_code,
|
|
||||||
missions.machine_id,
|
|
||||||
COUNT(*) as missions,
|
|
||||||
SUM(missions.end_km - missions.km) as func'
|
|
||||||
)
|
|
||||||
->groupBy('missions.machine_id');
|
|
||||||
|
|
||||||
$fields = ['machine_code','machine_id','cm.car_name','missions', 'func', 'start_time', 'finish_time', 'province_id'];
|
$sql = "SELECT m.machine_id, m.machine_code, cm.car_name, COUNT(*) AS missions, SUM(m.end_km - m.km) AS func
|
||||||
return DataTableFacade::run(
|
FROM missions m
|
||||||
$query,
|
JOIN cmms_machines cm ON cm.id = m.machine_id
|
||||||
$request,
|
WHERE m.state_id = 4 AND start_time >= :from AND finish_time <= :to AND m.province_id = :province_id
|
||||||
allowedFilters: $fields,
|
GROUP BY machine_id ORDER BY missions DESC;";
|
||||||
allowedSortings: $fields,
|
|
||||||
);
|
return DB::select($sql, [
|
||||||
|
'from' => $from,
|
||||||
|
'to' => $to,
|
||||||
|
'province_id' => $province,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function machineTypeDetailActivity(Request $request): array
|
public function countryMachineTypesActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$machineIds = CMMSMachine::query()->where('car_type', '=', $request->query('car_type'))->pluck('id');
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
return DataTableFacade::run(
|
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||||
Mission::query()->whereIn('machine_id', $machineIds),
|
|
||||||
$request,
|
$sql = "SELECT
|
||||||
allowedFilters: ['*'],
|
cm.car_type,
|
||||||
allowedSortings: ['*'],
|
COUNT(*) AS missions,
|
||||||
allowedSelects: [
|
SUM(m.end_km - m.km) AS func
|
||||||
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
FROM missions m
|
||||||
'end_km', 'km', 'driver_name', 'state_name', 'station_name'
|
JOIN cmms_machines cm ON cm.id = m.machine_id
|
||||||
]
|
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to
|
||||||
);
|
GROUP BY cm.car_type ORDER BY missions DESC;";
|
||||||
|
|
||||||
|
return DB::select($sql, [
|
||||||
|
'from' => $from,
|
||||||
|
'to' => $to,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function machineTypesActivity(Request $request): array
|
public function provinceMachineTypesActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$query = Mission::query()
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
->join('cmms_machines as cm', 'cm.id', '=', 'missions.machine_id')
|
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||||
->where('missions.state_id','=', 4)
|
$province = $request->province_id;
|
||||||
->when($request->province_id, function ($q) use ($request) {
|
|
||||||
$q->where('missions.province_id', $request->province_id);
|
|
||||||
})
|
|
||||||
->selectRaw(
|
|
||||||
'cm.car_type,
|
|
||||||
COUNT(*) as missions,
|
|
||||||
SUM(missions.end_km - missions.km) as func'
|
|
||||||
)
|
|
||||||
->groupBy('cm.car_type')
|
|
||||||
->orderByRaw('COUNT(*) DESC');
|
|
||||||
|
|
||||||
$fields = ['car_type','missions', 'func', 'start_time', 'finish_time', 'province_id'];
|
$sql = "SELECT
|
||||||
|
cm.car_type,
|
||||||
|
COUNT(*) AS missions,
|
||||||
|
SUM(m.end_km - m.km) AS func
|
||||||
|
FROM missions m
|
||||||
|
JOIN cmms_machines cm ON cm.id = m.machine_id
|
||||||
|
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to AND m.province_id = :province_id
|
||||||
|
GROUP BY cm.car_type ORDER BY missions DESC;";
|
||||||
|
|
||||||
return DataTableFacade::run(
|
return DB::select($sql, [
|
||||||
$query,
|
'from' => $from,
|
||||||
$request,
|
'to' => $to,
|
||||||
allowedFilters: $fields,
|
'province_id' => $province,
|
||||||
allowedSortings: $fields,
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function machineDriverDetailActivity(Request $request): array
|
public function countryMachineDriversActivity(Request $request): array
|
||||||
{
|
{
|
||||||
return DataTableFacade::run(
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
Mission::query()->where('driver_id', '=', $request->query('driver_id')),
|
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||||
$request,
|
|
||||||
allowedFilters: ['*'],
|
$sql = "SELECT
|
||||||
allowedSortings: ['*'],
|
m.driver_id,
|
||||||
allowedSelects: [
|
m.driver_name,
|
||||||
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
COUNT(*) AS missions,
|
||||||
'end_km', 'km', 'driver_name', 'state_id', 'station_name'
|
SUM(m.end_km - m.km) AS func
|
||||||
]
|
FROM missions m
|
||||||
);
|
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to
|
||||||
|
GROUP BY m.driver_id ORDER BY missions DESC;";
|
||||||
|
|
||||||
|
return DB::select($sql, [
|
||||||
|
'from' => $from,
|
||||||
|
'to' => $to,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function machineDriversActivity(Request $request): array
|
public function provinceMachineDriversActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$query = Mission::query()
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
->selectRaw(
|
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||||
'driver_id,
|
$province = $request->province_id;
|
||||||
driver_name,
|
|
||||||
COUNT(*) as missions,
|
|
||||||
SUM(end_km - km) as func'
|
|
||||||
)
|
|
||||||
->where('state_id', '=', 4)
|
|
||||||
->when($request->province_id, function ($query) use ($request) {
|
|
||||||
$query->where('province_id', '=', $request->province_id);
|
|
||||||
})
|
|
||||||
->groupBy('driver_id')
|
|
||||||
->orderByRaw('COUNT(*) DESC');
|
|
||||||
|
|
||||||
$fields = ['driver_id','driver_name','missions', 'func', 'start_time', 'finish_time', 'province_id'];
|
$sql = "SELECT
|
||||||
|
m.driver_id,
|
||||||
|
m.driver_name,
|
||||||
|
COUNT(*) AS missions,
|
||||||
|
SUM(m.end_km - m.km) AS func
|
||||||
|
FROM missions m
|
||||||
|
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to AND province_id = :province_id
|
||||||
|
GROUP BY m.driver_id ORDER BY missions DESC;";
|
||||||
|
|
||||||
return DataTableFacade::run(
|
return DB::select($sql, [
|
||||||
$query,
|
'from' => $from,
|
||||||
$request,
|
'to' => $to,
|
||||||
allowedFilters: $fields,
|
'province_id' => $province,
|
||||||
allowedSortings: $fields,
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::table('cmms_machines', function (Blueprint $table) {
|
|
||||||
$table->integer('max_mission_duration')->nullable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::table('cmms_machines', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('max_mission_duration');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>گزارش کل تردد های یک ماشین </title>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
table,
|
|
||||||
th,
|
|
||||||
td {
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body dir="rtl" style="text-align: center;">
|
|
||||||
@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
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
|
||||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
|
||||||
گزارش ماشین های ماموریت رفته
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کد یکتا
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
استان
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
شهر </th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
راهدارخانه
|
|
||||||
</th>
|
|
||||||
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
نام راننده
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کیلومتر شروع
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کیلومتر پایان </th>
|
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
@foreach ($rows as $item)
|
|
||||||
<tr>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['id'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['province_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['city_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['station_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['driver_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['km'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['end_km'] ?? '-' }}</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>گزارش کل تردد های راننده </title>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
table,
|
|
||||||
th,
|
|
||||||
td {
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body dir="rtl" style="text-align: center;">
|
|
||||||
@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
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
|
||||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
|
||||||
گزارش عملکرد راندده در ماموریت
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کد یکتا
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
استان
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
شهر </th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
راهدارخانه
|
|
||||||
</th>
|
|
||||||
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
نام راننده
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کیلومتر شروع
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کیلومتر پایان </th>
|
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
@foreach ($rows as $item)
|
|
||||||
<tr>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['id'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['province_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['city_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['station_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['driver_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['km'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['end_km'] ?? '-' }}</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>گزارش ترددهای انواع ماشین ها</title>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
table,
|
|
||||||
th,
|
|
||||||
td {
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body dir="rtl" style="text-align: center;">
|
|
||||||
@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
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
|
||||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"
|
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
|
||||||
گزارش نوع ماشین هادرماموریت
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کد یکتا
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
استان
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
شهر </th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
راهدارخانه
|
|
||||||
</th>
|
|
||||||
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
نام راننده
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کیلومتر شروع
|
|
||||||
</th>
|
|
||||||
<th rowspan="1"
|
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
|
||||||
کیلومتر پایان </th>
|
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
@foreach ($rows as $item)
|
|
||||||
<tr>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['id'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['province_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['city_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['station_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['driver_name'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['km'] ?? '-' }}</td>
|
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['end_km'] ?? '-' }}</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -566,19 +566,21 @@ Route::prefix('missions')
|
|||||||
->middleware(['permission:mission-report-province|mission-report-country'])
|
->middleware(['permission:mission-report-province|mission-report-country'])
|
||||||
->controller(ReportMachineController::class)
|
->controller(ReportMachineController::class)
|
||||||
->group(function () {
|
->group(function () {
|
||||||
Route::get('/machines_activity', 'machinesActivity')->name('machinesActivity');
|
Route::get('/country_machines_activity', 'countryMachinesActivity')->name('countryMachinesActivity');
|
||||||
Route::get('/machines_activity_excel', 'machinesActivityExcel')->name('machinesActivityExcel');
|
Route::get('/country_machines_activity_excel', 'countryMachinesActivityExcel')->name('countryMachinesActivityExcel');
|
||||||
|
Route::get('/province_machines_activity', 'provinceMachinesActivity')->name('provinceMachinesActivity');
|
||||||
Route::get('/machine_types_activity', 'machineTypesActivity')->name('machineTypesActivity');
|
Route::get('/province_machines_activity_excel', 'provinceMachinesActivityExcel')->name('provinceMachinesActivityExcel');
|
||||||
Route::get('/machine_types_activity_excel', 'machineTypesActivityExcel')->name('machineTypesActivityExcel');
|
Route::get('/country_machine_types_activity', 'countryMachineTypesActivity')->name('countryMachineTypesActivity');
|
||||||
Route::get('/machine_drivers_activity', 'machineDriversActivity')->name('machineDriversActivity');
|
Route::get('/country_machine_types_activity_excel', 'countryMachineTypesActivityExcel')->name('countryMachineTypesActivityExcel');
|
||||||
Route::get('/machine_drivers_activity_excel', 'machineDriversActivityExcel')->name('machineDriversActivityExcel');
|
Route::get('/province_machine_types_activity', 'provinceMachineTypesActivity')->name('provinceMachineTypesActivity');
|
||||||
|
Route::get('/province_machine_types_activity_excel', 'provinceMachineTypesActivityExcel')->name('provinceMachineTypesActivityExcel');
|
||||||
|
Route::get('/country_machine_drivers_activity', 'countryMachineDriversActivity')->name('countryMachineDriversActivity');
|
||||||
|
Route::get('/country_machine_drivers_activity_excel', 'countryMachineDriversActivityExcel')->name('countryMachineDriversActivityExcel');
|
||||||
|
Route::get('/province_machine_drivers_activity', 'provinceMachineDriversActivity')->name('provinceMachineDriversActivity');
|
||||||
|
Route::get('/province_machine_drivers_activity_excel', 'provinceMachineDriversActivityExcel')->name('provinceMachineDriversActivityExcel');
|
||||||
Route::get('/machine_details_report/{machine_id}', 'machineDetailsReport')->name('machineDetailsReport');
|
Route::get('/machine_details_report/{machine_id}', 'machineDetailsReport')->name('machineDetailsReport');
|
||||||
Route::get('/machine_details_report_excel/{machine_id}', 'machineDetailsReportExcel')->name('machineDetailsReportExcel');
|
Route::get('/machine_driver_details_report/{driver_id}', 'machineDriverDetailsReport')->name('machineDriverDetailsReport');
|
||||||
Route::get('/machine_type_details_report', 'machineTypeDetailsReport')->name('machineTypeDetailsReport');
|
Route::get('/machine_type_details_report', ' machineTypeDetailsReport')->name('machineTypeDetailsReport');
|
||||||
Route::get('/machine_type_details_report_excel', 'machineTypeDetailsReportExcel')->name('machineTypeDetailsReportExcel');
|
|
||||||
Route::get('/machine_driver_details_report', 'machineDriverDetailsReport')->name('machineDriverDetailsReport');
|
|
||||||
Route::get('/machine_driver_details_report_excel', 'machineDriverDetailsReportExcel')->name('machineDriverDetailsReportExcel');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user