Compare commits
40 Commits
feature/Mi
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| eedc24c625 | |||
|
|
89972b57f4 | ||
|
|
961e4c40c9 | ||
|
|
d58ca6b685 | ||
|
|
7a981ee421 | ||
|
|
da82c7841b | ||
|
|
aa468b592b | ||
| 0291ee6716 | |||
|
|
0befa33b0f | ||
| 3708e2ebfb | |||
|
|
3fb1474b80 | ||
|
|
bab99f7f89 | ||
| 2aa9ae1455 | |||
| 6fc073c7e8 | |||
| 8da1ae1d74 | |||
| 80c4eeaefb | |||
| c9e779d726 | |||
| 72fa9d4ea3 | |||
|
|
d50749fd20 | ||
| ad01e4718d | |||
| 3dd49494f4 | |||
| 3045f60f1e | |||
| 2a6d44885c | |||
| 439f69af29 | |||
| 1be9315b73 | |||
|
|
39752fd5ba | ||
|
|
ab9838c1bc | ||
| 92d806497d | |||
| 7ac07692a2 | |||
| ca51f65da4 | |||
| 0f65437bfa | |||
| 5edb061a24 | |||
|
|
75c649c48e | ||
|
|
5a2a477789 | ||
| fc853d318e | |||
|
|
a45b4955db | ||
| 0b7b22ff87 | |||
| ace0b018e7 | |||
| e7ced6267d | |||
| 55c736ac3e |
@@ -78,7 +78,7 @@ FMS_ERROR_RATE_URL=
|
|||||||
FMS_ERROR_RATE_PASSWORD=
|
FMS_ERROR_RATE_PASSWORD=
|
||||||
FMS_ERROR_RATE_USERNAME=
|
FMS_ERROR_RATE_USERNAME=
|
||||||
|
|
||||||
HARIM_NEED_ACCESS_URL='https://zamin.gov.ir/ow/api/ow/esb/response',
|
HARIM_NEED_ACCESS_URL='https://zamin.gov.ir/ow/api/ow/esb/response'
|
||||||
HARIM_NEED_ACCESS_PASSWORD=
|
HARIM_NEED_ACCESS_PASSWORD=
|
||||||
HARIM_NEED_ACCESS_USERNAME=
|
HARIM_NEED_ACCESS_USERNAME=
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ BACKUP_PASSWORD=1qaz
|
|||||||
HARIM_ENCRYPTION_KEY="TestKey"
|
HARIM_ENCRYPTION_KEY="TestKey"
|
||||||
HARIM_ENCRYPTION_IV="1111000011110101"
|
HARIM_ENCRYPTION_IV="1111000011110101"
|
||||||
|
|
||||||
CHECKE_LIST_MACHINES_ACTIVITY_URL='fms.141.ir:7030/api/RMS/GetMovingVehicles',
|
CHECKE_LIST_MACHINES_ACTIVITY_URL='fms.141.ir:7030/api/RMS/GetMovingVehicles'
|
||||||
CHECKE_LIST_MACHINES_ACTIVITY_PASSWORD=
|
CHECKE_LIST_MACHINES_ACTIVITY_PASSWORD=
|
||||||
CHECKE_LIST_MACHINES_ACTIVITY_USERNAME=
|
CHECKE_LIST_MACHINES_ACTIVITY_USERNAME=
|
||||||
|
|
||||||
|
|||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -19,3 +19,10 @@ yarn-error.log
|
|||||||
/.idea
|
/.idea
|
||||||
/.vscode
|
/.vscode
|
||||||
archive.tgz
|
archive.tgz
|
||||||
|
storage/avatar/
|
||||||
|
storage/cities-geojson.json
|
||||||
|
storage/compress.php
|
||||||
|
storage/images/
|
||||||
|
storage/provinces-cities-geojson copy.js
|
||||||
|
storage/provinces-cities-geojson.js
|
||||||
|
storage/provinces-geojson.json
|
||||||
@@ -13,7 +13,7 @@ class EncodePolyLineCommand extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'app:encode-poly-line-command';
|
protected $signature = 'polyline:encode';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@@ -28,7 +28,8 @@ class EncodePolyLineCommand extends Command
|
|||||||
public function handle(PolylineEncoder $polylineEncoder): void
|
public function handle(PolylineEncoder $polylineEncoder): void
|
||||||
{
|
{
|
||||||
Mission::query()->whereNotNull('area')->each(function ($mission) use ($polylineEncoder) {
|
Mission::query()->whereNotNull('area')->each(function ($mission) use ($polylineEncoder) {
|
||||||
$encodedValue = $polylineEncoder->encodePolyLine($mission, lng_lat_format:true);
|
$area = json_decode($mission->area, true);
|
||||||
|
$encodedValue = $polylineEncoder->encodePolyLine($area['coordinates'], lng_lat_format:true);
|
||||||
$mission->update([
|
$mission->update([
|
||||||
'encoded_route' => $encodedValue,
|
'encoded_route' => $encodedValue,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?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];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<?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];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?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 machineDriverReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||||
|
{
|
||||||
|
public function __construct(private array $data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$exportRows = [];
|
||||||
|
|
||||||
|
foreach ($this->data as $r) {
|
||||||
|
$exportRows[] = [
|
||||||
|
'driver_id' => $r->driver_id ?? '',
|
||||||
|
'driver_name' => $r->driver_name ?? '',
|
||||||
|
'missions' => $r->missions ?? 0,
|
||||||
|
'func' => (int) ($r->func ?? 0),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('v3.Reports.Mission.Report.Machine.MachineDriverReport', [
|
||||||
|
'rows' => $exportRows,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
AfterSheet::class => function (AfterSheet $event) {
|
||||||
|
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function drawings(): array
|
||||||
|
{
|
||||||
|
$drawing = new Drawing();
|
||||||
|
$drawing->setName('Logo');
|
||||||
|
$drawing->setDescription('This is my logo');
|
||||||
|
$drawing->setPath(public_path('/dist/logo.png'));
|
||||||
|
$drawing->setWidth(50);
|
||||||
|
$drawing->setHeight(50);
|
||||||
|
$drawing->setOffsetX(5);
|
||||||
|
$drawing->setOffsetY(5);
|
||||||
|
$drawing->setCoordinates('A1');
|
||||||
|
|
||||||
|
$drawing2 = new Drawing();
|
||||||
|
$drawing2->setName('Logo');
|
||||||
|
$drawing2->setDescription('This is my logo');
|
||||||
|
$drawing2->setPath(public_path('/dist/141icon.png'));
|
||||||
|
$drawing2->setWidth(50);
|
||||||
|
$drawing2->setHeight(50);
|
||||||
|
$drawing2->setOffsetX(+90);
|
||||||
|
$drawing2->setOffsetY(5);
|
||||||
|
$drawing2->setCoordinates('D1');
|
||||||
|
|
||||||
|
return [$drawing, $drawing2];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,14 +18,16 @@ class machineReport implements FromView, ShouldAutoSize, WithDrawings, WithEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function view(): View
|
public function view(): View
|
||||||
{ $exportRows = [];
|
{
|
||||||
|
$exportRows = [];
|
||||||
|
|
||||||
foreach ($this->data as $r) {
|
foreach ($this->data as $r) {
|
||||||
$exportRows[] = [
|
$exportRows[] = [
|
||||||
'city_name' => $r->c_name ?? '',
|
'machine_id' => $r->machine_id ?? '',
|
||||||
'province_name' => $r->p_name ?? '',
|
'machine_code' => $r->machine_code ?? '',
|
||||||
|
'car_name' => $r->car_name ?? '',
|
||||||
'missions' => $r->missions ?? 0,
|
'missions' => $r->missions ?? 0,
|
||||||
'distance' => (int) ($r->distance ?? 0),
|
'func' => (int) ($r->func ?? 0),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,9 +66,9 @@ class machineReport implements FromView, ShouldAutoSize, WithDrawings, WithEvent
|
|||||||
$drawing2->setPath(public_path('/dist/141icon.png'));
|
$drawing2->setPath(public_path('/dist/141icon.png'));
|
||||||
$drawing2->setWidth(50);
|
$drawing2->setWidth(50);
|
||||||
$drawing2->setHeight(50);
|
$drawing2->setHeight(50);
|
||||||
$drawing2->setOffsetX(5);
|
$drawing2->setOffsetX(+90);
|
||||||
$drawing2->setOffsetY(5);
|
$drawing2->setOffsetY(5);
|
||||||
$drawing2->setCoordinates('D1');
|
$drawing2->setCoordinates('E1');
|
||||||
|
|
||||||
return [$drawing, $drawing2];
|
return [$drawing, $drawing2];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?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];
|
||||||
|
}
|
||||||
|
}
|
||||||
73
app/Exports/V3/Mission/Report/Machine/machineTypeReport.php
Normal file
73
app/Exports/V3/Mission/Report/Machine/machineTypeReport.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?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 machineTypeReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||||
|
{
|
||||||
|
public function __construct(private array $data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$exportRows = [];
|
||||||
|
|
||||||
|
foreach ($this->data as $r) {
|
||||||
|
$exportRows[] = [
|
||||||
|
'car_type' => $r->car_type ?? '',
|
||||||
|
'missions' => $r->missions ?? 0,
|
||||||
|
'func' => (int) ($r->func ?? 0),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('v3.Reports.Mission.Report.Machine.MachineTypeReport', [
|
||||||
|
'rows' => $exportRows,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
AfterSheet::class => function (AfterSheet $event) {
|
||||||
|
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function drawings(): array
|
||||||
|
{
|
||||||
|
$drawing = new Drawing();
|
||||||
|
$drawing->setName('Logo');
|
||||||
|
$drawing->setDescription('This is my logo');
|
||||||
|
$drawing->setPath(public_path('/dist/logo.png'));
|
||||||
|
$drawing->setWidth(50);
|
||||||
|
$drawing->setHeight(50);
|
||||||
|
$drawing->setOffsetX(5);
|
||||||
|
$drawing->setOffsetY(5);
|
||||||
|
$drawing->setCoordinates('A1');
|
||||||
|
|
||||||
|
$drawing2 = new Drawing();
|
||||||
|
$drawing2->setName('Logo');
|
||||||
|
$drawing2->setDescription('This is my logo');
|
||||||
|
$drawing2->setPath(public_path('/dist/141icon.png'));
|
||||||
|
$drawing2->setWidth(50);
|
||||||
|
$drawing2->setHeight(50);
|
||||||
|
$drawing2->setOffsetX(+90);
|
||||||
|
$drawing2->setOffsetY(5);
|
||||||
|
$drawing2->setCoordinates('C1');
|
||||||
|
|
||||||
|
return [$drawing, $drawing2];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
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\machineReport;
|
use App\Exports\V3\Mission\Report\Machine\machineReport;
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Exports\V3\Mission\Report\Machine\machineTypeDetailsReport;
|
||||||
|
use App\Exports\V3\Mission\Report\Machine\machineTypeReport;
|
||||||
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\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;
|
||||||
@@ -20,109 +21,114 @@ class ReportMachineController extends Controller
|
|||||||
{
|
{
|
||||||
use ApiResponse;
|
use ApiResponse;
|
||||||
|
|
||||||
public function countryMachinesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
public function machineDetailsReport(Request $request, ReportMachineService $reportMachineService,int $machine_id): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse([
|
$data = $reportMachineService->machineDetailActivity($request,$machine_id);
|
||||||
'activities' => $reportMachineService->countryMachinesActivity($request),
|
|
||||||
// 'provinces' => Province::all(['id', 'name_fa']),
|
return response()->json($data);
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function countryMachinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
public function machineDetailsReportExcel(Request $request, int $machine_id, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->countryMachinesActivity($request);
|
$data = $reportMachineService->machineDetailActivity($request,$machine_id);
|
||||||
$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 machineDetailsReport($data['data']), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceMachinesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
public function machinesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse([
|
return response()->json($reportMachineService->machinesActivity($request));
|
||||||
'activities' => $reportMachineService->countryMachinesActivity($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 Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function provinceMachinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
|
||||||
|
public function machinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->countryMachinesActivity($request);
|
$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 countryMachineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
|
||||||
|
public function machineTypeDetailsReport(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse([
|
$data = $reportMachineService->machineTypeDetailActivity($request);
|
||||||
'activities' => $reportMachineService->countryMachineTypesActivity($request),
|
|
||||||
// 'provinces' => Province::all(['id', 'name_fa']),
|
return response()->json($data);
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function countryMachineTypesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
public function machineTypeDetailsReportExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->countryMachineTypesActivity($request);
|
$data = $reportMachineService->machineTypeDetailActivity($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 machineTypeDetailsReport($data['data']), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceMachineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
public function machineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse([
|
return response()->json($reportMachineService->machineTypesActivity($request));
|
||||||
'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'])
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function machineDetailsReport(Request $request)
|
|
||||||
{
|
|
||||||
return DataTableFacade::run(
|
|
||||||
Mission::query()->where('machine_id', '=', $request->query('machine_id')),
|
|
||||||
$request,
|
|
||||||
allowedFilters: ['*'],
|
|
||||||
allowedSortings: ['*'],
|
|
||||||
allowedSelects: [
|
|
||||||
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
|
||||||
'end_km', 'km', 'driver_name', 'state_name', 'station_name'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function provinceMachineTypesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
public function machineTypesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
{
|
{
|
||||||
$data = $reportMachineService->provinceMachineTypesActivity($request);
|
$data = $reportMachineService->machineTypesActivity($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 machineDriverDetailsReport(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
|
{
|
||||||
|
$data = $reportMachineService->machineDriverDetailActivity($request);
|
||||||
|
|
||||||
|
return response()->json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
|
*/
|
||||||
|
public function machineDriverDetailsReportExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
|
{
|
||||||
|
$data = $reportMachineService->machineDriverDetailActivity($request);
|
||||||
|
$name = 'گزارش عملکرد راننده'.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||||
|
|
||||||
|
return Excel::download(
|
||||||
|
new machineDriverDetailsReport($data['data']), $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function machineDriversActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||||
|
{
|
||||||
|
return response()->json($reportMachineService->machineDriversActivity($request));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||||
|
*/
|
||||||
|
public function machineDriversActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||||
|
{
|
||||||
|
$data = $reportMachineService->machineDriversActivity($request);
|
||||||
|
$name = 'گزارش نوع ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||||
|
|
||||||
|
return Excel::download(new machineDriverReport($data), $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||||
|
|
||||||
use App\Enums\FMSResultCode;
|
|
||||||
use App\Enums\MissionCategory;
|
use App\Enums\MissionCategory;
|
||||||
use App\Enums\MissionStates;
|
use App\Enums\MissionStates;
|
||||||
use App\Enums\MissionTypes;
|
use App\Enums\MissionTypes;
|
||||||
@@ -10,7 +9,6 @@ use App\Enums\MissionViolationStatus;
|
|||||||
use App\Enums\MissionZones;
|
use App\Enums\MissionZones;
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Controllers\V3\Dashboard\RoadPatrol\OperatorController;
|
|
||||||
use App\Http\Requests\V3\Mission\RequestPortal\ChangeStateRequest;
|
use App\Http\Requests\V3\Mission\RequestPortal\ChangeStateRequest;
|
||||||
use App\Http\Requests\V3\Mission\RequestPortal\ClarifyUnauthorizedExitRequest;
|
use App\Http\Requests\V3\Mission\RequestPortal\ClarifyUnauthorizedExitRequest;
|
||||||
use App\Http\Requests\V3\Mission\RequestPortal\ContinueMissionRequest;
|
use App\Http\Requests\V3\Mission\RequestPortal\ContinueMissionRequest;
|
||||||
@@ -23,7 +21,6 @@ use App\Models\Mission;
|
|||||||
use App\Models\MissionViolation;
|
use App\Models\MissionViolation;
|
||||||
use App\Models\Rahdaran;
|
use App\Models\Rahdaran;
|
||||||
use App\Models\RahdariPoint;
|
use App\Models\RahdariPoint;
|
||||||
use App\Models\RoadObserved;
|
|
||||||
use App\Services\Cartables\Mission\RequestPortalService;
|
use App\Services\Cartables\Mission\RequestPortalService;
|
||||||
use App\Services\FMS\GetErrorRateService;
|
use App\Services\FMS\GetErrorRateService;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
@@ -65,6 +62,8 @@ class RequestPortalController extends Controller
|
|||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
$mission = Mission::query()->create([
|
$mission = Mission::query()->create([
|
||||||
|
'item_id' => $request->item_id,
|
||||||
|
'sub_item_id' => $request->sub_item_id,
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'province_id' => $user->province_id,
|
'province_id' => $user->province_id,
|
||||||
@@ -83,7 +82,6 @@ class RequestPortalController extends Controller
|
|||||||
'start_date' => $request->start_date,
|
'start_date' => $request->start_date,
|
||||||
'end_date' => $request->end_date,
|
'end_date' => $request->end_date,
|
||||||
'request_date' => now(),
|
'request_date' => now(),
|
||||||
'description' => $request->description,
|
|
||||||
'end_point' => $request->end_point,
|
'end_point' => $request->end_point,
|
||||||
'encoded_route' => $request->encoded_route,
|
'encoded_route' => $request->encoded_route,
|
||||||
'category_id' => $request->category_id,
|
'category_id' => $request->category_id,
|
||||||
@@ -126,6 +124,7 @@ class RequestPortalController extends Controller
|
|||||||
'finish_time' => now(),
|
'finish_time' => now(),
|
||||||
'state_id' => MissionStates::END_MISSION->value,
|
'state_id' => MissionStates::END_MISSION->value,
|
||||||
'state_name' => MissionStates::name(MissionStates::END_MISSION->value),
|
'state_name' => MissionStates::name(MissionStates::END_MISSION->value),
|
||||||
|
'end_km' => $request->end_km,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// if ($mission->category_id == 2) {
|
// if ($mission->category_id == 2) {
|
||||||
@@ -133,9 +132,11 @@ class RequestPortalController extends Controller
|
|||||||
// $rpc->store($mission);
|
// $rpc->store($mission);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$machine = CMMSMachine::query()->find($request->machine_id);
|
$machine = CMMSMachine::query()->find($request->machine_id, ['id', 'machine_code', 'car_type']);
|
||||||
|
|
||||||
$newMission = Mission::query()->create([
|
$newMission = Mission::query()->create([
|
||||||
|
'item_id' => $request->item_id,
|
||||||
|
'sub_item_id' => $request->sub_item_id,
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'province_id' => $user->province_id,
|
'province_id' => $user->province_id,
|
||||||
@@ -153,7 +154,6 @@ class RequestPortalController extends Controller
|
|||||||
'start_date' => now(),
|
'start_date' => now(),
|
||||||
'end_date' => $request->end_date,
|
'end_date' => $request->end_date,
|
||||||
'request_date' => now(),
|
'request_date' => now(),
|
||||||
'description' => $request->description,
|
|
||||||
'end_point' => $request->end_point,
|
'end_point' => $request->end_point,
|
||||||
'encoded_route' => $request->encoded_route,
|
'encoded_route' => $request->encoded_route,
|
||||||
'category_id' => $request->category_id,
|
'category_id' => $request->category_id,
|
||||||
@@ -166,6 +166,8 @@ class RequestPortalController extends Controller
|
|||||||
'station_name' => RahdariPoint::query()->find( $user->station_id)->name,
|
'station_name' => RahdariPoint::query()->find( $user->station_id)->name,
|
||||||
'driver_id' => $request->driver,
|
'driver_id' => $request->driver,
|
||||||
'driver_name' => Rahdaran::query()->find($request->driver)->name,
|
'driver_name' => Rahdaran::query()->find($request->driver)->name,
|
||||||
|
'km' => $request->end_km,
|
||||||
|
'requested_machines' => json_encode($machine->car_type),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$newMission->rahdaran()->sync($request->rahdaran);
|
$newMission->rahdaran()->sync($request->rahdaran);
|
||||||
@@ -182,6 +184,8 @@ class RequestPortalController extends Controller
|
|||||||
DB::transaction(function () use ($mission, $request) {
|
DB::transaction(function () use ($mission, $request) {
|
||||||
$state = MissionStates::REQUEST_CREATED->value;
|
$state = MissionStates::REQUEST_CREATED->value;
|
||||||
$mission->update([
|
$mission->update([
|
||||||
|
'item_id' => $request->item_id,
|
||||||
|
'sub_item_id' => $request->sub_item_id,
|
||||||
'state_id' => $state,
|
'state_id' => $state,
|
||||||
'state_name' => MissionStates::name($state),
|
'state_name' => MissionStates::name($state),
|
||||||
'requested_machines' => json_encode($request->requested_machines),
|
'requested_machines' => json_encode($request->requested_machines),
|
||||||
@@ -191,7 +195,6 @@ class RequestPortalController extends Controller
|
|||||||
'zone_fa' => MissionZones::name($request->zone),
|
'zone_fa' => MissionZones::name($request->zone),
|
||||||
'start_date' => $request->start_date,
|
'start_date' => $request->start_date,
|
||||||
'end_date' => $request->end_date,
|
'end_date' => $request->end_date,
|
||||||
'description' => $request->description,
|
|
||||||
'end_point' => $request->end_point,
|
'end_point' => $request->end_point,
|
||||||
'encoded_route' => $request->encoded_route,
|
'encoded_route' => $request->encoded_route,
|
||||||
'category_id' => $request->category_id,
|
'category_id' => $request->category_id,
|
||||||
@@ -236,14 +239,16 @@ class RequestPortalController extends Controller
|
|||||||
{
|
{
|
||||||
DB::transaction(function () use ($request, $violation) {
|
DB::transaction(function () use ($request, $violation) {
|
||||||
|
|
||||||
$start = Carbon::parse($violation->exit_station);
|
$start = Carbon::parse($violation->exit_time);
|
||||||
$end = Carbon::parse($violation->enter_station);
|
$end = Carbon::parse($violation->enter_time);
|
||||||
$type = $start->diffInMinutes($end) > 480 ? MissionTypes::NO_PROCESS_ROZANE->value : MissionTypes::NO_PROCESS_SAATY->value;
|
$type = $start->diffInMinutes($end) > 480 ? MissionTypes::NO_PROCESS_ROZANE->value : MissionTypes::NO_PROCESS_SAATY->value;
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$zone = $request->zone;
|
$zone = $request->zone;
|
||||||
$machine = CMMSMachine::query()->where('machine_code', '=', $violation->machine_code)->first(['id', 'machine_code']);
|
$machine = CMMSMachine::query()->where('machine_code', '=', $violation->machine_code)->first(['id', 'machine_code', 'car_type']);
|
||||||
|
|
||||||
$mission = Mission::query()->create([
|
$mission = Mission::query()->create([
|
||||||
|
'item_id' => $request->item_id,
|
||||||
|
'sub_item_id' => $request->sub_item_id,
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'province_id' => $user->province_id,
|
'province_id' => $user->province_id,
|
||||||
@@ -257,31 +262,32 @@ class RequestPortalController extends Controller
|
|||||||
'encoded_route' => $request->encoded_route,
|
'encoded_route' => $request->encoded_route,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'type_fa' => MissionTypes::name($type),
|
'type_fa' => MissionTypes::name($type),
|
||||||
'start_date' => $violation->exit_station,
|
'start_date' => $violation->exit_time,
|
||||||
'end_date' => $violation->enter_station,
|
'end_date' => $violation->enter_time,
|
||||||
'end_point' => $request->end_point,
|
'end_point' => $request->end_point,
|
||||||
'category_id' => $request->category_id,
|
'category_id' => $request->category_id,
|
||||||
'category_name' => MissionCategory::name($request->category_id),
|
'category_name' => MissionCategory::name($request->category_id),
|
||||||
'start_time' => $violation->exit_station,
|
'start_time' => $violation->exit_time,
|
||||||
'finish_time' => $violation->enter_station,
|
'finish_time' => $violation->enter_time,
|
||||||
'mission_duration' => strtotime($violation->enter_station) - strtotime($violation->exit_station),
|
'mission_duration' => strtotime($violation->enter_time) - strtotime($violation->exit_time),
|
||||||
'state_id' => MissionStates::END_MISSION->value,
|
'state_id' => MissionStates::END_MISSION->value,
|
||||||
'state_name' => MissionStates::END_MISSION->label(),
|
'state_name' => MissionStates::END_MISSION->label(),
|
||||||
'explanation' => $request->explanation,
|
'explanation' => $request->explanation,
|
||||||
'request_date' => now(),
|
'request_date' => now(),
|
||||||
'machine_id' => $machine->id,
|
'machine_id' => $machine->id,
|
||||||
'machine_code' => $machine->machine_code,
|
'machine_code' => $machine->machine_code,
|
||||||
'requested_machines' => $machine->car_type,
|
'requested_machines' => json_encode($machine->car_type),
|
||||||
'station_id' => $user->station_id,
|
'station_id' => $user->station_id,
|
||||||
'station_name' => RahdariPoint::query()->find($user->station_id)->name,
|
'station_name' => RahdariPoint::query()->find($user->station_id)->name,
|
||||||
'km' => $violation->km ?? null,
|
'km' => $violation->km ?? null,
|
||||||
|
'end_km' => $violation->end_km ?? null,
|
||||||
'driver_id' => $request->driver,
|
'driver_id' => $request->driver,
|
||||||
'driver_name' => Rahdaran::query()->find($request->driver)->name,
|
'driver_name' => Rahdaran::query()->find($request->driver)->name,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$mission->rahdaran()->sync($request->rahdaran);
|
$mission->rahdaran()->sync($request->rahdaran);
|
||||||
|
|
||||||
$violation->update(['status' => 1]);
|
$violation->update(['status' => 1, 'mission_id' => $mission->id]);
|
||||||
|
|
||||||
// if ($mission->category_id == 2) {
|
// if ($mission->category_id == 2) {
|
||||||
// $rpc = new OperatorController;
|
// $rpc = new OperatorController;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TransportationUnitController extends Controller
|
|||||||
'state_name' => MissionStates::name($state),
|
'state_name' => MissionStates::name($state),
|
||||||
'machine_id' => $machine->id,
|
'machine_id' => $machine->id,
|
||||||
'machine_code' => $machine->machine_code,
|
'machine_code' => $machine->machine_code,
|
||||||
'driver_id' => $request->driver_id,
|
'driver_id' => $request->driver,
|
||||||
'driver_name' => Rahdaran::query()->find($request->driver)->name,
|
'driver_name' => Rahdaran::query()->find($request->driver)->name,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class ViolationManagementController extends Controller
|
|||||||
'city_name' => $user->city_fa,
|
'city_name' => $user->city_fa,
|
||||||
'station_id' => $user->station_id,
|
'station_id' => $user->station_id,
|
||||||
'station_name' => RahdariPoint::query()->find($user->station_id)->name,
|
'station_name' => RahdariPoint::query()->find($user->station_id)->name,
|
||||||
'exit_station' => $request->exit_station,
|
'exit_time' => $request->exit_time,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
@@ -68,8 +68,9 @@ class ViolationManagementController extends Controller
|
|||||||
public function update(UpdateRequest $request, MissionViolation $violation): JsonResponse
|
public function update(UpdateRequest $request, MissionViolation $violation): JsonResponse
|
||||||
{
|
{
|
||||||
$violation->update([
|
$violation->update([
|
||||||
'enter_station' => $request->enter_station,
|
'enter_time' => $request->enter_time,
|
||||||
'status' => MissionViolationStatus::BEDON_EGHDAM->value,
|
'status' => MissionViolationStatus::BEDON_EGHDAM->value,
|
||||||
|
'end_km' => $request->end_km,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
|
|||||||
@@ -197,18 +197,67 @@ class NotificationController extends Controller
|
|||||||
'control' => 0,
|
'control' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($user->hasPermissionTo('manage-transportation-unit')) {
|
if ($user->hasPermissionTo('manage-transportation-unit-station')) {
|
||||||
$missions['transportation'] = Mission::query()->where([
|
$missions['transportation'] = Mission::query()->where([
|
||||||
['state_id', '=', MissionStates::REQUEST_CREATED->value],
|
['state_id', '=', MissionStates::REQUEST_CREATED->value],
|
||||||
['edare_shahri_id', '=', $user->edarate_shahri_id],
|
['station_id', '=', $user->station_id],
|
||||||
])->count();
|
])->count();
|
||||||
}
|
}
|
||||||
if ($user->hasPermissionTo('manage-control-unit')) {
|
if ($user->hasPermissionTo('manage-transportation-unit-country')) {
|
||||||
$missions['control'] = Mission::query()->where([
|
$missions['transportation'] = Mission::query()->where([
|
||||||
['state_id', '=', MissionStates::PENDING_CONFIRMATION->value],
|
['state_id', '=', MissionStates::REQUEST_CREATED->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,6 +3,7 @@
|
|||||||
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;
|
||||||
@@ -14,7 +15,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,6 +35,7 @@ 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(
|
||||||
@@ -41,12 +43,25 @@ 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',
|
||||||
|
'کیلومتر /ساعت کار از حد نصاب بیشتر هست.'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ class ClarifyUnauthorizedExitRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'item_id' => 'required|exists:info_items,item',
|
||||||
|
'sub_item_id' => 'required|exists:info_items,id',
|
||||||
'rahdaran' => 'array',
|
'rahdaran' => 'array',
|
||||||
'rahdaran.*' => 'exists:rahdaran,id',
|
'rahdaran.*' => 'exists:rahdaran,id',
|
||||||
'driver' => 'required|integer|exists:rahdaran,id',
|
'driver' => 'required|integer|exists:rahdaran,id',
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ class ContinueMissionRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'item_id' => 'required|exists:info_items,item',
|
||||||
|
'sub_item_id' => 'required|exists:info_items,id',
|
||||||
'rahdaran' => 'array',
|
'rahdaran' => 'array',
|
||||||
'rahdaran.*' => 'exists:rahdaran,id',
|
'rahdaran.*' => 'exists:rahdaran,id',
|
||||||
'machine_id' => 'required|integer|exists:cmms_machines,id',
|
'machine_id' => 'required|integer|exists:cmms_machines,id',
|
||||||
@@ -33,11 +35,11 @@ class ContinueMissionRequest extends FormRequest
|
|||||||
'type' => 'required|in:1,2',
|
'type' => 'required|in:1,2',
|
||||||
'zone' => 'required|in:1,2,3',
|
'zone' => 'required|in:1,2,3',
|
||||||
'end_date' => 'required|date',
|
'end_date' => 'required|date',
|
||||||
'description' => 'string',
|
|
||||||
'end_point' => 'required|string',
|
'end_point' => 'required|string',
|
||||||
'encoded_route' => 'required|string',
|
'encoded_route' => 'required|string',
|
||||||
'explanation' => 'required|string',
|
'explanation' => 'required|string',
|
||||||
'category_id' => 'required|in:1,2,3',
|
'category_id' => 'required|in:1,2,3',
|
||||||
|
'end_km'=> 'required|string',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +58,18 @@ class ContinueMissionRequest extends FormRequest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->end_km <= $this->mission->km) {
|
||||||
|
$validator->errors()->add(
|
||||||
|
'end_km',
|
||||||
|
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (strtotime($this->end_date) < strtotime($this->mission->start_time)) {
|
||||||
|
$validator->errors()->add(
|
||||||
|
'time',
|
||||||
|
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ class StoreRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'item_id' => 'required|exists:info_items,item',
|
||||||
|
'sub_item_id' => 'required|exists:info_items,id',
|
||||||
'rahdaran' => 'array',
|
'rahdaran' => 'array',
|
||||||
'rahdaran.*' => 'exists:rahdaran,id',
|
'rahdaran.*' => 'exists:rahdaran,id',
|
||||||
'requested_machines' => 'required|array',
|
'requested_machines' => 'required|array',
|
||||||
@@ -32,7 +34,6 @@ class StoreRequest extends FormRequest
|
|||||||
'zone' => 'required|in:1,2,3',
|
'zone' => 'required|in:1,2,3',
|
||||||
'start_date' => 'required|date',
|
'start_date' => 'required|date',
|
||||||
'end_date' => 'required|date',
|
'end_date' => 'required|date',
|
||||||
'description' => 'string',
|
|
||||||
'end_point' => 'required|string',
|
'end_point' => 'required|string',
|
||||||
'encoded_route' => 'required|string',
|
'encoded_route' => 'required|string',
|
||||||
'explanation' => 'required|string',
|
'explanation' => 'required|string',
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ class UpdateRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'item_id' => 'required|exists:info_items,item',
|
||||||
|
'sub_item_id' => 'required|exists:info_items,id',
|
||||||
'rahdaran' => 'array',
|
'rahdaran' => 'array',
|
||||||
'rahdaran.*' => 'exists:rahdaran,id',
|
'rahdaran.*' => 'exists:rahdaran,id',
|
||||||
'requested_machines' => 'required|array',
|
'requested_machines' => 'required|array',
|
||||||
@@ -33,7 +35,6 @@ class UpdateRequest extends FormRequest
|
|||||||
'zone' => 'required|in:1,2,3',
|
'zone' => 'required|in:1,2,3',
|
||||||
'start_date' => 'required|date',
|
'start_date' => 'required|date',
|
||||||
'end_date' => 'required|date',
|
'end_date' => 'required|date',
|
||||||
'description' => 'string',
|
|
||||||
'end_point' => 'required|string',
|
'end_point' => 'required|string',
|
||||||
'encoded_route' => 'required|string',
|
'encoded_route' => 'required|string',
|
||||||
'explanation' => 'required|string',
|
'explanation' => 'required|string',
|
||||||
|
|||||||
@@ -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';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class DeallocateRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return $this->mission->station_id == auth()->user()->station_id &&
|
return ($this->mission->station_id == auth()->user()->station_id &&
|
||||||
in_array($this->mission->state_id, [MissionStates::REQUEST_CREATED->value, MissionStates::PENDING_CONFIRMATION->value])
|
in_array($this->mission->state_id, [MissionStates::REQUEST_CREATED->value, MissionStates::PENDING_CONFIRMATION->value]))
|
||||||
|| auth()->user()->username === 'witel';
|
|| auth()->user()->username === 'witel';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class StoreRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'exit_station' => 'required|date',
|
'exit_time' => 'required|date',
|
||||||
'machine_code' => 'required',
|
'machine_code' => 'required',
|
||||||
'km'=> 'string',
|
'km'=> 'string',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -26,7 +26,28 @@ class UpdateRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'enter_station' => 'required|date',
|
'enter_time' => 'required|date',
|
||||||
|
'end_km'=> 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function after(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
function (Validator $validator) {
|
||||||
|
if (strtotime($this->enter_time) < strtotime($this->violation->exit_time)) {
|
||||||
|
$validator->errors()->add(
|
||||||
|
'time',
|
||||||
|
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ($this->end_km <= $this->violation->km) {
|
||||||
|
$validator->errors()->add(
|
||||||
|
'end_km',
|
||||||
|
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Mission extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = ['id'];
|
||||||
protected $hidden = ['pivot'];
|
protected $hidden = ['pivot'];
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'start_time' => 'datetime',
|
'start_time' => 'datetime',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
|||||||
class MissionViolation extends Model
|
class MissionViolation extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
protected $guarded =[];
|
protected $guarded =['id'];
|
||||||
|
|
||||||
public function mission(): BelongsTo
|
public function mission(): BelongsTo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,135 +3,130 @@
|
|||||||
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\MissionViolation;
|
use App\Models\CMMSMachine;
|
||||||
use Carbon\Carbon;
|
use App\Models\Mission;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class ReportMachineService
|
class ReportMachineService
|
||||||
{
|
{
|
||||||
public function countryMachinesActivity(Request $request): array
|
public function machineDetailActivity(Request $request, int $machine_id): array
|
||||||
{
|
{
|
||||||
$from = $request->from_date ?? today()->startOfDay();
|
return DataTableFacade::run(
|
||||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
Mission::query()->where('machine_id', '=', $machine_id),
|
||||||
|
$request,
|
||||||
$sql = "SELECT
|
allowedFilters: ['*'],
|
||||||
m.machine_id,
|
allowedSortings: ['*'],
|
||||||
m.machine_code,
|
allowedSelects: [
|
||||||
cm.car_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
|
);
|
||||||
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;";
|
|
||||||
|
|
||||||
return DB::select($sql, [
|
|
||||||
'from' => $from,
|
|
||||||
'to' => $to,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceMachinesActivity(Request $request): array
|
public function machinesActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$from = $request->from_date ?? today()->startOfDay();
|
$query = Mission::query()
|
||||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
->join('cmms_machines as cm', 'cm.id', '=', 'missions.machine_id')
|
||||||
$province = $request->province_id;
|
->where('state_id', '=', 4)
|
||||||
|
->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');
|
||||||
|
|
||||||
$sql = "SELECT machine_id, machine_code, cm.car_name, COUNT(*) AS missions, SUM(m.end_km - m.km) AS func
|
$fields = ['machine_code','machine_id','cm.car_name','missions', 'func', 'start_time', 'finish_time', 'province_id'];
|
||||||
FROM missions m
|
return DataTableFacade::run(
|
||||||
JOIN cmms_machines cm ON cm.id = m.machine_id
|
$query,
|
||||||
WHERE m.state_id = 4 AND start_time >= :from AND finish_time <= :to AND province_id = :province_id
|
$request,
|
||||||
GROUP BY machine_id;";
|
allowedFilters: $fields,
|
||||||
|
allowedSortings: $fields,
|
||||||
return DB::select($sql, [
|
);
|
||||||
'from' => $from,
|
|
||||||
'to' => $to,
|
|
||||||
'province_id' => $province,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countryMachineTypesActivity(Request $request): array
|
public function machineTypeDetailActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$from = $request->from_date ?? today()->startOfDay();
|
$machineIds = CMMSMachine::query()->where('car_type', '=', $request->query('car_type'))->pluck('id');
|
||||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
return DataTableFacade::run(
|
||||||
|
Mission::query()->whereIn('machine_id', $machineIds),
|
||||||
$sql = "SELECT
|
$request,
|
||||||
cm.car_type,
|
allowedFilters: ['*'],
|
||||||
COUNT(*) AS missions,
|
allowedSortings: ['*'],
|
||||||
SUM(m.end_km - m.km) AS func
|
allowedSelects: [
|
||||||
FROM missions m
|
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
||||||
JOIN cmms_machines cm ON cm.id = m.machine_id
|
'end_km', 'km', 'driver_name', 'state_name', 'station_name'
|
||||||
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to
|
]
|
||||||
GROUP BY cm.car_type;";
|
);
|
||||||
|
|
||||||
return DB::select($sql, [
|
|
||||||
'from' => $from,
|
|
||||||
'to' => $to,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceMachineTypesActivity(Request $request): array
|
public function machineTypesActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$from = $request->from_date ?? today()->startOfDay();
|
$query = Mission::query()
|
||||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
->join('cmms_machines as cm', 'cm.id', '=', 'missions.machine_id')
|
||||||
$province = $request->province_id;
|
->where('missions.state_id','=', 4)
|
||||||
|
->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');
|
||||||
|
|
||||||
$sql = "SELECT
|
$fields = ['car_type','missions', 'func', 'start_time', 'finish_time', 'province_id'];
|
||||||
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 province_id = :province_id
|
|
||||||
GROUP BY cm.car_type;";
|
|
||||||
|
|
||||||
return DB::select($sql, [
|
return DataTableFacade::run(
|
||||||
'from' => $from,
|
$query,
|
||||||
'to' => $to,
|
$request,
|
||||||
'province_id' => $province,
|
allowedFilters: $fields,
|
||||||
]);
|
allowedSortings: $fields,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countryMachineDriversActivity(Request $request): array
|
public function machineDriverDetailActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$from = $request->from_date ?? today()->startOfDay();
|
return DataTableFacade::run(
|
||||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
Mission::query()->where('driver_id', '=', $request->query('driver_id')),
|
||||||
|
$request,
|
||||||
$sql = "SELECT
|
allowedFilters: ['*'],
|
||||||
m.driver_id,
|
allowedSortings: ['*'],
|
||||||
m.driver_name,
|
allowedSelects: [
|
||||||
COUNT(*) AS missions,
|
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
||||||
SUM(m.end_km - m.km) AS func
|
'end_km', 'km', 'driver_name', 'state_id', 'station_name'
|
||||||
FROM missions m
|
]
|
||||||
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to
|
);
|
||||||
GROUP BY m.driver_id;";
|
|
||||||
|
|
||||||
return DB::select($sql, [
|
|
||||||
'from' => $from,
|
|
||||||
'to' => $to,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceMachineDriversActivity(Request $request): array
|
public function machineDriversActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$from = $request->from_date ?? today()->startOfDay();
|
$query = Mission::query()
|
||||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
->selectRaw(
|
||||||
$province = $request->province_id;
|
'driver_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');
|
||||||
|
|
||||||
$sql = "SELECT
|
$fields = ['driver_id','driver_name','missions', 'func', 'start_time', 'finish_time', 'province_id'];
|
||||||
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;";
|
|
||||||
|
|
||||||
return DB::select($sql, [
|
return DataTableFacade::run(
|
||||||
'from' => $from,
|
$query,
|
||||||
'to' => $to,
|
$request,
|
||||||
'province_id' => $province,
|
allowedFilters: $fields,
|
||||||
]);
|
allowedSortings: $fields,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class RequestPortalService
|
|||||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||||
'end_date', 'request_date', 'end_point', 'encoded_route', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
'end_date', 'request_date', 'end_point', 'encoded_route', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||||
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||||
|
'driver_id', 'driver_name', 'machine_id', 'item_id', 'sub_item_id'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ return new class extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('mission_violations', function (Blueprint $table) {
|
Schema::table('mission_violations', function (Blueprint $table) {
|
||||||
$table->dateTime('exit_station')->nullable();
|
|
||||||
$table->dateTime('enter_station')->nullable();
|
|
||||||
$table->unsignedInteger('station_id')->nullable();
|
$table->unsignedInteger('station_id')->nullable();
|
||||||
$table->string('station_name')->nullable();
|
$table->string('station_name')->nullable();
|
||||||
});
|
});
|
||||||
@@ -25,7 +23,7 @@ return new class extends Migration
|
|||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('mission_violations', function (Blueprint $table) {
|
Schema::table('mission_violations', function (Blueprint $table) {
|
||||||
$table->dropColumn(['exit_station', 'enter_station']);
|
$table->dropColumn(['station_id', 'station_name']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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('mission_violations', function (Blueprint $table) {
|
||||||
|
$table->string('end_km')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('mission_violations', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('end_km');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?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('missions', function (Blueprint $table) {
|
||||||
|
$table->unsignedInteger('item_id')->nullable();
|
||||||
|
$table->unsignedInteger('sub_item_id')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('missions', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('item_id', 'sub_item_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<!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>
|
||||||
@@ -27,18 +27,18 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="4"
|
<th colspan="5"
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="4"
|
<th colspan="5"
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="4"
|
<th colspan="5"
|
||||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
||||||
گزارش ماشین های ماموریت رفته
|
گزارش ماشین های ماموریت رفته
|
||||||
</th>
|
</th>
|
||||||
@@ -46,19 +46,23 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<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;">
|
||||||
|
کارکرد
|
||||||
</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>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -66,10 +70,11 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@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['machine_id'] ?? '-' }}</td>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['city_name'] ?? '-' }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $item['car_name'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['machine_code'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['func'] ?? '-' }}</td>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['missions'] ?? '-' }}</td>
|
<td style="border: 1px solid black;text-align: center;">{{ $item['missions'] ?? '-' }}</td>
|
||||||
<td style="border: 1px solid black;text-align: center;">{{ $item['distance'] ?? '-' }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<!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>
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<!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="4"
|
||||||
|
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="4"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="4"
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach ($rows as $item)
|
||||||
|
<tr>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['driver_id'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['driver_name'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['func'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['missions'] ?? '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<!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>
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<!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="3"
|
||||||
|
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="3"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="3"
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach ($rows as $item)
|
||||||
|
<tr>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['car_type'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['func'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['missions'] ?? '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -566,13 +566,19 @@ 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('/country_machines_activity', 'countryMachinesActivity')->name('countryMachinesActivity');
|
Route::get('/machines_activity', 'machinesActivity')->name('machinesActivity');
|
||||||
Route::get('/country_machines_activity_excel', 'countryMachinesActivityExcel')->name('countryMachinesActivityExcel');
|
Route::get('/machines_activity_excel', 'machinesActivityExcel')->name('machinesActivityExcel');
|
||||||
Route::get('/province_machines_activity', 'provinceMachinesActivity')->name('provinceMachinesActivity');
|
|
||||||
Route::get('/province_machines_activity_excel', 'provinceMachinesActivityExcel')->name('provinceMachinesActivityExcel');
|
Route::get('/machine_types_activity', 'machineTypesActivity')->name('machineTypesActivity');
|
||||||
Route::get('/country_machine_types_activity', 'countryMachineTypesActivity')->name('countryMachineTypesActivity');
|
Route::get('/machine_types_activity_excel', 'machineTypesActivityExcel')->name('machineTypesActivityExcel');
|
||||||
Route::get('/province_machine_types_activity', 'provinceMachineTypesActivity')->name('provinceMachineTypesActivity');
|
Route::get('/machine_drivers_activity', 'machineDriversActivity')->name('machineDriversActivity');
|
||||||
Route::get('/machine_details_report', 'machineDetailsReport')->name('machineDetailsReport');
|
Route::get('/machine_drivers_activity_excel', 'machineDriversActivityExcel')->name('machineDriversActivityExcel');
|
||||||
|
Route::get('/machine_details_report/{machine_id}', 'machineDetailsReport')->name('machineDetailsReport');
|
||||||
|
Route::get('/machine_details_report_excel/{machine_id}', 'machineDetailsReportExcel')->name('machineDetailsReportExcel');
|
||||||
|
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