change Format table report
This commit is contained in:
102
app/Exports/V3/Mission/Report/Tradod/CountryReport.php
Normal file
102
app/Exports/V3/Mission/Report/Tradod/CountryReport.php
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exports\V3\Mission\Report\Tradod;
|
||||||
|
|
||||||
|
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\Worksheet\Drawing;
|
||||||
|
|
||||||
|
class CountryReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||||
|
{
|
||||||
|
public function __construct(private array $data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$grid = [];
|
||||||
|
$national = null;
|
||||||
|
|
||||||
|
foreach ($this->data as $r) {
|
||||||
|
$pid = (int) $r->province_id;
|
||||||
|
$name = $r->province_name;
|
||||||
|
|
||||||
|
if ($pid === -1) {
|
||||||
|
$national = [
|
||||||
|
'province_name' => $name,
|
||||||
|
'total_missions' => (int) ($r->total_missions ?? 0),
|
||||||
|
'taradod_khareg_mahdode' => (int) ($r->taradod_khareg_mahdode ?? 0),
|
||||||
|
'bafarayand_saeti' => (int) ($r->bafarayand_saeti ?? 0),
|
||||||
|
'bafarayand_rozaneh' => (int) ($r->bafarayand_rozaneh ?? 0),
|
||||||
|
'bedon_bafarayand_saeti' => (int) ($r->bedon_bafarayand_saeti ?? 0),
|
||||||
|
'bedon_bafarayand_rozaneh' => (int) ($r->bedon_bafarayand_rozaneh ?? 0),
|
||||||
|
];
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isset($grid[$pid])) {
|
||||||
|
$grid[$pid] = [
|
||||||
|
'province_name' => $name,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$grid[$pid]['total_missions'] = (int) ($r->total_missions ?? 0);
|
||||||
|
$grid[$pid]['taradod_khareg_mahdode'] = (int) ($r->taradod_khareg_mahdode ?? 0);
|
||||||
|
$grid[$pid]['bafarayand_saeti'] = (int) ($r->bafarayand_saeti ?? 0);
|
||||||
|
$grid[$pid]['bafarayand_rozaneh'] = (int) ($r->bafarayand_rozaneh ?? 0);
|
||||||
|
$grid[$pid]['bedon_bafarayand_saeti'] = (int) ($r->bedon_bafarayand_saeti ?? 0);
|
||||||
|
$grid[$pid]['bedon_bafarayand_rozaneh'] = (int) ($r->bedon_bafarayand_rozaneh ?? 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$exportRows = [];
|
||||||
|
if ($national) {
|
||||||
|
$exportRows[] = $national;
|
||||||
|
}
|
||||||
|
foreach ($grid as $row) {
|
||||||
|
$exportRows[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('v3.Reports.Mission.Report.CountryActivityReport', [
|
||||||
|
'rows' => $exportRows,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
AfterSheet::class => function (AfterSheet $event) {
|
||||||
|
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
107
app/Exports/V3/Mission/Report/Tradod/ProvinceReport.php
Normal file
107
app/Exports/V3/Mission/Report/Tradod/ProvinceReport.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exports\V3\Mission\Report\Tradod;
|
||||||
|
|
||||||
|
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 ProvinceReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||||
|
{
|
||||||
|
public function __construct(private array $data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$grid = [];
|
||||||
|
$province = null;
|
||||||
|
|
||||||
|
foreach ($this->data as $r) {
|
||||||
|
$cid = (int) $r->city_id;
|
||||||
|
$name = $r->city_name;
|
||||||
|
|
||||||
|
if ($cid === -1) {
|
||||||
|
$province = [
|
||||||
|
'city_name' => $name,
|
||||||
|
'total_missions' => (int) ($r->total_missions ?? 0),
|
||||||
|
'taradod_khareg_mahdode' => (int) ($r->taradod_khareg_mahdode ?? 0),
|
||||||
|
'bafarayand_saeti' => (int) ($r->bafarayand_saeti ?? 0),
|
||||||
|
'bafarayand_rozaneh' => (int) ($r->bafarayand_rozaneh ?? 0),
|
||||||
|
'bedon_bafarayand_saeti' => (int) ($r->bedon_bafarayand_saeti ?? 0),
|
||||||
|
'bedon_bafarayand_rozaneh' => (int) ($r->bedon_bafarayand_rozaneh ?? 0),
|
||||||
|
];
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isset($grid[$cid])) {
|
||||||
|
$grid[$cid] = [
|
||||||
|
'city_name' => $name,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$grid[$cid]['total_missions'] = (int) ($r->total_missions ?? 0);
|
||||||
|
$grid[$cid]['taradod_khareg_mahdode'] = (int) ($r->taradod_khareg_mahdode ?? 0);
|
||||||
|
$grid[$cid]['bafarayand_saeti'] = (int) ($r->bafarayand_saeti ?? 0);
|
||||||
|
$grid[$cid]['bafarayand_rozaneh'] = (int) ($r->bafarayand_rozaneh ?? 0);
|
||||||
|
$grid[$cid]['bedon_bafarayand_saeti'] = (int) ($r->bedon_bafarayand_saeti ?? 0);
|
||||||
|
$grid[$cid]['bedon_bafarayand_rozaneh'] = (int) ($r->bedon_bafarayand_rozaneh ?? 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$exportRows = [];
|
||||||
|
if ($province) {
|
||||||
|
$exportRows[] = $province;
|
||||||
|
}
|
||||||
|
foreach ($grid as $row) {
|
||||||
|
$exportRows[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('v3.Reports.Mission.Report.ProvinceActivityReport', [
|
||||||
|
'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];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Exports\V3\Mission\Report;
|
namespace App\Exports\V3\Mission\Report\Violation;
|
||||||
|
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Maatwebsite\Excel\Concerns\FromView;
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
@@ -28,8 +28,11 @@ class CountryReport implements FromView, ShouldAutoSize, WithDrawings, WithEvent
|
|||||||
if ($pid === -1) {
|
if ($pid === -1) {
|
||||||
$national = [
|
$national = [
|
||||||
'province_name' => $name,
|
'province_name' => $name,
|
||||||
'no_mission_count' => (int) ($r->no_mission_count ?? 0),
|
'total_violations' => (int) ($r->total_violations ?? 0),
|
||||||
'out_of_area_count' => (int) ($r->out_of_area_count ?? 0),
|
'egdam_shode' => (int) ($r->egdam_shode ?? 0),
|
||||||
|
'bedone_egdam' => (int) ($r->bedone_egdam ?? 0),
|
||||||
|
'sabt_gps' => (int) ($r->sabt_gps ?? 0),
|
||||||
|
'sabt_herasat' => (int) ($r->herasat ?? 0),
|
||||||
];
|
];
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -41,8 +44,11 @@ class CountryReport implements FromView, ShouldAutoSize, WithDrawings, WithEvent
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$grid[$pid]['no_mission_count'] = (int) ($r->no_mission_count ?? 0);
|
$grid[$pid]['total_violations'] = (int) ($r->total_violations ?? 0);
|
||||||
$grid[$pid]['out_of_area_count'] = (int) ($r->out_of_area_count ?? 0);
|
$grid[$pid]['egdam_shode'] = (int) ($r->egdam_shode ?? 0);
|
||||||
|
$grid[$pid]['bedone_egdam'] = (int) ($r->bedone_egdam ?? 0);
|
||||||
|
$grid[$pid]['sabt_gps'] = (int) ($r->sabt_gps ?? 0);
|
||||||
|
$grid[$pid]['sabt_herasat'] = (int) ($r->sabt_herasat ?? 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Exports\V3\Mission\Report;
|
namespace App\Exports\V3\Mission\Report\Violation;
|
||||||
|
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Maatwebsite\Excel\Concerns\FromView;
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
@@ -29,8 +29,12 @@ class ProvinceReport implements FromView, ShouldAutoSize, WithDrawings, WithEven
|
|||||||
if ($cid === -1) {
|
if ($cid === -1) {
|
||||||
$province = [
|
$province = [
|
||||||
'city_name' => $name,
|
'city_name' => $name,
|
||||||
'no_mission_count' => (int) ($r->no_mission_count ?? 0),
|
'total_violations' => (int) ($r->total_violations ?? 0),
|
||||||
'out_of_area_count' => (int) ($r->out_of_area_count ?? 0),
|
'egdam_shode' => (int) ($r->egdam_shode ?? 0),
|
||||||
|
'bedone_egdam' => (int) ($r->bedone_egdam ?? 0),
|
||||||
|
'sabt_gps' => (int) ($r->sabt_gps ?? 0),
|
||||||
|
'sabt_herasat' => (int) ($r->herasat ?? 0),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -42,8 +46,11 @@ class ProvinceReport implements FromView, ShouldAutoSize, WithDrawings, WithEven
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$grid[$cid]['no_mission_count'] = (int) ($r->no_mission_count ?? 0);
|
$grid[$cid]['total_violations'] = (int) ($r->total_violations ?? 0);
|
||||||
$grid[$cid]['out_of_area_count'] = (int) ($r->out_of_area_count ?? 0);
|
$grid[$cid]['egdam_shode'] = (int) ($r->egdam_shode ?? 0);
|
||||||
|
$grid[$cid]['bedone_egdam'] = (int) ($r->bedone_egdam ?? 0);
|
||||||
|
$grid[$cid]['sabt_gps'] = (int) ($r->sabt_gps ?? 0);
|
||||||
|
$grid[$cid]['sabt_herasat'] = (int) ($r->sabt_herasat ?? 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
||||||
|
|
||||||
|
use App\Exports\V3\Mission\Report\Violation\CountryReport;
|
||||||
|
use App\Exports\V3\Mission\Report\Violation\ProvinceReport;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Traits\ApiResponse;
|
||||||
|
use App\Models\City;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Services\Cartables\Mission\Report\ReportTradodService;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Exception;
|
||||||
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||||
|
|
||||||
|
class ReportTradodController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function countryActivity(Request $request, ReportTradodService $reportMissionService): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMissionService->countryActivity($request),
|
||||||
|
'provinces' => Province::all(['id', 'name_fa']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provinceActivity(Request $request, ReportTradodService $reportMissionService): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse([
|
||||||
|
'activities' =>$reportMissionService->provinceActivity($request),
|
||||||
|
'city' => City::query()->where('province_id', $request->province_id)->get(['id', 'name_fa']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
|
*/
|
||||||
|
public function countryExcelActivity(Request $request, ReportTradodService $reportMissionService): BinaryFileResponse
|
||||||
|
{
|
||||||
|
$data = $reportMissionService->countryActivity($request);
|
||||||
|
$name = 'گزارش کل تردد '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||||
|
|
||||||
|
return Excel::download(new CountryReport($data), $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
|
*/
|
||||||
|
public function provinceExcelActivity(Request $request, ReportTradodService $reportMissionService): BinaryFileResponse
|
||||||
|
{
|
||||||
|
$data = $reportMissionService->provinceActivity($request);
|
||||||
|
$name = 'گزارش کل تردد '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||||
|
|
||||||
|
return Excel::download(new ProvinceReport($data), $name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
||||||
|
|
||||||
use App\Exports\V3\Mission\Report\CountryReport;
|
use App\Exports\V3\Mission\Report\Violation\CountryReport;
|
||||||
use App\Exports\V3\Mission\Report\ProvinceReport;
|
use App\Exports\V3\Mission\Report\Violation\ProvinceReport;
|
||||||
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\City;
|
||||||
use App\Models\Province;
|
use App\Models\Province;
|
||||||
use App\Services\Cartables\Mission\ReportService;
|
use App\Services\Cartables\Mission\Report\ReportViolationService;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
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;
|
||||||
|
|
||||||
class ReportController extends Controller
|
class ReportViolationController extends Controller
|
||||||
{
|
{
|
||||||
use ApiResponse;
|
use ApiResponse;
|
||||||
|
|
||||||
public function countryActivity(Request $request, ReportService $reportService): JsonResponse
|
public function countryActivity(Request $request, ReportViolationService $reportService): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse([
|
return $this->successResponse([
|
||||||
'activities' => $reportService->countryActivity($request),
|
'activities' => $reportService->countryActivity($request),
|
||||||
@@ -27,7 +27,7 @@ class ReportController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceActivity(Request $request, ReportService $reportService): JsonResponse
|
public function provinceActivity(Request $request, ReportViolationService $reportService): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse([
|
return $this->successResponse([
|
||||||
'activities' =>$reportService->provinceActivity($request),
|
'activities' =>$reportService->provinceActivity($request),
|
||||||
@@ -39,7 +39,7 @@ class ReportController extends Controller
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function countryExcelActivity(Request $request, ReportService $reportService): BinaryFileResponse
|
public function countryExcelActivity(Request $request, ReportViolationService $reportService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportService->countryActivity($request);
|
$data = $reportService->countryActivity($request);
|
||||||
$name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
$name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||||
@@ -51,7 +51,7 @@ class ReportController extends Controller
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function provinceExcelActivity(Request $request, ReportService $reportService): BinaryFileResponse
|
public function provinceExcelActivity(Request $request, ReportViolationService $reportService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportService->provinceActivity($request);
|
$data = $reportService->provinceActivity($request);
|
||||||
$name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
$name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||||
161
app/Services/Cartables/Mission/Report/ReportTradodService.php
Normal file
161
app/Services/Cartables/Mission/Report/ReportTradodService.php
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Cartables\Mission\Report;
|
||||||
|
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Models\MissionViolation;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class ReportTradodService
|
||||||
|
{
|
||||||
|
public function dataTable(Request $request)
|
||||||
|
{
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
$query = MissionViolation::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||||
|
|
||||||
|
return DataTableFacade::run(
|
||||||
|
$query,
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countryActivity(Request $request): array
|
||||||
|
{
|
||||||
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
|
$to = Carbon::parse($request->to_date)->endOfDay() ?? today()->endOfDay();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
WITH r AS (
|
||||||
|
SELECT
|
||||||
|
p.id AS province_id,
|
||||||
|
p.name_fa AS province_name,
|
||||||
|
|
||||||
|
COUNT(DISTINCT m.id) AS total_missions,
|
||||||
|
SUM(CASE WHEN m.mission_duration != m.in_area_duration THEN 1 ELSE 0 END) AS taradod_khareg_mahdode,
|
||||||
|
SUM(CASE WHEN m.mission_status = 1 THEN 1 ELSE 0 END) AS bafarayand_saeti,
|
||||||
|
SUM(CASE WHEN m.mission_status = 2 THEN 1 ELSE 0 END) AS bafarayand_rozaneh,
|
||||||
|
SUM(CASE WHEN m.mission_status = 3 THEN 1 ELSE 0 END) AS bedon_bafarayand_saeti,
|
||||||
|
SUM(CASE WHEN m.mission_status = 4 THEN 1 ELSE 0 END) AS bedon_bafarayand_rozaneh,
|
||||||
|
|
||||||
|
FROM provinces
|
||||||
|
|
||||||
|
LEFT JOIN missions m
|
||||||
|
ON m.province_id = p.id
|
||||||
|
AND m.created_at >= :from_m
|
||||||
|
AND m.created_at <= :to_m
|
||||||
|
|
||||||
|
GROUP BY p.id, p.name_fa
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
-1 AS province_id,
|
||||||
|
'کل کشور' AS province_name,
|
||||||
|
SUM(total_missions) AS total_missions,
|
||||||
|
SUM(taradod_khareg_mahdode) AS taradod_khareg_mahdode,
|
||||||
|
SUM(bafarayand_saeti) AS bafarayand_saeti,
|
||||||
|
SUM(bafarayand_rozaneh) AS bafarayand_rozaneh,
|
||||||
|
SUM(bedon_bafarayand_saeti) AS bedon_bafarayand_saeti,
|
||||||
|
SUM(bedon_bafarayand_rozaneh) AS bedon_bafarayand_rozaneh
|
||||||
|
FROM r
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
province_id,
|
||||||
|
province_name,
|
||||||
|
total_missions,
|
||||||
|
taradod_khareg_mahdode,
|
||||||
|
bafarayand_saeti,
|
||||||
|
bafarayand_rozaneh,
|
||||||
|
bedon_bafarayand_saeti,
|
||||||
|
bedon_bafarayand_rozaneh
|
||||||
|
FROM r
|
||||||
|
|
||||||
|
ORDER BY
|
||||||
|
CASE WHEN province_id = -1 THEN 0 ELSE 1 END,
|
||||||
|
province_name
|
||||||
|
";
|
||||||
|
|
||||||
|
return DB::select($sql, [
|
||||||
|
'from_mv' => $from,
|
||||||
|
'to_mv' => $to,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provinceActivity(Request $request): array
|
||||||
|
{
|
||||||
|
$provinceId = $request->province_id ?? auth()->user()->province_id;
|
||||||
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
|
$to = Carbon::parse($request->to_date)->endOfDay() ?? today()->endOfDay();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
WITH r AS (
|
||||||
|
SELECT
|
||||||
|
c.id AS city_id,
|
||||||
|
c.name_fa AS city_name,
|
||||||
|
|
||||||
|
COUNT(DISTINCT m.id) AS total_missions,
|
||||||
|
SUM(CASE WHEN m.mission_duration != m.in_area_duration THEN 1 ELSE 0 END) AS taradod_khareg_mahdode,
|
||||||
|
SUM(CASE WHEN m.mission_status = 1 THEN 1 ELSE 0 END) AS bafarayand_saeti,
|
||||||
|
SUM(CASE WHEN m.mission_status = 2 THEN 1 ELSE 0 END) AS bafarayand_rozaneh,
|
||||||
|
SUM(CASE WHEN m.mission_status = 3 THEN 1 ELSE 0 END) AS bedon_bafarayand_saeti,
|
||||||
|
SUM(CASE WHEN m.mission_status = 4 THEN 1 ELSE 0 END) AS bedon_bafarayand_rozaneh,
|
||||||
|
|
||||||
|
FROM cities c
|
||||||
|
LEFT JOIN cmms_machines cm
|
||||||
|
ON cm.city_id = c.id
|
||||||
|
|
||||||
|
LEFT JOIN missions m
|
||||||
|
ON m.province_id = p.id
|
||||||
|
AND m.created_at >= :from_m
|
||||||
|
AND m.created_at <= :to_m
|
||||||
|
|
||||||
|
WHERE c.province_id = :province_id
|
||||||
|
AND (
|
||||||
|
c.type_id = 1
|
||||||
|
OR c.name_fa IN ('اداره ماشينآلات', 'اداره نقلیه')
|
||||||
|
)
|
||||||
|
GROUP BY c.id, c.name_fa
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
-1 AS city_id,
|
||||||
|
'کل استان' AS city_name,
|
||||||
|
SUM(total_missions) AS total_missions,
|
||||||
|
SUM(taradod_khareg_mahdode) AS taradod_khareg_mahdode,
|
||||||
|
SUM(bafarayand_saeti) AS bafarayand_saeti,
|
||||||
|
SUM(bafarayand_rozaneh) AS bafarayand_rozaneh,
|
||||||
|
SUM(bedon_bafarayand_saeti) AS bedon_bafarayand_saeti,
|
||||||
|
SUM(bedon_bafarayand_rozaneh) AS bedon_bafarayand_rozaneh
|
||||||
|
FROM r
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
city_id,
|
||||||
|
city_name,
|
||||||
|
total_missions,
|
||||||
|
taradod_khareg_mahdode,
|
||||||
|
bafarayand_saeti,
|
||||||
|
bafarayand_rozaneh,
|
||||||
|
bedon_bafarayand_saeti,
|
||||||
|
bedon_bafarayand_rozaneh
|
||||||
|
FROM r
|
||||||
|
|
||||||
|
ORDER BY
|
||||||
|
CASE WHEN city_id = -1 THEN 0 ELSE 1 END,
|
||||||
|
city_name
|
||||||
|
";
|
||||||
|
|
||||||
|
return DB::select($sql, [
|
||||||
|
'province_id' => $provinceId,
|
||||||
|
'from_mv' => $from,
|
||||||
|
'to_mv' => $to,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Cartables\Mission;
|
namespace App\Services\Cartables\Mission\Report;
|
||||||
|
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Models\MissionViolation;
|
use App\Models\MissionViolation;
|
||||||
@@ -8,7 +8,7 @@ use Carbon\Carbon;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class ReportService
|
class ReportViolationService
|
||||||
{
|
{
|
||||||
public function dataTable(Request $request)
|
public function dataTable(Request $request)
|
||||||
{
|
{
|
||||||
@@ -35,8 +35,11 @@ class ReportService
|
|||||||
p.id AS province_id,
|
p.id AS province_id,
|
||||||
p.name_fa AS province_name,
|
p.name_fa AS province_name,
|
||||||
|
|
||||||
COUNT(DISTINCT mv.id) AS no_mission_count,
|
COUNT(DISTINCT mv.id) AS total_violations,
|
||||||
COUNT(DISTINCT m.id) AS out_of_area_count
|
SUM(CASE WHEN mv.status = 1 THEN 1 ELSE 0 END) AS egdam_shode,
|
||||||
|
SUM(CASE WHEN mv.status = 2 THEN 1 ELSE 0 END) AS bedone_egdam,
|
||||||
|
SUM(CASE WHEN mv.gps = 1 THEN 1 ELSE 0 END) AS sabt_gps,
|
||||||
|
SUM(CASE WHEN mv.gps = 0 THEN 1 ELSE 0 END) AS sabt_herasat
|
||||||
|
|
||||||
FROM provinces p
|
FROM provinces p
|
||||||
|
|
||||||
@@ -45,15 +48,9 @@ class ReportService
|
|||||||
|
|
||||||
LEFT JOIN mission_violations mv
|
LEFT JOIN mission_violations mv
|
||||||
ON TRIM(cm.machine_code) = TRIM(mv.machine_code)
|
ON TRIM(cm.machine_code) = TRIM(mv.machine_code)
|
||||||
AND mv.type = 1
|
AND mv.type = 1
|
||||||
AND mv.created_at >= :from_mv
|
AND mv.created_at >= :from_mv
|
||||||
AND mv.created_at <= :to_mv
|
AND mv.created_at <= :to_mv
|
||||||
|
|
||||||
LEFT JOIN missions m
|
|
||||||
ON m.province_id = p.id
|
|
||||||
AND m.mission_duration != m.in_area_duration
|
|
||||||
AND m.created_at >= :from_m
|
|
||||||
AND m.created_at <= :to_m
|
|
||||||
|
|
||||||
GROUP BY p.id, p.name_fa
|
GROUP BY p.id, p.name_fa
|
||||||
)
|
)
|
||||||
@@ -61,14 +58,23 @@ class ReportService
|
|||||||
SELECT
|
SELECT
|
||||||
-1 AS province_id,
|
-1 AS province_id,
|
||||||
'کل کشور' AS province_name,
|
'کل کشور' AS province_name,
|
||||||
SUM(no_mission_count) AS no_mission_count,
|
SUM(total_violations) AS total_violations,
|
||||||
SUM(out_of_area_count) AS out_of_area_count
|
SUM(egdam_shode) AS egdam_shode,
|
||||||
|
SUM(bedone_egdam) AS bedone_egdam,
|
||||||
|
SUM(sabt_gps) AS sabt_gps,
|
||||||
|
SUM(sabt_herasat) AS sabt_herasat
|
||||||
FROM r
|
FROM r
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
province_id, province_name, no_mission_count, out_of_area_count
|
province_id,
|
||||||
|
province_name,
|
||||||
|
total_violations,
|
||||||
|
egdam_shode,
|
||||||
|
bedone_egdam,
|
||||||
|
sabt_gps,
|
||||||
|
sabt_herasat
|
||||||
FROM r
|
FROM r
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
@@ -79,8 +85,6 @@ class ReportService
|
|||||||
return DB::select($sql, [
|
return DB::select($sql, [
|
||||||
'from_mv' => $from,
|
'from_mv' => $from,
|
||||||
'to_mv' => $to,
|
'to_mv' => $to,
|
||||||
'from_m' => $from,
|
|
||||||
'to_m' => $to,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +100,11 @@ class ReportService
|
|||||||
c.id AS city_id,
|
c.id AS city_id,
|
||||||
c.name_fa AS city_name,
|
c.name_fa AS city_name,
|
||||||
|
|
||||||
COUNT(DISTINCT mv.id) AS no_mission_count,
|
COUNT(DISTINCT mv.id) AS total_violations,
|
||||||
COUNT(DISTINCT m.id) AS out_of_area_count
|
SUM(CASE WHEN mv.status = 1 THEN 1 ELSE 0 END) AS egdam_shode,
|
||||||
|
SUM(CASE WHEN mv.status = 2 THEN 1 ELSE 0 END) AS bedone_egdam,
|
||||||
|
SUM(CASE WHEN mv.gps = 1 THEN 1 ELSE 0 END) AS sabt_gps,
|
||||||
|
SUM(CASE WHEN mv.gps = 0 THEN 1 ELSE 0 END) AS sabt_herasat
|
||||||
|
|
||||||
FROM cities c
|
FROM cities c
|
||||||
LEFT JOIN cmms_machines cm
|
LEFT JOIN cmms_machines cm
|
||||||
@@ -109,12 +116,6 @@ class ReportService
|
|||||||
AND mv.created_at >= :from_mv
|
AND mv.created_at >= :from_mv
|
||||||
AND mv.created_at <= :to_mv
|
AND mv.created_at <= :to_mv
|
||||||
|
|
||||||
LEFT JOIN missions m
|
|
||||||
ON m.city_id = c.id
|
|
||||||
AND m.mission_duration != m.in_area_duration
|
|
||||||
AND m.created_at >= :from_m
|
|
||||||
AND m.created_at <= :to_m
|
|
||||||
|
|
||||||
WHERE c.province_id = :province_id
|
WHERE c.province_id = :province_id
|
||||||
AND (
|
AND (
|
||||||
c.type_id = 1
|
c.type_id = 1
|
||||||
@@ -126,14 +127,23 @@ class ReportService
|
|||||||
SELECT
|
SELECT
|
||||||
-1 AS city_id,
|
-1 AS city_id,
|
||||||
'کل استان' AS city_name,
|
'کل استان' AS city_name,
|
||||||
SUM(no_mission_count) AS no_mission_count,
|
SUM(total_violations) AS total_violations,
|
||||||
SUM(out_of_area_count) AS out_of_area_count
|
SUM(egdam_shode) AS egdam_shode,
|
||||||
|
SUM(bedone_egdam) AS bedone_egdam,
|
||||||
|
SUM(sabt_gps) AS sabt_gps,
|
||||||
|
SUM(sabt_herasat) AS sabt_herasat
|
||||||
FROM r
|
FROM r
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
city_id, city_name, no_mission_count, out_of_area_count
|
city_id,
|
||||||
|
city_name,
|
||||||
|
total_violations,
|
||||||
|
egdam_shode,
|
||||||
|
bedone_egdam,
|
||||||
|
sabt_gps,
|
||||||
|
sabt_herasat
|
||||||
FROM r
|
FROM r
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
@@ -145,8 +155,6 @@ class ReportService
|
|||||||
'province_id' => $provinceId,
|
'province_id' => $provinceId,
|
||||||
'from_mv' => $from,
|
'from_mv' => $from,
|
||||||
'to_mv' => $to,
|
'to_mv' => $to,
|
||||||
'from_m' => $from,
|
|
||||||
'to_m' => $to,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,11 +50,23 @@
|
|||||||
</th>
|
</th>
|
||||||
<th rowspan="1"
|
<th rowspan="1"
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
خروج بدون ماموریت </th>
|
کل تخلفات </th>
|
||||||
|
|
||||||
<th rowspan="1"
|
<th rowspan="1"
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
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;">
|
||||||
|
ثبت GPS</th>
|
||||||
|
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
ثبت حراست
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -63,8 +75,11 @@
|
|||||||
@foreach ($rows as $item)
|
@foreach ($rows as $item)
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['province_name'] ?? '-' }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $item['province_name'] ?? '-' }}</td>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['no_mission_count'] ?? '-' }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $item['total_violations'] ?? '-' }}</td>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['out_of_area_count'] ?? '-' }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $item['egdam_shode'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bedone_egdam'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['sabt_gps'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['sabt_herasat'] ?? '-' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -50,14 +50,24 @@
|
|||||||
</th>
|
</th>
|
||||||
<th rowspan="1"
|
<th rowspan="1"
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
خروج بدون ماموریت </th>
|
کل تخلفات </th>
|
||||||
|
|
||||||
<th rowspan="1"
|
<th rowspan="1"
|
||||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
خارج از محدوده
|
اقدام شده
|
||||||
</th>
|
</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;">
|
||||||
|
ثبت GPS</th>
|
||||||
|
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
ثبت حراست
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@@ -65,8 +75,11 @@
|
|||||||
@foreach ($rows as $item)
|
@foreach ($rows as $item)
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['city_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['no_mission_count'] ?? '-' }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $item['total_violations'] ?? '-' }}</td>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['out_of_area_count'] ?? '-' }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $item['egdam_shode'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bedone_egdam'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['sabt_gps'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['sabt_herasat'] ?? '-' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<!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['province_name'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['total_missions'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['taradod_khareg_mahdode'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bafarayand_saeti'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bafarayand_rozaneh'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bedon_bafarayand_saeti'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bedon_bafarayand_rozaneh'] ?? '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fa">
|
||||||
|
|
||||||
|
<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['city_name'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['total_missions'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['taradod_khareg_mahdode'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bafarayand_saeti'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bafarayand_rozaneh'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bedon_bafarayand_saeti'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['bedon_bafarayand_rozaneh'] ?? '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -15,6 +15,8 @@ use App\Http\Controllers\V3\Dashboard\Harim\TechnicalDeputyController;
|
|||||||
use App\Http\Controllers\V3\Dashboard\ItemsManagementController;
|
use App\Http\Controllers\V3\Dashboard\ItemsManagementController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Mission\ControlUnitController;
|
use App\Http\Controllers\V3\Dashboard\Mission\ControlUnitController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Mission\DetailController;
|
use App\Http\Controllers\V3\Dashboard\Mission\DetailController;
|
||||||
|
use App\Http\Controllers\V3\Dashboard\Mission\Report\ReportTradodController;
|
||||||
|
use App\Http\Controllers\V3\Dashboard\Mission\Report\ReportViolationController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Mission\RequestPortalController;
|
use App\Http\Controllers\V3\Dashboard\Mission\RequestPortalController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Mission\TransportationUnitController;
|
use App\Http\Controllers\V3\Dashboard\Mission\TransportationUnitController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Mission\ViolationManagementController;
|
use App\Http\Controllers\V3\Dashboard\Mission\ViolationManagementController;
|
||||||
@@ -535,7 +537,7 @@ Route::prefix('missions')
|
|||||||
});
|
});
|
||||||
Route::prefix('report')
|
Route::prefix('report')
|
||||||
->name('reports.')
|
->name('reports.')
|
||||||
->controller(\App\Http\Controllers\V3\Dashboard\Mission\ReportController::class)
|
->controller(ReportViolationController::class)
|
||||||
->group(function () {
|
->group(function () {
|
||||||
Route::get('/country_activity', 'countryActivity')->name('countryActivity')
|
Route::get('/country_activity', 'countryActivity')->name('countryActivity')
|
||||||
->middleware('permission:mission-report-country');
|
->middleware('permission:mission-report-country');
|
||||||
@@ -544,6 +546,17 @@ Route::prefix('missions')
|
|||||||
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity');
|
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity');
|
||||||
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity');
|
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity');
|
||||||
});
|
});
|
||||||
|
Route::prefix('report')
|
||||||
|
->name('reports.')
|
||||||
|
->controller(ReportTradodController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('/country_activity', 'countryActivity')->name('countryActivity')
|
||||||
|
->middleware('permission:mission-report-country');
|
||||||
|
Route::get('/province_activity', 'provinceActivity')->name('provinceActivity')
|
||||||
|
->middleware('permission:mission-report-province');
|
||||||
|
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity');
|
||||||
|
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::prefix('harim')
|
Route::prefix('harim')
|
||||||
|
|||||||
Reference in New Issue
Block a user