create receipt report logic
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Reports;
|
||||
|
||||
use App\Exports\V3\AccidentReceipt\CityReport;
|
||||
use App\Exports\V3\AccidentReceipt\ProvinceReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Services\Cartables\AccidentReceiptTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class AccidentReceiptReportController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function provinceReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->provinceReport($request);
|
||||
return $this->successResponse($data['data']);
|
||||
}
|
||||
|
||||
public function cityReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->cityReport($request);
|
||||
return $this->successResponse($data['data']);
|
||||
}
|
||||
|
||||
public function provinceExcelReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->provinceReport($request);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ProvinceReport($data), $name);
|
||||
}
|
||||
|
||||
public function cityExcelReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->cityReport($request);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new CityReport($data), $name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user