netgescon-day0/resources/views/piano_conti/report_gestione.blade.php

323 lines
16 KiB
PHP
Executable File

@extends('admin.layouts.netgescon')
@section('title', 'Report Gestione: ' . $gestione->descrizione)
@section('content')
<div class="netgescon-content">
<!-- Header con breadcrumb -->
<div class="netgescon-page-header">
<div class="flex items-center justify-between">
<div>
<nav class="netgescon-breadcrumb">
<a href="{{ route('piano_conti.index') }}" class="netgescon-breadcrumb-item">Piano dei Conti</a>
<span class="netgescon-breadcrumb-separator">/</span>
<span class="netgescon-breadcrumb-current">Report Gestione</span>
</nav>
<h1 class="netgescon-page-title">
<i class="fas fa-chart-bar text-purple-500 mr-3"></i>
Report Gestione: {{ $gestione->descrizione }}
<span class="text-base netgescon-text-muted font-normal ml-2">({{ $gestione->codice }})</span>
</h1>
</div>
<div class="flex items-center space-x-2">
<a href="{{ route('piano_conti.index') }}" class="netgescon-btn netgescon-btn-secondary">
<i class="fas fa-arrow-left mr-1"></i>
Indietro
</a>
<button onclick="window.print()" class="netgescon-btn netgescon-btn-primary">
<i class="fas fa-print mr-1"></i>
Stampa
</button>
</div>
</div>
</div>
<!-- Informazioni Gestione -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div class="lg:col-span-2 netgescon-card">
<div class="netgescon-card-header">
<h3 class="netgescon-card-title">
<i class="fas fa-info-circle text-blue-500 mr-2"></i>
Informazioni Gestione
</h3>
</div>
<div class="netgescon-card-body">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="space-y-4">
<div>
<span class="font-semibold netgescon-text">Codice:</span>
<p class="netgescon-text-muted font-mono">{{ $gestione->codice }}</p>
</div>
<div>
<span class="font-semibold netgescon-text">Tipo:</span>
<span class="ml-2 netgescon-badge {{ $gestione->tipo === 'ORDINARIA' ? 'netgescon-badge-blue' : ($gestione->tipo === 'RISCALDAMENTO' ? 'netgescon-badge-yellow' : 'netgescon-badge-purple') }}">
{{ $gestione->tipo }}
</span>
</div>
<div>
<span class="font-semibold netgescon-text">Stato:</span>
<span class="ml-2 netgescon-badge {{ $gestione->stato === 'ATTIVA' ? 'netgescon-badge-green' : 'netgescon-badge-gray' }}">
{{ $gestione->stato }}
</span>
</div>
</div>
<div class="space-y-4">
<div>
<span class="font-semibold netgescon-text">Periodo:</span>
<p class="netgescon-text-muted">
{{ $gestione->data_inizio->format('d/m/Y') }} - {{ $gestione->data_fine->format('d/m/Y') }}
</p>
</div>
<div>
<span class="font-semibold netgescon-text">Stabile:</span>
<p class="netgescon-text-muted">{{ $gestione->stabile->denominazione ?? 'N/A' }}</p>
</div>
<div>
<span class="font-semibold netgescon-text">Anni Gestione:</span>
<p class="netgescon-text-muted font-mono">{{ $gestione->anno_inizio }}-{{ $gestione->anno_fine }}</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Statistiche -->
<div class="netgescon-card">
<div class="netgescon-card-header">
<h3 class="netgescon-card-title">
<i class="fas fa-chart-pie text-green-500 mr-2"></i>
Statistiche
</h3>
</div>
<div class="netgescon-card-body space-y-4">
<div>
<span class="text-sm netgescon-text-muted">Tabelle Millesimali</span>
<div class="text-2xl font-bold netgescon-text">{{ $tabelle->count() }}</div>
</div>
<div>
<span class="text-sm netgescon-text-muted">Unità Immobiliari</span>
<div class="text-2xl font-bold netgescon-text">{{ count($matrice_millesimi) }}</div>
</div>
</div>
</div>
</div>
<!-- Tabelle Millesimali Disponibili -->
<div class="netgescon-card">
<div class="netgescon-card-header">
<h3 class="netgescon-card-title">
<i class="fas fa-table text-indigo-500 mr-2"></i>
Tabelle Millesimali dello Stabile
</h3>
</div>
<div class="netgescon-card-body">
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
@foreach($tabelle->groupBy('tipo_tabella') as $tipo => $gruppo_tabelle)
<div class="space-y-3">
<div class="netgescon-card border-l-4 {{ $tipo === 'proprieta' ? 'border-blue-500' : ($tipo === 'riscaldamento' ? 'border-yellow-500' : 'border-purple-500') }}">
<div class="netgescon-card-body">
<h4 class="font-semibold text-lg netgescon-text uppercase mb-4">{{ ucfirst($tipo) }}</h4>
<div class="space-y-3">
@foreach($gruppo_tabelle as $tabella)
<div class="p-3 bg-gray-50 rounded-lg">
<div class="mb-2">
<a href="{{ route('piano_conti.show_tabella', $tabella->id) }}" class="font-semibold text-blue-600 hover:text-blue-800 netgescon-link">
{{ $tabella->codice_tabella ?: $tabella->nome_tabella }}
</a>
</div>
<div class="text-sm netgescon-text-muted mb-2">
{{ Str::limit($tabella->denominazione ?: $tabella->nome_tabella, 30) }}
</div>
<div class="text-xs text-blue-600 font-mono">
{{ $tabella->dettagliMillesimi->count() }} unità, {{ number_format($tabella->dettagliMillesimi->sum('millesimi'), 2) }}
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
<!-- Matrice Millesimi -->
<div class="netgescon-card">
<div class="netgescon-card-header">
<h3 class="netgescon-card-title">
<i class="fas fa-th text-orange-500 mr-2"></i>
Matrice Millesimi per Unità Immobiliare
</h3>
</div>
<div class="netgescon-card-body">
<div class="netgescon-table-responsive">
<table class="netgescon-table netgescon-table-compact text-sm">
<thead>
<tr>
<th rowspan="2" class="align-middle">Scala</th>
<th rowspan="2" class="align-middle">Interno</th>
<th rowspan="2" class="align-middle">Palazzina</th>
<th rowspan="2" class="align-middle">Denominazione</th>
@php
$tabelle_grouped = $tabelle->groupBy('tipo_tabella');
@endphp
@foreach($tabelle_grouped as $tipo_gruppo => $tabelle_tipo)
<th colspan="{{ $tabelle_tipo->count() }}" class="text-center {{ $tipo_gruppo === 'proprieta' ? 'bg-blue-500' : ($tipo_gruppo === 'riscaldamento' ? 'bg-yellow-500' : 'bg-purple-500') }} text-white">
{{ ucfirst($tipo_gruppo) }}
</th>
@endforeach
</tr>
<tr>
@foreach($tabelle_grouped as $tabelle_tipo)
@foreach($tabelle_tipo as $tabella)
<th class="text-center min-w-20 text-xs">{{ $tabella->codice_tabella ?: Str::limit($tabella->nome_tabella, 8) }}</th>
@endforeach
@endforeach
</tr>
</thead>
<tbody>
@php $current_scala = null; @endphp
@foreach($matrice_millesimi as $unita)
<tr class="netgescon-table-row">
<td class="font-semibold text-blue-600">{{ $unita['scala'] ?? 'N/A' }}</td>
<td class="font-semibold text-blue-600">{{ $unita['interno'] ?? 'N/A' }}</td>
<td class="netgescon-text">{{ $unita['palazzina'] ?? 'N/A' }}</td>
<td class="netgescon-text">{{ $unita['denominazione'] ?? 'N/A' }}</td>
@foreach($tabelle_grouped as $tabelle_tipo)
@foreach($tabelle_tipo as $tabella)
@php
$codice = $tabella->codice_tabella ?: $tabella->nome_tabella;
$valore = $unita['millesimi'][$codice] ?? 0;
@endphp
<td class="text-right font-mono {{ $valore > 0 ? 'font-semibold netgescon-text' : 'netgescon-text-muted' }}">
{{ $valore > 0 ? number_format($valore, 2) : '-' }}
</td>
@endforeach
@endforeach
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="netgescon-table-footer">
<td colspan="4" class="font-semibold">TOTALI</td>
@foreach($tabelle_grouped as $tabelle_tipo)
@foreach($tabelle_tipo as $tabella)
@php
$codice = $tabella->codice_tabella ?: $tabella->nome_tabella;
$totale = collect($matrice_millesimi)->sum(function($row) use ($codice) {
return $row['millesimi'][$codice] ?? 0;
});
@endphp
<td class="text-right font-mono font-bold text-green-600">{{ number_format($totale, 2) }}</td>
@endforeach
@endforeach
</tr>
</tfoot>
</table>
</div>
<!-- Note metodologiche -->
<div class="mt-6 p-4 netgescon-card-light rounded-lg">
<h4 class="text-lg font-semibold netgescon-text mb-3">
<i class="fas fa-info-circle text-blue-500 mr-2"></i>
Note Metodologiche
</h4>
<ul class="space-y-2 text-sm netgescon-text-muted">
<li class="flex items-start">
<i class="fas fa-dot-circle text-blue-500 mr-2 mt-1 text-xs"></i>
<span><strong>Tabelle di Proprietà:</strong> Utilizzate per ripartire spese ordinarie in base ai millesimi di proprietà</span>
</li>
<li class="flex items-start">
<i class="fas fa-dot-circle text-yellow-500 mr-2 mt-1 text-xs"></i>
<span><strong>Tabelle Riscaldamento:</strong> Per ripartizione spese di riscaldamento centralizzato</span>
</li>
<li class="flex items-start">
<i class="fas fa-dot-circle text-purple-500 mr-2 mt-1 text-xs"></i>
<span><strong>Tabelle Speciali:</strong> Per specifiche categorie di spese (ascensore, scale, etc.)</span>
</li>
<li class="flex items-start">
<i class="fas fa-dot-circle text-green-500 mr-2 mt-1 text-xs"></i>
<span><strong>Calcolo Millesimi:</strong> I valori mostrati sono in millesimi () con base 1000</span>
</li>
</ul>
</div>
</div>
</div>
</div>
@endsection
</tbody>
<tfoot class="thead-light">
<tr>
<th colspan="4">TOTALI</th>
@foreach($tabelle_grouped as $tabelle_tipo)
@foreach($tabelle_tipo as $tabella)
@php
$codice = $tabella->codice_tabella ?: $tabella->nome_tabella;
$totale = collect($matrice_millesimi)->sum(function($row) use ($codice) {
return $row['millesimi'][$codice] ?? 0;
});
@endphp
<th class="text-right">{{ number_format($totale, 2) }}</th>
@endforeach
@endforeach
</tr>
</tfoot>
</table>
</div>
<!-- Note metodologiche -->
<div class="mt-3 p-3 bg-light rounded">
<h6><i class="fas fa-info-circle"></i> Note Metodologiche</h6>
<ul class="mb-0 small">
<li><strong>Tabelle di Proprietà:</strong> Utilizzate per ripartire spese ordinarie in base ai millesimi di proprietà</li>
<li><strong>Tabelle Riscaldamento:</strong> Per ripartizione spese di riscaldamento centralizzato</li>
<li><strong>Tabelle Speciali:</strong> Per specifiche categorie di spese (ascensore, scale, etc.)</li>
<li><strong>Calcolo Millesimi:</strong> I valori mostrati sono in millesimi () con base 1000</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<style>
@media print {
.netgescon-btn, .print-hide {
display: none !important;
}
.netgescon-card {
box-shadow: none !important;
border: 1px solid #dee2e6 !important;
page-break-inside: avoid;
}
.netgescon-table {
font-size: 10px !important;
}
}
.netgescon-table-compact th,
.netgescon-table-compact td {
padding: 0.375rem;
vertical-align: middle;
white-space: nowrap;
}
.netgescon-card-light {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
}
.min-w-20 {
min-width: 5rem;
}
</style>
@endpush