mivita/resources/views/admin/revenue/index.blade.php
2026-04-14 18:07:45 +02:00

295 lines
No EOL
17 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@extends('layouts.layout-2')
@section('content')
@if ($errors->any())
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<div class="card">
<h5 class="card-header">
Umsatz- und Gutschriftenbericht
</h5>
<div class="card-body">
{!! Form::open(['action' => route('admin_revenue_export'), 'class' => '']) !!}
<div class="form-row align-items-center px-0 pb-2 pt-0">
<div class="col-6 col-sm-3 col-md-3 col-lg-3 mb-1">
<select class="custom-select on_change_select_filter" name="revenue_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('revenue_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-3 col-md-3 col-lg-3 mb-1">
{{--
<select class="custom-select on_change_select_filter" name="revenue_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('revenue_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
--}}
</div>
<div class="col-6 col-sm-3 col-md-3 col-lg-3 mb-1">
{{-- <select class="custom-select on_change_select_filter" name="revenue_filter_type">
<option value="year" @if(session('revenue_filter_type') == 'year') selected @endif>Ganzes Jahr</option>
<option value="month" @if(session('revenue_filter_type') == 'month') selected @endif>Einzelner Monat</option>
</select>
--}}
</div>
<div class="col-6 col-sm-3 col-md-3 col-lg-3 mb-1">
<button type="submit" class="btn btn-primary btn-block">
<i class="ion ion-md-download"></i> Export Excel
</button>
</div>
</div>
{!! Form::close() !!}
<hr>
<!-- Umsätze Section -->
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h6 class="mb-0">Umsätze {{ session('revenue_filter_year') }}</h6>
</div>
<div class="card-body">
@if(isset($revenue_summary['yearly']) && $revenue_summary['yearly']->count() > 0)
@foreach($revenue_summary['yearly'] as $item)
<div class="row mb-2">
<div class="col-4"><strong>{{ $item->period_label }}</strong></div>
<div class="col-8">
<small class="text-muted">Netto:</small> {{ number_format($item->total_net, 2, ',', '.') }} <br>
<small class="text-muted">Steuer:</small> {{ number_format($item->total_tax, 2, ',', '.') }} <br>
<strong>Brutto: {{ number_format($item->total_gross, 2, ',', '.') }} </strong>
</div>
</div>
@endforeach
@else
<p class="text-muted">Keine Umsätze für {{ session('revenue_filter_year') }} gefunden</p>
@endif
<hr>
<h6>Monatliche Aufschlüsselung</h6>
@if(isset($revenue_summary['monthly']) && $revenue_summary['monthly']->count() > 0)
@foreach($revenue_summary['monthly'] as $item)
<div class="row mb-1">
<div class="col-4">{{ $item->period_label }}</div>
<div class="col-8">
<small>{{ number_format($item->total_net, 2, ',', '.') }} / {{ number_format($item->total_tax, 2, ',', '.') }} / <strong>{{ number_format($item->total_gross, 2, ',', '.') }} </strong></small>
</div>
</div>
@endforeach
@else
<p class="text-muted">Keine monatlichen Umsätze gefunden</p>
@endif
</div>
</div>
</div>
<!-- Gutschriften Section -->
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h6 class="mb-0">Gutschriften {{ session('revenue_filter_year') }}</h6>
</div>
<div class="card-body">
@if(isset($credit_summary['yearly']) && $credit_summary['yearly']->count() > 0)
@foreach($credit_summary['yearly'] as $item)
<div class="row mb-2">
<div class="col-4"><strong>{{ $item->period_label }}</strong></div>
<div class="col-8">
<small class="text-muted">Netto:</small> {{ number_format($item->total_net, 2, ',', '.') }} <br>
<small class="text-muted">Steuer:</small> {{ number_format($item->total_tax, 2, ',', '.') }} <br>
<strong>Brutto: {{ number_format($item->total_gross, 2, ',', '.') }} </strong>
</div>
</div>
@endforeach
@else
<p class="text-muted">Keine Gutschriften für {{ session('revenue_filter_year') }} gefunden</p>
@endif
<hr>
<h6>Monatliche Aufschlüsselung</h6>
@if(isset($credit_summary['monthly']) && $credit_summary['monthly']->count() > 0)
@foreach($credit_summary['monthly'] as $item)
<div class="row mb-1">
<div class="col-4">{{ $item->period_label }}</div>
<div class="col-8">
<small>{{ number_format($item->total_net, 2, ',', '.') }} / {{ number_format($item->total_tax, 2, ',', '.') }} / <strong>{{ number_format($item->total_gross, 2, ',', '.') }} </strong></small>
</div>
</div>
@endforeach
@else
<p class="text-muted">Keine monatlichen Gutschriften gefunden</p>
@endif
</div>
</div>
</div>
</div>
</div>
<hr>
<!-- Umsätze nach Ländern - Jährlich -->
<div class="row mb-3">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h6 class="mb-0">Umsätze nach Ländern {{ session('revenue_filter_year') }}</h6>
</div>
<div class="card-body p-0">
@if(isset($revenue_summary['country_yearly']) && $revenue_summary['country_yearly']->count() > 0)
<table class="table table-sm table-hover mb-0">
<thead class="thead-light">
<tr>
<th>Land</th>
<th class="text-right">Netto</th>
<th class="text-right">Steuer</th>
<th class="text-right">Brutto</th>
</tr>
</thead>
<tbody>
@foreach($revenue_summary['country_yearly'] as $item)
<tr>
<td>{{ $item->country_name }}</td>
<td class="text-right">{{ number_format($item->total_net, 2, ',', '.') }} </td>
<td class="text-right">{{ number_format($item->total_tax, 2, ',', '.') }} </td>
<td class="text-right"><strong>{{ number_format($item->total_gross, 2, ',', '.') }} </strong></td>
</tr>
@endforeach
</tbody>
</table>
@else
<div class="p-3"><p class="text-muted mb-0">Keine Umsätze nach Ländern für {{ session('revenue_filter_year') }} gefunden</p></div>
@endif
</div>
</div>
</div>
<!-- Gutschriften nach Ländern - Jährlich -->
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h6 class="mb-0">Gutschriften nach Ländern {{ session('revenue_filter_year') }}</h6>
</div>
<div class="card-body p-0">
@if(isset($credit_summary['country_yearly']) && $credit_summary['country_yearly']->count() > 0)
<table class="table table-sm table-hover mb-0">
<thead class="thead-light">
<tr>
<th>Land</th>
<th class="text-right">Netto</th>
<th class="text-right">Steuer</th>
<th class="text-right">Brutto</th>
</tr>
</thead>
<tbody>
@foreach($credit_summary['country_yearly'] as $item)
<tr>
<td>{{ $item->country_name }}</td>
<td class="text-right">{{ number_format($item->total_net, 2, ',', '.') }} </td>
<td class="text-right">{{ number_format($item->total_tax, 2, ',', '.') }} </td>
<td class="text-right"><strong>{{ number_format($item->total_gross, 2, ',', '.') }} </strong></td>
</tr>
@endforeach
</tbody>
</table>
@else
<div class="p-3"><p class="text-muted mb-0">Keine Gutschriften nach Ländern für {{ session('revenue_filter_year') }} gefunden</p></div>
@endif
</div>
</div>
</div>
</div>
<!-- Umsätze nach Ländern - Monatlich -->
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h6 class="mb-0">Umsätze nach Ländern monatliche Aufschlüsselung</h6>
</div>
<div class="card-body p-0">
@if(isset($revenue_summary['country_monthly']) && $revenue_summary['country_monthly']->count() > 0)
@php $revenueByMonth = $revenue_summary['country_monthly']->groupBy('month'); @endphp
@foreach($revenueByMonth as $month => $countries)
<div class="px-3 pt-2 pb-1">
<strong class="text-primary">{{ $countries->first()->month_label }}</strong>
</div>
<table class="table table-sm mb-1">
<tbody>
@foreach($countries as $item)
<tr>
<td class="pl-4">{{ $item->country_name }}</td>
<td class="text-right text-muted"><small>{{ number_format($item->total_net, 2, ',', '.') }} </small></td>
<td class="text-right text-muted"><small>{{ number_format($item->total_tax, 2, ',', '.') }} </small></td>
<td class="text-right"><small><strong>{{ number_format($item->total_gross, 2, ',', '.') }} </strong></small></td>
</tr>
@endforeach
</tbody>
</table>
@endforeach
@else
<div class="p-3"><p class="text-muted mb-0">Keine monatlichen Umsätze nach Ländern gefunden</p></div>
@endif
</div>
</div>
</div>
<!-- Gutschriften nach Ländern - Monatlich -->
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h6 class="mb-0">Gutschriften nach Ländern monatliche Aufschlüsselung</h6>
</div>
<div class="card-body p-0">
@if(isset($credit_summary['country_monthly']) && $credit_summary['country_monthly']->count() > 0)
@php $creditByMonth = $credit_summary['country_monthly']->groupBy('month'); @endphp
@foreach($creditByMonth as $month => $countries)
<div class="px-3 pt-2 pb-1">
<strong class="text-primary">{{ $countries->first()->month_label }}</strong>
</div>
<table class="table table-sm mb-1">
<tbody>
@foreach($countries as $item)
<tr>
<td class="pl-4">{{ $item->country_name }}</td>
<td class="text-right text-muted"><small>{{ number_format($item->total_net, 2, ',', '.') }} </small></td>
<td class="text-right text-muted"><small>{{ number_format($item->total_tax, 2, ',', '.') }} </small></td>
<td class="text-right"><small><strong>{{ number_format($item->total_gross, 2, ',', '.') }} </strong></small></td>
</tr>
@endforeach
</tbody>
</table>
@endforeach
@else
<div class="p-3"><p class="text-muted mb-0">Keine monatlichen Gutschriften nach Ländern gefunden</p></div>
@endif
</div>
</div>
</div>
</div>
</div>
<script>
$( document ).ready(function() {
$('select.on_change_select_filter').on('change', function(){
window.location.href = window.location.pathname + '?' +
'revenue_filter_year=' + $('select[name=revenue_filter_year]').val() +
'&revenue_filter_month=' + $('select[name=revenue_filter_month]').val() +
'&revenue_filter_type=' + $('select[name=revenue_filter_type]').val();
});
});
</script>
@endsection