diff --git a/app/Http/Controllers/Admin/ReportController.php b/app/Http/Controllers/Admin/ReportController.php index 976af2b..f21aaea 100755 --- a/app/Http/Controllers/Admin/ReportController.php +++ b/app/Http/Controllers/Admin/ReportController.php @@ -11,6 +11,7 @@ use App\Models\Status; use App\Services\Util; use App\Models\Booking; use App\Models\TravelAgenda; +use App\Models\TravelCompany; use App\Models\ServiceProvider; use Illuminate\Validation\Rules\In; use App\Http\Controllers\Controller; @@ -29,6 +30,8 @@ class ReportController extends Controller { $data = [ 'filter_lead_status' => Status::get()->pluck('name', 'id')->toArray(), + 'filter_travel_companies' => TravelCompany::where('active', true)->get()->pluck('name', 'id')->toArray(), + ]; return view('admin.report.bookings', $data); } @@ -38,10 +41,24 @@ class ReportController extends Controller $data = [ 'serviceProviders' => ServiceProvider::all(), 'filter_lead_status' => Status::get()->pluck('name', 'id')->toArray(), + 'filter_travel_companies' => TravelCompany::where('active', true)->get()->pluck('name', 'id')->toArray(), + ]; return view('admin.report.service_providers', $data); } + public function checkBookings() + { + $data = [ + 'filter_lead_status' => Status::get()->pluck('name', 'id')->toArray(), + 'filter_travel_companies' => TravelCompany::where('active', true)->get()->pluck('name', 'id')->toArray(), + + ]; + return view('admin.report.check_bookings', $data); + } + + //checkBookingsDatatable + private function prozessBookingSearch() { @@ -59,6 +76,10 @@ class ReportController extends Controller $q->whereIn('status_id', Request::get('filter_lead_status_id')); }); } + if(Request::get('filter_travel_company_id') != ""){ + $query->whereIn("travel_company_id", Request::get('filter_travel_company_id')); + } + if(Request::get('filter_travel_date_from') != ""){ $travel_date_from = Carbon::parse(Request::get('filter_travel_date_from'))->format("Y-m-d"); $query->where("start_date", '>=', $travel_date_from); @@ -86,7 +107,9 @@ class ReportController extends Controller return \DataTables::eloquent($query) ->with('price_total_sum', function() use ($query) { - return Util::_number_format($query->sum('price')); + $price1 = with(clone $query)->whereNull('canceled')->sum('price'); + $price2 = with(clone $query)->whereNotNull('canceled')->sum('price_canceled'); + return Util::_number_format($price1+$price2); }) ->with('price_total_total_sum', function() use ($query) { return Util::_number_format($query->sum('price_total')); @@ -108,6 +131,9 @@ class ReportController extends Controller ->addColumn('customer.fullName', function (Booking $booking) { return $booking->customer->fullName(); }) + ->addColumn('price', function (Booking $booking) { + return $booking->booking_strono ? $booking->price_canceled : $booking->price; + }) ->addColumn('proceeds', function (Booking $booking) { return $booking->proceeds(); }) @@ -161,6 +187,7 @@ class ReportController extends Controller ->orderColumn('id', 'id $1') ->orderColumn('start_date', 'start_date $1') ->orderColumn('end_date', 'end_date $1') + ->orderColumn('price', 'price $1') ->orderColumn('booking_date', 'booking_date $1') ->orderColumn('customer.fullName', 'customer.firstname $1') ->orderColumn('customer.firstname', 'customer.firstname $1') @@ -230,7 +257,7 @@ class ReportController extends Controller $new = true; foreach ($export->service_provider_entries as $service_provider_entry){ if($new){ - $total_price += $export->getPriceRaw(); + $total_price += $export->isCanceled() ? $export->getPriceCanceledRaw() : $export->getPriceRaw(); $total_price_total += $export->getPriceTotalRaw(); $total_proceeds += $export->proceeds(true); } @@ -240,7 +267,7 @@ class ReportController extends Controller 'Status' => $new ? $export->lead->status->name : "", 'Storno' => $new ? $storno_date : "", 'MyJack Nr.' => $new ? $export->merlin_order_number : "", - 'Organisation' => $new ? $export->price : "", + 'Organisation' => $new ? ($export->isCanceled() ? $export->price_canceled : $export->price) : "", 'Reisepreis' => $new ? $export->price_total : "", 'Erlös' => $new ? $export->proceeds() : "", 'Kunde' => $new ? $export->customer->fullName() : "", @@ -260,13 +287,14 @@ class ReportController extends Controller $new = false; } }else{ - $total_price += $export->getPriceRaw(); + $total_price += $export->booking->isCanceled() ? $export->booking->getPriceCanceledRaw() : $export->booking->getPriceRaw(); $columns[] = array( 'BuchungsID' => $export->id, 'Status' => $export->lead->status->name, 'Storno' => $storno_date, 'MyJack Nr.' => $export->merlin_order_number, 'Organisation' => $export->price, + 'Organisation' => $export->isCanceled() ? $export->price_canceled : $export->price, 'Reisepreis' => $export->price_total, 'Erlös' => $export->proceeds(), 'Kunde' => $export->customer->fullName(), @@ -330,7 +358,11 @@ class ReportController extends Controller }); }); } - + if(Request::get('filter_travel_company_id') != ""){ + $query->whereHas('booking', function ($q) { + $q->whereIn("travel_company_id", Request::get('filter_travel_company_id')); + }); + } if(Request::get('filter_is_cleared') != ""){ $query->where('is_cleared', '=', Request::get('filter_is_cleared')); } @@ -366,8 +398,11 @@ class ReportController extends Controller $price = 0; $isset = []; foreach ($all as $v){ - $price += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->getPriceRaw(); + if(!in_array($v->booking->lead_id, $isset)){ + $price += $v->booking->isCanceled() ? $v->booking->getPriceCanceledRaw() : $v->booking->getPriceRaw(); + } $isset[] = $v->booking->lead_id; + } return Util::_number_format($price); }) @@ -409,6 +444,9 @@ class ReportController extends Controller ->addColumn('booking.customer.fullName', function (ServiceProviderEntry $serviceProviderEntry) { return $serviceProviderEntry->booking->customer->fullName(); }) + ->addColumn('booking.price', function (ServiceProviderEntry $serviceProviderEntry) { + return $serviceProviderEntry->booking->booking_strono ? $serviceProviderEntry->booking->price_canceled : $serviceProviderEntry->booking->price; + }) ->addColumn('booking.proceeds', function (ServiceProviderEntry $serviceProviderEntry) { return $serviceProviderEntry->booking->proceeds(); }) @@ -447,6 +485,7 @@ class ReportController extends Controller } }) ->orderColumn('booking.id', 'booking.id $1') + ->orderColumn('booking.price', 'booking.price $1') ->orderColumn('booking.start_date', 'booking.start_date $1') ->orderColumn('booking.end_date', 'booking.end_date $1') ->orderColumn('booking.customer.firstname', 'booking.customer.firstname $1') @@ -513,7 +552,7 @@ class ReportController extends Controller foreach($exports as $export) { $new = in_array($export->booking->id, $isset) ? false : true; if($new){ - $total_price += $export->booking->getPriceRaw(); + $total_price += $export->booking->isCanceled() ? $export->booking->getPriceCanceledRaw() : $export->booking->getPriceRaw(); $total_price_total += $export->booking->getPriceTotalRaw(); $total_proceeds += $export->booking->proceeds(true); } @@ -524,7 +563,7 @@ class ReportController extends Controller 'CRM Nr' => $new ? $export->booking->lead_id : "", 'Kunde' => $new ? $export->booking->customer->name : "", 'Reisedatum' => $new ? $export->booking->getStartDateFormat() : "", - 'Organisation' => $new ? $export->booking->price : "", + 'Organisation' => $new ? ($export->booking->isCanceled() ? $export->booking->price_canceled : $export->booking->price) : "", 'Gesamtreisepreis' => $new ? $export->booking->price_total : "", 'Reiseland' => $new && $export->booking->travel_country ? $export->booking->travel_country->name : "", 'Reiseprogramm' => $new && $export->booking->travel_agenda ? $export->booking->travel_agenda->name : "", @@ -622,6 +661,75 @@ class ReportController extends Controller } return Excel::download(new ReportCollectionExport($columns, $headers), $filename.'.xls'); } + + public function checkBookingsDatatable() + { + $query = $this->prozessBookingSearch(); + return \DataTables::eloquent($query) + ->addColumn('id', function (Booking $booking) { + return '' . $booking->id . ''; + }) + ->addColumn('old_crm', function (Booking $booking) { + return ''.$booking->id.''; + }) + ->addColumn('id', function (Booking $booking) { + return '' . $booking->id . ''; + }) + ->addColumn('price', function (Booking $booking) { + return $booking->price; + }) + ->addColumn('service_total', function (Booking $booking) { + return $booking->getServiceTotal(); + }) + ->addColumn('price_total', function (Booking $booking) { + return $booking->price_total; + }) + ->addColumn('check_total', function (Booking $booking) { + $check = $booking->getPriceRaw() + $booking->getServiceTotal(true); + return ($booking->getPriceTotalRaw() != $check) ? ''.Util::_number_format($check).'' : ""; + }) + ->addColumn('price_canceled', function (Booking $booking) { + return $booking->isCanceled() ? $booking->price_canceled : ""; + }) + + ->addColumn('start_date', function (Booking $booking) { + return $booking->getStartDateFormat(); + }) + ->addColumn('end_date', function (Booking $booking) { + return $booking->getEndDateFormat(); + }) + ->addColumn('booking_date', function (Booking $booking) { + return $booking->getBookingDateFormat(); + }) + + ->addColumn('lead.status_id', function (Booking $booking) { + if($booking->lead && $booking->lead->status_id){ + $color = $booking->lead->status->color; + $icon = ""; + if($booking->lead->status_id == 14 && $booking->lead->is_rebook){ + $color = '#94ae59'; + $icon = ' '; + } + if($booking->lead->status_id == 14 && !$booking->lead->is_rebook){ + $icon = ' '; + } + return ''.$icon.$booking->lead->status->name.''; + } + return '-'; + }) + ->orderColumn('id', 'id $1') + ->orderColumn('old_crm', 'old_crm $1') + ->orderColumn('start_date', 'start_date $1') + ->orderColumn('end_date', 'end_date $1') + ->orderColumn('price', 'price $1') + ->orderColumn('booking_date', 'booking_date $1') + ->orderColumn('customer.firstname', 'customer.firstname $1') + ->orderColumn('customer.name', 'customer.name $1') + //->orderColumn('lead.status_id', 'lead.status_id $1') + //->orderColumn('is_cleared', 'is_cleared $1') + ->rawColumns(['id', 'old_crm', 'check_total', 'lead.status_id']) + ->make(true); + } } diff --git a/app/Http/Controllers/SyS/Tools/ContentLinkController.php b/app/Http/Controllers/SyS/Tools/ContentLinkController.php index ffa13a1..1185fa7 100755 --- a/app/Http/Controllers/SyS/Tools/ContentLinkController.php +++ b/app/Http/Controllers/SyS/Tools/ContentLinkController.php @@ -38,7 +38,8 @@ class ContentLinkController extends Controller //content_links public function index() { - /*$query = Booking::with('booking_draft_items')->select('booking.*')->where('new_drafts', true); + + /*$query = Booking::with('booking_draft_items')->select('booking.*')->where('new_drafts', true); $query->whereHas('booking_draft_items', function ($q) { $q->where('comfort', true); @@ -49,10 +50,27 @@ class ContentLinkController extends Controller $booking->save(); } */ - dd("nothing"); + + $bookings = Booking::orderBy('id', 'DESC')->offset(0)->limit(1000)->get(); + + + + + // dd("nothing"); $val = []; $text = ""; - /* $travelGuides = TravelGuide::all(); + + $data = [ + 'text' => $text, + 'bookings' => $bookings, + ]; + return view('sys.tools.links', $data); + + } + + /* + clean code + $travelGuides = TravelGuide::all(); foreach ($travelGuides as $travelGuide){ if(strpos($travelGuide->full_text, "


") !== false){ $val[$travelGuide->id] = "


"; @@ -71,13 +89,6 @@ class ContentLinkController extends Controller // $new_text = preg_replace('/]*>([\s\S]*?)<\/h1[^>]*>/', '', $TravelGuide->full_text); */ - $data = [ - 'text' => $text, - 'values' => $val, - ]; - return view('sys.tools.links', $data); - - } public function store() { diff --git a/app/Models/Booking.php b/app/Models/Booking.php index 7ae553e..ef4a28c 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -695,29 +695,37 @@ class Booking extends Model $travel_price_children = 0; $total_adult = 0; $total_children = 0; + $travel_adult = 0; + $travel_children = 0; foreach ($this->booking_draft_items as $booking_draft_item) { - //24 Rundreise + //24 Rundreise ist der Grundeintrag für die Reise if($booking_draft_item->draft_type_id == 24){ $travel_draft_item = $booking_draft_item; continue; } $prices = $booking_draft_item->getItemPrice(); - //Grundpreis Reise + //Grundpreis Reise //pro Persopn im Zimmer if($booking_draft_item->draft_type_id == 30){ $travel_price_adult += $prices['adult']; $travel_price_children += $prices['children']; + $travel_adult += $booking_draft_item->adult; + $travel_children += $booking_draft_item->children; } $total_adult += $prices['adult']; $total_children += $prices['children']; } + + if($travel_draft_item){ $travel_draft_item->setPriceAdultRaw($travel_price_adult); $travel_draft_item->setPriceChildrenRaw($travel_price_children); + $travel_draft_item->adult = $travel_adult; + $travel_draft_item->children = $travel_children; $travel_draft_item->save(); } - $this->price = $total_adult + $total_children; + $this->price_total = $this->getPriceRaw() + $this->getServiceTotal(true); $this->save(); } diff --git a/app/Repositories/BookingRepository.php b/app/Repositories/BookingRepository.php index 372d5f3..2bf9a62 100644 --- a/app/Repositories/BookingRepository.php +++ b/app/Repositories/BookingRepository.php @@ -151,6 +151,7 @@ class BookingRepository extends BaseRepository { 'deposit_total' => $data['deposit_total'] ? Util::_clean_float($data['deposit_total']) : 0, 'final_payment' => $data['final_payment'] ? Util::_clean_float($data['final_payment']) : 0, 'final_payment_date' => $data['final_payment_date'] ? _reformat_date($data['final_payment_date']) : null, + 'price_total' => ($this->model->getPriceRaw() + $this->model->getServiceTotal(true)), ]; $this->model->fill($fill); $this->model->save(); @@ -197,6 +198,9 @@ class BookingRepository extends BaseRepository { } } } + $this->model->price_total = ($this->model->getPriceRaw() + $this->model->getServiceTotal(true)); + $this->model->save(); + return $this->model; } diff --git a/app/Repositories/FileRepository.php b/app/Repositories/FileRepository.php index 0ddc8d8..dce4d3a 100644 --- a/app/Repositories/FileRepository.php +++ b/app/Repositories/FileRepository.php @@ -57,8 +57,7 @@ class FileRepository extends BaseRepository { $this->originalName = $file->getClientOriginalName(); $this->extension = strtolower($file->getClientOriginalExtension()); $this->mine = $file->getClientMimeType(); - $this->size = $file->getClientSize(); - + $this->size = $file->getSize(); $this->makeFilename(); //$dir = $this->model->getInvoiceStorageAttDir(); diff --git a/resources/views/admin/report/bookings.blade.php b/resources/views/admin/report/bookings.blade.php index e2299fe..ea99b1c 100755 --- a/resources/views/admin/report/bookings.blade.php +++ b/resources/views/admin/report/bookings.blade.php @@ -11,7 +11,7 @@
-
+
- +
+ + +
@@ -88,11 +95,11 @@ - Total + Total 0 0 0 - + @@ -117,6 +124,7 @@ d.filter_booking_date_from = $('input[name=filter_booking_date_from]').val(); d.filter_booking_date_to = $('input[name=filter_booking_date_to]').val(); d.filter_db_lead_status_id = $('#filter_lead_status_id').val(); + d.filter_travel_company_id = $('#filter_travel_company_id').val(); } }, "columns": [ @@ -148,7 +156,8 @@ $('#proceed_total_sum').html(settings.json.proceed_total_sum); } }); - $('#filter_service_provider_id, #filter_is_cleared, #filter_sort_by, #filter_lead_status_id').on('change', function(){ + $('#filter_service_provider_id, #filter_is_cleared, #filter_sort_by, #filter_lead_status_id, #filter_travel_company_id').on('change', function(){ + console.log("asd"); table.order( [ 11, 'desc' ] ).draw(); }); $('.datepicker-base').on('change', function(){ diff --git a/resources/views/admin/report/check_bookings.blade.php b/resources/views/admin/report/check_bookings.blade.php new file mode 100644 index 0000000..68f4c67 --- /dev/null +++ b/resources/views/admin/report/check_bookings.blade.php @@ -0,0 +1,157 @@ +@extends('layouts.layout-2') + +@section('content') +

+ Buchungen Preise überprüfen +

+
+ {!! Form::open(['url' => route('admin_report_export_bookings'), 'class' => '']) !!} + {!! Form::hidden('order', '[[7, "asc"]]', ['id'=>'order_table']) !!} +
+
+ +
+ + +
+
+ + +
+ +
+ +
+
+
+ von +
+ +
+ +
+
+ bis +
+ +
+
+
+ +
+ +
+
+
+ von +
+ +
+ +
+
+ bis +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
BuchungsIDv2{{__('Status')}}{{__('Organisation')}}{{__('Vermittlung')}}{{__('Gesamtpreis')}}{{__('Check')}}{{__('Strono')}}{{__('Vorname')}}{{__('Nachname')}}{{__('Reisedatum')}}{{__('bis')}}{{__('Buchungsdatum')}}
+ + +
+ {!! Form::close() !!} +
+ + + + + +@endsection \ No newline at end of file diff --git a/resources/views/admin/report/service_providers.blade.php b/resources/views/admin/report/service_providers.blade.php index ecc195d..4381691 100755 --- a/resources/views/admin/report/service_providers.blade.php +++ b/resources/views/admin/report/service_providers.blade.php @@ -53,7 +53,15 @@
-
+
+ + +
+
@@ -83,11 +91,11 @@ - Total + Total 0 0 0 - + @@ -114,6 +122,7 @@ d.filter_travel_date_to = $('input[name=filter_travel_date_to]').val(); d.filter_is_cleared = $('select[name=filter_is_cleared]').val(); d.filter_db_lead_status_id = $('#filter_lead_status_id').val(); + d.filter_travel_company_id = $('#filter_travel_company_id').val(); } }, "columns": [ @@ -147,7 +156,7 @@ } }); - $('#filter_service_provider_id, #filter_is_cleared, #filter_sort_by, #filter_lead_status_id').on('change', function(){ + $('#filter_service_provider_id, #filter_is_cleared, #filter_sort_by, #filter_lead_status_id, #filter_travel_company_id').on('change', function(){ table.order( [ 10, 'asc' ] ).draw(); }); $('.datepicker-base').on('change', function(){ diff --git a/resources/views/layouts/includes/layout-sidenav.blade.php b/resources/views/layouts/includes/layout-sidenav.blade.php index 7c5085e..52ec399 100755 --- a/resources/views/layouts/includes/layout-sidenav.blade.php +++ b/resources/views/layouts/includes/layout-sidenav.blade.php @@ -372,12 +372,19 @@
  • {{ __('Buchungen & Leistungen') }}
  • + @endif @if(Auth::user()->isPermission('sua-re-pp'))
  • {{ __('Leistungsträger-Zahlungen') }}
  • @endif + @if(Auth::user()->isPermission('sua-re-bo')) +
  • +
    {{ __('Preise pürfen') }}
    +
  • + @endif + @endif @@ -399,7 +406,7 @@
    • -
      {{ __('Tree from HTML') }}
      +
      {{ __('todo some') }}
    • {{ __('Tree') }}
      diff --git a/resources/views/sys/tools/links.blade.php b/resources/views/sys/tools/links.blade.php index e91ed68..13f7bba 100755 --- a/resources/views/sys/tools/links.blade.php +++ b/resources/views/sys/tools/links.blade.php @@ -23,27 +23,60 @@
      -
      {!! Form::open(['url' => route('sysadmin_tools_content_links'), 'class' => '']) !!}
      - {{ Form::textarea('text', $text, array('class'=>'form-control', 'rows'=>20)) }}
      - {!! Form::close() !!}
      - @if(count($values)>0)
      - @foreach($values as $key=>$value) - {{ $key }} || {{$value}}
      - @endforeach + + +
      + + + + + + + + + + + + + + + + + + @foreach($bookings as $booking) + + + + + + + + + + + + + @endforeach + + +
      IDNachnameOrganisationServiceGesamtCheckStorno
      {{ $booking->id }}{{ $booking->customer->fullName() }}{{ $booking->price }}{{ $booking->getServiceTotal() }}{{ $booking->price_total }}@if($booking->getPriceTotalRaw() != ($booking->getPriceRaw() + $booking->getServiceTotal(true))) + {{ ($booking->getPriceRaw() + $booking->getServiceTotal(true)) }} + @endif + @if($booking->isCanceled()) {{ $booking->price_canceled }} @endif
      +
      - @endif
      @endsection diff --git a/routes/web.php b/routes/web.php index bb81dc2..666050d 100755 --- a/routes/web.php +++ b/routes/web.php @@ -12,8 +12,12 @@ */ -Auth::routes(); - +Auth::routes([ + 'register' => false, // Registration Routes... + //'reset' => false, // Password Reset Routes... + 'verify' => false, // Email Verification Routes... + ]); + Route::get('/logout', function(){ Auth::logout(); \App\Services\MyGoogle2FA::logout(); @@ -433,6 +437,9 @@ Route::group(['middleware' => ['superadmin', '2fa']], function() { Route::get('/admin/report/bookings', 'Admin\ReportController@bookings')->name('admin_report_bookings'); Route::get('/admin/report/datatable/bookings', 'Admin\ReportController@bookingsDatatable')->name('admin_report_bookings_datatable'); Route::post('/admin/report/export/bookings', 'Admin\ReportController@bookingsExport')->name('admin_report_export_bookings'); + + Route::get('/admin/report/check/bookings', 'Admin\ReportController@checkBookings')->name('admin_report_check_bookings'); + Route::get('/admin/report/check/datatable/bookings', 'Admin\ReportController@checkBookingsDatatable')->name('admin_report_check_bookings_datatable'); }); Route::group(['middleware' => ['auth.permission:sua-re-pp']], function() { diff --git a/storage/app/booking/files/2021/12/61a89b586a72d0.27954715_wichtige-informationen-jordanien.pdf b/storage/app/booking/files/2021/12/61a89b586a72d0.27954715_wichtige-informationen-jordanien.pdf new file mode 100644 index 0000000..4bf86dd Binary files /dev/null and b/storage/app/booking/files/2021/12/61a89b586a72d0.27954715_wichtige-informationen-jordanien.pdf differ diff --git a/storage/app/public/pdf/passolution/Einreisebestimmungen_de_DE-UZ.pdf b/storage/app/public/pdf/passolution/Einreisebestimmungen_de_DE-UZ.pdf new file mode 100644 index 0000000..1443936 Binary files /dev/null and b/storage/app/public/pdf/passolution/Einreisebestimmungen_de_DE-UZ.pdf differ diff --git a/vendor.tar b/vendor.tar new file mode 100644 index 0000000..9b3e75f Binary files /dev/null and b/vendor.tar differ