create excel for report in mission

This commit is contained in:
amirghasempoor
2026-06-14 14:14:30 +03:30
parent ab9838c1bc
commit 39752fd5ba
6 changed files with 329 additions and 6 deletions

View File

@@ -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');