Merge branch 'feature/ReceiptReports' into 'develop'
Feature/receipt reports See merge request witelgroup/rms_v2!79
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\V3\AccidentReceipt;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
class CityReport implements FromView, ShouldAutoSize, WithEvents, WithDrawings, WithStyles
|
||||
{
|
||||
public function __construct(private array $data){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$data = $this->data;
|
||||
|
||||
return view('v3.AccidentReceipt.CityReport', [
|
||||
'data' => $data['data'],
|
||||
'fromDate' => $data['fromDate'],
|
||||
'ToDate' => $data['ToDate'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function registerEvents(): array
|
||||
{
|
||||
return [
|
||||
AfterSheet::class => function (AfterSheet $event) {
|
||||
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
public function drawings()
|
||||
{
|
||||
$drawing = new Drawing();
|
||||
$drawing->setName('Logo');
|
||||
$drawing->setDescription('This is my logo');
|
||||
$drawing->setPath(public_path('/dist/logo.png'));
|
||||
$drawing->setWidth(50);
|
||||
$drawing->setHeight(50);
|
||||
$drawing->setOffsetX(5);
|
||||
$drawing->setOffsetY(5);
|
||||
$drawing->setCoordinates('A1');
|
||||
|
||||
$drawing2 = new Drawing();
|
||||
$drawing2->setName('Logo');
|
||||
$drawing2->setDescription('This is my logo');
|
||||
$drawing2->setPath(public_path('/dist/141icon.png'));
|
||||
$drawing2->setWidth(50);
|
||||
$drawing2->setHeight(50);
|
||||
$drawing2->setOffsetX(5);
|
||||
$drawing2->setOffsetY(5);
|
||||
$drawing2->setCoordinates('B1');
|
||||
return [$drawing, $drawing2];
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet)
|
||||
{
|
||||
return [
|
||||
// Style the first row as bold text.
|
||||
'A:BA' => [
|
||||
'font' => [
|
||||
'name' => 'B Nazanin'
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
125
app/Exports/V3/AccidentReceipt/CountryReport.php
Normal file
125
app/Exports/V3/AccidentReceipt/CountryReport.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\V3\AccidentReceipt;
|
||||
|
||||
use App\Models\Province;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
class CountryReport implements FromView, ShouldAutoSize, WithEvents, WithDrawings, WithStyles
|
||||
{
|
||||
public function __construct(private array $data){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$data = $this->data;
|
||||
|
||||
$country = array_search(-1, array_column($data['data'], 'province_id'));
|
||||
|
||||
$activities[] = [
|
||||
'name' => 'کل کشور',
|
||||
'tedade' => $data['data'][$country]->tedade,
|
||||
'police_rah' => $data['data'][$country]->police_rah,
|
||||
'gozaresh_gasht' => $data['data'][$country]->gozaresh_gasht,
|
||||
'kol_sabt_shode' => $data['data'][$country]->kol_sabt_shode,
|
||||
'vasel_shode' => $data['data'][$country]->vasel_shode ?? 0,
|
||||
'vasel_shode_bimeh' => $data['data'][$country]->vasel_shode_bimeh ?? 0,
|
||||
'vasel_shode_daghi' => $data['data'][$country]->vasel_shode_daghi ?? 0,
|
||||
'vasel_shode_final' => $data['data'][$country]->vasel_shode_final ?? 0,
|
||||
];
|
||||
|
||||
foreach (Province::all() as $province) {
|
||||
|
||||
$existingProvince = array_search($province->id, array_column($data['data'], 'province_id'));
|
||||
|
||||
if ($existingProvince) {
|
||||
$activities[] = [
|
||||
'name' => $province->name_fa,
|
||||
'tedade' => $data['data'][$existingProvince]->tedade,
|
||||
'police_rah' => $data['data'][$existingProvince]->police_rah,
|
||||
'gozaresh_gasht' => $data['data'][$existingProvince]->gozaresh_gasht,
|
||||
'kol_sabt_shode' => $data['data'][$existingProvince]->kol_sabt_shode,
|
||||
'vasel_shode' => $data['data'][$existingProvince]->vasel_shode ?? 0,
|
||||
'vasel_shode_bimeh' => $data['data'][$existingProvince]->vasel_shode_bimeh ?? 0,
|
||||
'vasel_shode_daghi' => $data['data'][$existingProvince]->vasel_shode_daghi ?? 0,
|
||||
'vasel_shode_final' => $data['data'][$existingProvince]->vasel_shode_final ?? 0,
|
||||
];
|
||||
} else {
|
||||
$activities[] = [
|
||||
'name' => $province->name_fa,
|
||||
'tedade' => "",
|
||||
'police_rah' => "",
|
||||
'gozaresh_gasht' => "",
|
||||
'kol_sabt_shode' => "",
|
||||
'vasel_shode' => "",
|
||||
'vasel_shode_bimeh' => "",
|
||||
'vasel_shode_daghi' => "",
|
||||
'vasel_shode_final' => "",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return view('v3.Reports.AccidentReceipt.CountryReport', [
|
||||
'data' => $activities,
|
||||
'fromDate' => $data['fromDate'],
|
||||
'toDate' => $data['toDate'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function registerEvents(): array
|
||||
{
|
||||
return [
|
||||
AfterSheet::class => function (AfterSheet $event) {
|
||||
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
public function drawings(): array
|
||||
{
|
||||
$drawing = new Drawing();
|
||||
$drawing->setName('Logo');
|
||||
$drawing->setDescription('This is my logo');
|
||||
$drawing->setPath(public_path('/dist/logo.png'));
|
||||
$drawing->setWidth(50);
|
||||
$drawing->setHeight(50);
|
||||
$drawing->setOffsetX(5);
|
||||
$drawing->setOffsetY(5);
|
||||
$drawing->setCoordinates('A1');
|
||||
|
||||
$drawing2 = new Drawing();
|
||||
$drawing2->setName('Logo');
|
||||
$drawing2->setDescription('This is my logo');
|
||||
$drawing2->setPath(public_path('/dist/141icon.png'));
|
||||
$drawing2->setWidth(50);
|
||||
$drawing2->setHeight(50);
|
||||
$drawing2->setOffsetX(5);
|
||||
$drawing2->setOffsetY(5);
|
||||
$drawing2->setCoordinates('B1');
|
||||
return [$drawing, $drawing2];
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet): array
|
||||
{
|
||||
return [
|
||||
// Style the first row as bold text.
|
||||
'A:BA' => [
|
||||
'font' => [
|
||||
'name' => 'B Nazanin'
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ class DataTableReport implements FromView, ShouldAutoSize, WithEvents, WithDrawi
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
return view('v3.AccidentReceipt.DataTableReport', [
|
||||
return view('v3.Reports.AccidentReceipt.DataTableReport', [
|
||||
'data' => $this->data,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,58 @@ class ProvinceReport implements FromView, ShouldAutoSize, WithEvents, WithDrawin
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$data = $this->data;
|
||||
return view('v3.AccidentReceipt.ProvinceReport', [
|
||||
'data' => $data['data'],
|
||||
'fromDate' => $data['fromDate'],
|
||||
'ToDate' => $data['ToDate'],
|
||||
$inputData = $this->data;
|
||||
$reportData =$inputData['report'];
|
||||
|
||||
$province = array_search(-1, array_column($reportData, 'province_id'));
|
||||
|
||||
$activities[] = [
|
||||
'name' => 'کل استان',
|
||||
'tedade' => $reportData['data'][$province]->tedade,
|
||||
'police_rah' => $reportData['data'][$province]->police_rah,
|
||||
'gozaresh_gasht' => $reportData['data'][$province]->gozaresh_gasht,
|
||||
'kol_sabt_shode' => $reportData['data'][$province]->kol_sabt_shode,
|
||||
'vasel_shode' => $reportData['data'][$province]->vasel_shode ?? 0,
|
||||
'vasel_shode_bimeh' => $reportData['data'][$province]->vasel_shode_bimeh ?? 0,
|
||||
'vasel_shode_daghi' => $reportData['data'][$province]->vasel_shode_daghi ?? 0,
|
||||
'vasel_shode_final' => $reportData['data'][$province]->vasel_shode_final ?? 0,
|
||||
];
|
||||
|
||||
foreach ($inputData['cities'] as $city) {
|
||||
|
||||
$existingCity = array_search($city->id, array_column($reportData['data'], 'city_id'));
|
||||
|
||||
if ($existingCity) {
|
||||
$activities[] = [
|
||||
'name' => $city->name_fa,
|
||||
'tedade' => $reportData['data'][$existingCity]->tedade,
|
||||
'police_rah' => $reportData['data'][$existingCity]->police_rah,
|
||||
'gozaresh_gasht' => $reportData['data'][$existingCity]->gozaresh_gasht,
|
||||
'kol_sabt_shode' => $reportData['data'][$existingCity]->kol_sabt_shode,
|
||||
'vasel_shode' => $reportData['data'][$existingCity]->vasel_shode ?? 0,
|
||||
'vasel_shode_bimeh' => $reportData['data'][$existingCity]->vasel_shode_bimeh ?? 0,
|
||||
'vasel_shode_daghi' => $reportData['data'][$existingCity]->vasel_shode_daghi ?? 0,
|
||||
'vasel_shode_final' => $reportData['data'][$existingCity]->vasel_shode_final ?? 0,
|
||||
];
|
||||
} else {
|
||||
$activities[] = [
|
||||
'name' => $city->name_fa,
|
||||
'tedade' => "",
|
||||
'police_rah' => "",
|
||||
'gozaresh_gasht' => "",
|
||||
'kol_sabt_shode' => "",
|
||||
'vasel_shode' => "",
|
||||
'vasel_shode_bimeh' => "",
|
||||
'vasel_shode_daghi' => "",
|
||||
'vasel_shode_final' => "",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return view('v3.Reports.AccidentReceipt.ProvinceReport', [
|
||||
'data' => $activities,
|
||||
'fromDate' => $reportData['fromDate'],
|
||||
'toDate' => $reportData['toDate'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ class AccidentReceiptController extends Controller
|
||||
{
|
||||
auth()->user()->addActivityComplete(1126);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
$data = $accidentReceiptTableService->dataTable($request);
|
||||
return Excel::download(new DataTableReport($data), $name);
|
||||
$data = $accidentReceiptTableService->dataTable($request, true);
|
||||
return Excel::download(new DataTableReport($data['data']), $name);
|
||||
}
|
||||
|
||||
public function accidentDamage(Accident $accident): JsonResponse
|
||||
@@ -79,11 +79,11 @@ class AccidentReceiptController extends Controller
|
||||
'accident_type_fa' => DailyAccidentSettings::query()->where('type', 'accident_type')->where('name', $request->accident_type)->first()->value,
|
||||
'way_id' => $nominatimService->get_way_id_from_nominatim($request->lat, $request->lng),
|
||||
'report_base' => $request->report_base,
|
||||
// 'police_file' => $request->report_base ? null : FileFacade::save($request->file('police_file'), 'receipts_files/'),
|
||||
'police_file' => $request->report_base ? null : FileFacade::save($request->file('police_file'), 'receipts_files/'),
|
||||
'police_serial' => $request->police_serial ?? null,
|
||||
'police_file_date' => $request->police_file_date ?? null,
|
||||
// 'damage_picture1' => $request->has('damage_picture1') ? FileFacade::save($request->file('damage_picture1'), 'receipts_files/') : null,
|
||||
// 'damage_picture2' => $request->has('damage_picture2') ? FileFacade::save($request->file('damage_picture2'), 'receipts_files/') : null,
|
||||
'damage_picture1' => FileFacade::save($request->file('damage_picture1'), 'receipts_files/'),
|
||||
'damage_picture2' => FileFacade::save($request->file('damage_picture2'), 'receipts_files/'),
|
||||
'status' => AccidentStates::BEDON_EGHDAM->value,
|
||||
'status_fa' => AccidentStates::name(AccidentStates::BEDON_EGHDAM->value),
|
||||
];
|
||||
@@ -91,14 +91,14 @@ class AccidentReceiptController extends Controller
|
||||
$sum = 0;
|
||||
$damageData = [];
|
||||
|
||||
foreach ($request->items_damge as $key => $damage) {
|
||||
$damage = Damage::query()->find($damage->id);
|
||||
$damageData[$damage->id] = [
|
||||
'value' => $damage->value,
|
||||
foreach ($request->damage_items as $key => $item) {
|
||||
$damage = Damage::query()->find($item['id']);
|
||||
$damageData[$item['id']] = [
|
||||
'value' => $item['value'],
|
||||
'unit' => $damage->unit,
|
||||
'amount' => $damage->amount,
|
||||
'amount' => $item['amount'],
|
||||
];
|
||||
$sum += $damage->amount;
|
||||
$sum += $item['amount'];
|
||||
}
|
||||
|
||||
$ojrate_nasb = $sum/100*20;
|
||||
@@ -109,26 +109,7 @@ class AccidentReceiptController extends Controller
|
||||
|
||||
$accident = Accident::query()->create($accidentData);
|
||||
|
||||
$filesData = [
|
||||
[
|
||||
'name' => 'damage_picture1',
|
||||
'path' => FileFacade::save($request->file('damage_picture1'), "receipts_files/{$accident->id}/"),
|
||||
],
|
||||
[
|
||||
'name' => 'damage_picture2',
|
||||
'path' => FileFacade::save($request->file('damage_picture2'), "receipts_files/{$accident->id}/")
|
||||
]
|
||||
];
|
||||
|
||||
if (!$request->report_base) {
|
||||
$filesData[] = [
|
||||
'name' => 'police_file',
|
||||
'path' => FileFacade::save($request->file('police_file'), "receipts_files/{$accident->id}/")
|
||||
];
|
||||
}
|
||||
|
||||
$accident->damages()->attach($damageData);
|
||||
$accident->files()->createMany($filesData);
|
||||
|
||||
auth()->user()->addActivityComplete(1123);
|
||||
});
|
||||
@@ -148,23 +129,6 @@ class AccidentReceiptController extends Controller
|
||||
$province = Province::query()->where('id', '=', $request->province_id)->first();
|
||||
$city = City::query()->where('id', '=', $request->city_id)->first();
|
||||
|
||||
if ($request->report_base && $accident->police_file) {
|
||||
FileFacade::delete($accident->police_file, true);
|
||||
}
|
||||
|
||||
if (!$request->report_base && $request->filled('police_file')) {
|
||||
FileFacade::delete($accident->police_file, true);
|
||||
}
|
||||
|
||||
if ($request->has('damage_picture1')) {
|
||||
FileFacade::delete($accident->damage_picture1, true);
|
||||
$damage_picture1 = FileFacade::save($request->file('damage_picture1'), 'receipts_files/');
|
||||
}
|
||||
if ($request->has('damage_picture2')) {
|
||||
FileFacade::delete($accident->damage_picture2, true);
|
||||
$damage_picture2 = FileFacade::save($request->file('damage_picture2'), 'receipts_files/');
|
||||
}
|
||||
|
||||
$accidentData = [
|
||||
'province_id' => $province->id,
|
||||
'province_fa' => $province->name_fa,
|
||||
@@ -184,24 +148,40 @@ class AccidentReceiptController extends Controller
|
||||
'accident_type_fa' => DailyAccidentSettings::query()->where('type', 'accident_type')->where('name', $request->accident_type)->first()->value,
|
||||
'way_id' => $nominatimService->get_way_id_from_nominatim($request->lat, $request->lng),
|
||||
'report_base' => $request->report_base,
|
||||
'police_file' => $request->report_base == 0 ? FileFacade::save($request->file('police_file'), 'receipts_files/') : null,
|
||||
'police_serial' => $request->police_serial ?? null,
|
||||
'police_file_date' => $request->police_file_date ?? null,
|
||||
'damage_picture1' => $damage_picture1,
|
||||
'damage_picture2' => $damage_picture2,
|
||||
];
|
||||
|
||||
if ($request->report_base && $accident->police_file) {
|
||||
FileFacade::delete($accident->police_file, true);
|
||||
}
|
||||
|
||||
if (!$request->report_base) {
|
||||
FileFacade::delete($accident->police_file, true);
|
||||
$accidentData['police_file'] = FileFacade::save($request->file('police_file'), "receipts_files/{$accident->id}/");
|
||||
}
|
||||
|
||||
if ($request->has('damage_picture1')) {
|
||||
FileFacade::delete($accident->damage_picture1, true);
|
||||
$accidentData['damage_picture1'] = FileFacade::save($request->file('damage_picture1'), "receipts_files/{$accident->id}/");
|
||||
}
|
||||
|
||||
if ($request->has('damage_picture2')) {
|
||||
FileFacade::delete($accident->damage_picture2, true);
|
||||
$accidentData['damage_picture2'] = FileFacade::save($request->file('damage_picture2'), "receipts_files/{$accident->id}/");
|
||||
}
|
||||
|
||||
$sum = 0;
|
||||
$damageData = [];
|
||||
|
||||
foreach ($request->items_damge as $key => $item) {
|
||||
$damage = Damage::query()->find($item->id);
|
||||
$damageData[$damage->id] = [
|
||||
'value' => $damage->value,
|
||||
foreach ($request->damage_items as $key => $item) {
|
||||
$damage = Damage::query()->find($item['id']);
|
||||
$damageData[$item['id']] = [
|
||||
'value' => $item['value'],
|
||||
'unit' => $damage->unit,
|
||||
'amount' => $damage->amount,
|
||||
'amount' => $item['amount'],
|
||||
];
|
||||
$sum += $item->amount;
|
||||
$sum += $item['amount'];
|
||||
}
|
||||
|
||||
$ojrate_nasb = $sum/100*20;
|
||||
@@ -224,11 +204,14 @@ class AccidentReceiptController extends Controller
|
||||
{
|
||||
FileFacade::delete('storage/receipts_files/'.$accident->id);
|
||||
|
||||
$accident->damages()->detach();
|
||||
DB::transaction(function () use ($accident) {
|
||||
|
||||
$accident->delete();
|
||||
$accident->damages()->detach();
|
||||
|
||||
auth()->user()->addActivityComplete(1125);
|
||||
$accident->delete();
|
||||
|
||||
auth()->user()->addActivityComplete(1125);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
@@ -255,54 +238,33 @@ class AccidentReceiptController extends Controller
|
||||
public function confirmPaymentInfo(ConfirmPaymentInfoRequest $request, Accident $accident): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $accident) {
|
||||
if ($request->has('deposit_insurance_status')) {
|
||||
if ($request->has('deposit_insurance_image')) {
|
||||
$deposit_insurance_image = $request->file('deposit_insurance_image')->storeAs('receipts_files/'.$accident->id, 'deposit_insurance_image_'.$accident->id.'_'.time().'.'.$request->file('deposit_insurance_image')->extension(), 'public');
|
||||
}
|
||||
|
||||
$deposit_insurance_amount = $request->deposit_insurance_amount;
|
||||
} else {
|
||||
$accident->deposit_insurance_image = null;
|
||||
$accident->deposit_insurance_amount = null;
|
||||
}
|
||||
|
||||
if ($request->has('deposit_daghi_status')) {
|
||||
if ($request->has('deposit_daghi_image')) {
|
||||
$deposit_daghi_image = $request->file('deposit_daghi_image')->storeAs('receipts_files/'.$accident->id, 'deposit_daghi_image_'.$accident->id.'_'.time().'.'.$request->file('deposit_daghi_image')->extension(), 'public');
|
||||
}
|
||||
|
||||
$deposit_daghi_amount = $request->deposit_daghi_amount;
|
||||
} else {
|
||||
$accident->deposit_daghi_image = null;
|
||||
$accident->deposit_daghi_amount = null;
|
||||
}
|
||||
|
||||
$accident->update([
|
||||
'deposit_insurance_image' => $deposit_insurance_image,
|
||||
'deposit_insurance_amount' => $deposit_insurance_amount,
|
||||
'deposit_daghi_image' => $deposit_daghi_image,
|
||||
'deposit_daghi_amount' => $deposit_daghi_amount,
|
||||
'deposit_insurance_image' => $request->deposit_insurance_image != null ? FileFacade::save($request->deposit_insurance_image, "receipts_files/{$accident->id}/deposit_insurance/") : null,
|
||||
'deposit_insurance_amount' => $request->deposit_insurance_amount ?? 0,
|
||||
'deposit_daghi_image' => $request->deposit_insurance_image != null ? FileFacade::save($request->deposit_daghi_image, "receipts_files/{$accident->id}/deposit_daghi/") : null,
|
||||
'deposit_daghi_amount' => $request->deposit_daghi_amount ?? 0,
|
||||
'status' => AccidentStates::SABT_FISH->value,
|
||||
'status_fa' => AccidentStates::name(AccidentStates::SABT_FISH->value),
|
||||
]);
|
||||
|
||||
auth()->user()->addActivityComplete(1132);
|
||||
|
||||
return $this->successResponse();
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function submitInvoice(Accident $accident, PaymentService $paymentService): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($accident, $paymentService) {
|
||||
$final_amount = $accident->sum - ($accident->deposit_insurance_amount + $accident->deposit_daghi_amount);
|
||||
|
||||
$final_amount = $accident->sum - ($accident->deposit_insurance_amount + $accident->deposit_daghi_amount);
|
||||
if ($final_amount < 0) {
|
||||
return $this->errorResponse('error');
|
||||
}
|
||||
|
||||
if ($final_amount < 0) {
|
||||
return $this->errorResponse('error');
|
||||
}
|
||||
$bill_code = $paymentService->invoiceBillApi($accident->driver_national_code, $final_amount);
|
||||
|
||||
$bill_code = $paymentService->invoiceBillApi($accident->driver_national_code, $final_amount);
|
||||
DB::transaction(function () use ($bill_code, $final_amount, $accident) {
|
||||
|
||||
$accident->update([
|
||||
'final_amount' => $final_amount,
|
||||
@@ -311,14 +273,14 @@ class AccidentReceiptController extends Controller
|
||||
'status_fa' => AccidentStates::name(AccidentStates::SODOR_FACTOR->value),
|
||||
]);
|
||||
|
||||
$msg = "فاکتور با شناسه پرداخت \n" . explode("/", $accident->bill_code)[0]. "\n در سامانه سازمان راهداری ثبت شد. برای پرداخت از لینک زیر اقدام نمایید.\n\n".env("PAYMENT_LINK")."/#/pay/".explode("/", $accident->bill_code)[0]."/$final_amount";
|
||||
|
||||
Sms::sendSms($accident->driver_phone_number, $msg);
|
||||
|
||||
auth()->user()->addActivityComplete(1129);
|
||||
|
||||
return $this->successResponse();
|
||||
});
|
||||
|
||||
$msg = "فاکتور با شناسه پرداخت \n" . explode("/", $accident->bill_code)[0]. "\n در سامانه سازمان راهداری ثبت شد. برای پرداخت از لینک زیر اقدام نمایید.\n\n".env("PAYMENT_LINK")."/#/pay/".explode("/", $accident->bill_code)[0]."/$final_amount";
|
||||
|
||||
Sms::sendSms($accident->driver_phone_number, $msg);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function checkPaymentStatus(Accident $accident, PaymentService $paymentService): JsonResponse
|
||||
@@ -344,9 +306,9 @@ class AccidentReceiptController extends Controller
|
||||
}
|
||||
|
||||
auth()->user()->addActivityComplete(1130);
|
||||
|
||||
return $this->successResponse();
|
||||
});
|
||||
|
||||
return $this->successResponse($accident);
|
||||
}
|
||||
|
||||
public function generatePoliceDocument(Request $request, Accident $accident): JsonResponse
|
||||
@@ -361,6 +323,20 @@ class AccidentReceiptController extends Controller
|
||||
auth()->user()->addActivityComplete(1131);
|
||||
});
|
||||
|
||||
return $this->successResponse($accident);
|
||||
}
|
||||
|
||||
public function sendSmsAgain(Accident $accident): JsonResponse
|
||||
{
|
||||
$msg = "فاکتور با شناسه پرداخت \n" . explode("/", $accident->bill_code)[0]. "\n در سامانه سازمان راهداری ثبت شد. برای پرداخت از لینک زیر اقدام نمایید.\n\n".env("PAYMENT_LINK")."/#/pay/".explode("/", $accident->bill_code)[0]."/$accident->final_amount";
|
||||
|
||||
Sms::sendSms($accident->driver_phone_number, $msg);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function accidentTypes(): JsonResponse
|
||||
{
|
||||
return $this->successResponse(DailyAccidentSettings::query()->where('type', 'accident_type')->get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Reports;
|
||||
|
||||
use App\Exports\V3\AccidentReceipt\CityReport;
|
||||
use App\Exports\V3\AccidentReceipt\ProvinceReport;
|
||||
use App\Exports\V3\AccidentReceipt\CountryReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\AccidentReceiptTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -16,29 +18,42 @@ class AccidentReceiptReportController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function countryReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->countryReport($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data['data'],
|
||||
'provinces' => Province::all(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->provinceReport($request);
|
||||
return $this->successResponse($data['data']);
|
||||
return $this->successResponse([
|
||||
'activities' => $data['data'],
|
||||
'cities' => City::query()->where('province_id', '=', $request->province_id)
|
||||
->where('type_id', '=', 1)
|
||||
->get(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function cityReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
public function countryExcelReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->cityReport($request);
|
||||
return $this->successResponse($data['data']);
|
||||
$data = $accidentReceiptTableService->countryReport($request);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new CountryReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceExcelReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->provinceReport($request);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ProvinceReport($data), $name);
|
||||
}
|
||||
|
||||
public function cityExcelReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->cityReport($request);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new CityReport($data), $name);
|
||||
return Excel::download(new ProvinceReport([
|
||||
'report' => $data,
|
||||
'cities' => City::query()->where('province_id', '=', $request->province_id)
|
||||
->where('type_id', '=', 1)
|
||||
->get(['id', 'name_fa']),
|
||||
]), $name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ class StoreRequest extends FormRequest
|
||||
'police_file_date' => 'required_if:report_base,0|date',
|
||||
'damage_picture1' => 'required|file|mimes:pdf,jpg,jpeg,png',
|
||||
'damage_picture2' => 'required|file|mimes:pdf,jpg,jpeg,png',
|
||||
'damage_items' => 'required|array',
|
||||
'damage_items.*.value' => 'required',
|
||||
'damage_items.*.amount' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ class UpdateRequest extends FormRequest
|
||||
'police_file_date' => 'required_if:report_base,0|date',
|
||||
'damage_picture1' => 'required|file|mimes:pdf,jpg,jpeg,png',
|
||||
'damage_picture2' => 'required|file|mimes:pdf,jpg,jpeg,png',
|
||||
'damage_items' => 'required|array',
|
||||
'damage_items.*.value' => 'required',
|
||||
'damage_items.*.amount' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,19 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\ReceiptReportAble;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class Accident extends Model
|
||||
{
|
||||
use ReceiptReportAble, HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
@@ -92,4 +97,25 @@ class Accident extends Model
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
|
||||
protected function damagePicture1(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn($value) => $value == null ? null : Storage::disk('public')->url($value)
|
||||
);
|
||||
}
|
||||
|
||||
protected function damagePicture2(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn($value) => $value == null ? null : Storage::disk('public')->url($value)
|
||||
);
|
||||
}
|
||||
|
||||
protected function policeFile(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn($value) => $value == null ? null : Storage::disk('public')->url($value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,20 +12,23 @@ class AccidentReceiptTableService
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function dataTable(Request $request)
|
||||
public function dataTable(Request $request, $loadRelations = false)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$query = null;
|
||||
|
||||
if ($user->hasPermissionTo('show-receipt')) {
|
||||
$query = Accident::query();
|
||||
$query = Accident::query()
|
||||
->when($loadRelations, fn ($query) => $query->with('damages'));
|
||||
}
|
||||
else {
|
||||
if (is_null($user->province_id)) {
|
||||
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
$query = Accident::query()->where('province_id', '=', $user->province_id);
|
||||
$query = Accident::query()
|
||||
->where('province_id', '=', $user->province_id)
|
||||
->when($loadRelations, fn ($query) => $query->with('damages'));
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
@@ -36,7 +39,7 @@ class AccidentReceiptTableService
|
||||
);
|
||||
}
|
||||
|
||||
public function provinceReport(Request $request): array
|
||||
public function countryReport(Request $request): array
|
||||
{
|
||||
$data = DB::select(
|
||||
'SELECT
|
||||
@@ -71,16 +74,30 @@ class AccidentReceiptTableService
|
||||
);
|
||||
|
||||
return [
|
||||
'data' => collect($data),
|
||||
'data' => $data,
|
||||
'fromDate' => $request->from_date,
|
||||
'toDate' => $request->date_to,
|
||||
];
|
||||
}
|
||||
|
||||
public function cityReport(Request $request): array
|
||||
public function provinceReport(Request $request): array
|
||||
{
|
||||
$data = DB::select(
|
||||
'SELECT
|
||||
"استانی" as city_fa,
|
||||
-1 as city_id,
|
||||
COUNT(id) AS tedade,
|
||||
COUNT(CASE WHEN report_base = 0 THEN 1 END) AS police_rah,
|
||||
COUNT(CASE WHEN report_base = 1 THEN 1 END) AS gozaresh_gasht,
|
||||
SUM(`sum`) AS kol_sabt_shode,
|
||||
SUM(CASE WHEN STATUS > 3 THEN `sum` END) AS vasel_shode,
|
||||
SUM(CASE WHEN STATUS > 3 THEN `deposit_insurance_amount` END) AS vasel_shode_bimeh,
|
||||
SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi,
|
||||
SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final
|
||||
FROM `accidents`
|
||||
where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'" AND province_id ='.$request->province_id.'
|
||||
union
|
||||
SELECT
|
||||
city_fa,
|
||||
city_id,
|
||||
COUNT(id) AS tedade,
|
||||
@@ -98,7 +115,7 @@ class AccidentReceiptTableService
|
||||
);
|
||||
|
||||
return [
|
||||
'data' => collect($data),
|
||||
'data' => $data,
|
||||
'fromDate' => $request->from_date,
|
||||
'toDate' => $request->date_to,
|
||||
];
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<!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>
|
||||
|
||||
</head>
|
||||
|
||||
<body dir="rtl" style="text-align: center;">
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
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="9"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
||||
گزارش خسارات وارده به ابنیه فنی و تاسیسات راه از تاریخ
|
||||
{{ verta($fromDate)->format('Y/n/j') }}
|
||||
تا
|
||||
تاریخ
|
||||
{{ verta($toDate)->format('Y/n/j') }}
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr class="headercolortable">
|
||||
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
اداره کل
|
||||
</th>
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
تعداد کل
|
||||
</th>
|
||||
<th colspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
نحوه شناسایی خسارت
|
||||
</th>
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
مبلغ کل خسارت ثبت شده (ریال)
|
||||
</th>
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
کل مبلغ وصول شده (ریال)
|
||||
</th>
|
||||
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
مبلغ وصول شده به تفکیک نوع پرداخت (ریال)
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
گزارش پلیس راه
|
||||
</th>
|
||||
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
گزارش گشت راهداری
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
فیش
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
بیمه
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
کسر داغی
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($data as $road)
|
||||
<tr>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['name'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['tedade'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['police_rah'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['gozaresh_gasht'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['kol_sabt_shode'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['vasel_shode'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['vasel_shode_final'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['vasel_shode_bimeh'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['vasel_shode_daghi'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,62 @@
|
||||
<!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>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="16" style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;text-align:center;">
|
||||
تاریخ دریافت گزارش: {{verta()->now()->format('Y/m/d H:i')}}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="16" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="16" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">گزارش کلی خسارات وارده</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">کد یکتا</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">استان</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">شهرستان</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">نام محور</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">نوع تصادف</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">تاریخ تصادف</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ کل خسارت</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">پلاک</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">تاریخ ثبت</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">آخرین وضعیت</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ فیش</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ بیمه</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ داغی</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($data 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_fa}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->city_fa}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->axis_name}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->accident_type_fa}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{Hekmatinasser\Verta\Verta::instance($item->accident_date)->format('Y/n/j')}} {{$item->accident_time}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->sum ?? 0}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->plaque}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{Hekmatinasser\Verta\Verta::instance($item->created_at)->format('Y/n/j')}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->status_fa}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->final_amount ?? 0}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->deposit_insurance_amount ?? 0}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->deposit_daghi_amount ?? 0}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,110 @@
|
||||
<!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>
|
||||
|
||||
</head>
|
||||
|
||||
<body dir="rtl" style="text-align: center;">
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
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="9"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
||||
گزارش خسارات وارده به ابنیه فنی و تاسیسات راه از تاریخ
|
||||
{{ verta($fromDate)->format('Y/n/j') }}
|
||||
تا
|
||||
تاریخ
|
||||
{{ verta($toDate)->format('Y/n/j') }}
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr class="headercolortable">
|
||||
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
اداره کل
|
||||
</th>
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
تعداد کل
|
||||
</th>
|
||||
<th colspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
تعداد نحوه شناسایی خسارت
|
||||
</th>
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
مبلغ کل خسارت ثبت شده (ریال)
|
||||
</th>
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
کل مبلغ وصول شده (ریال)
|
||||
</th>
|
||||
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
مبلغ وصول شده به تفکیک نوع پرداخت (ریال)
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
گزارش پلیس راه
|
||||
</th>
|
||||
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
گزارش گشت راهداری
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
فیش
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
بیمه
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
داغی
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($data as $road)
|
||||
<tr>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['name'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['tedade'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['police_rah'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['gozaresh_gasht'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['kol_sabt_shode'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['vasel_shode'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['vasel_shode_final'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['vasel_shode_bimeh'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['vasel_shode_daghi'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\ReceiptReportController;
|
||||
use App\Http\Controllers\V3\Auth\LogoutController;
|
||||
use App\Http\Controllers\V3\CMMSMachinesController;
|
||||
use App\Http\Controllers\V3\DamageManagementController;
|
||||
@@ -9,6 +8,7 @@ use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshSampleController;
|
||||
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshTypeController;
|
||||
use App\Http\Controllers\V3\Dashboard\ObservedItemController;
|
||||
use App\Http\Controllers\V3\Dashboard\AccidentReceiptController;
|
||||
use App\Http\Controllers\V3\Dashboard\Reports\AccidentReceiptReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\Reports\RoadItemsReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\Reports\RoadPatrolReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadItemsProjectController;
|
||||
@@ -19,6 +19,14 @@ use App\Http\Controllers\V3\ProfileController;
|
||||
use App\Http\Controllers\V3\RahdaranController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('admin/permissions', function () {
|
||||
if (auth()->user()->username == 'witel') {
|
||||
auth()->user()->syncPermissions(\App\Models\Permission::all()->pluck('id')->toArray());
|
||||
return response('done');
|
||||
}
|
||||
abort(404);
|
||||
});
|
||||
|
||||
Route::prefix('harim')->name('harim')->group(function () {
|
||||
Route::prefix('divarkeshi')->name('divarkeshi')->controller(DivarkeshiController::class)->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
@@ -254,14 +262,16 @@ Route::prefix('receipts')
|
||||
Route::get('/submit_invoice/{accident}', 'submitInvoice')->name('submitInvoice');
|
||||
Route::get('/check_payment_status/{accident}', 'checkPaymentStatus')->name('checkPaymentStatus');
|
||||
Route::get('/generate_police_document/{accident}', 'generatePoliceDocument')->name('generatePoliceDocument');
|
||||
Route::get('/send_sms_again/{accident}', 'sendSmsAgain')->name('sendSmsAgain');
|
||||
Route::get('/accident_types', 'accidentTypes')->name('accidentTypes');
|
||||
});
|
||||
|
||||
Route::prefix('receipt_reports')
|
||||
->name('receiptReports.')
|
||||
->controller(ReceiptReportController::class)
|
||||
->controller(AccidentReceiptReportController::class)
|
||||
->group(function () {
|
||||
Route::get('/country_report', 'countryReport')->name('countryReport');
|
||||
Route::get('/province_report', 'provinceReport')->name('provinceReport');
|
||||
Route::get('/city_report', 'cityReport')->name('cityReport');
|
||||
Route::get('/country_excel_report', 'countryExcelReport')->name('countryExcelReport');
|
||||
Route::get('/province_excel_report', 'provinceExcelReport')->name('provinceExcelReport');
|
||||
Route::get('/city_excel_report', 'cityExcelReport')->name('cityExcelReport');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user