mivita/resources/views/admin/revenue/index.blade.php
2025-08-12 18:01:59 +02:00

153 lines
No EOL
8.4 KiB
PHP

@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>
</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