netgescon-day0/resources/views/filament/print/riscaldamento-ripartizione-riepilogo.blade.php

129 lines
6.1 KiB
PHP
Executable File

<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8">
<title>Riepilogo ripartizione riscaldamento</title>
<style>
body { font-family: DejaVu Sans, Arial, sans-serif; color: #0f172a; margin: 24px; font-size: 12px; }
h1, h2 { margin: 0; }
.header { border: 1px solid #cbd5e1; background: linear-gradient(135deg, #ecfeff, #f8fafc 50%, #ecfdf5); padding: 20px; border-radius: 16px; }
.muted { color: #475569; }
.stats { width: 100%; margin-top: 16px; border-collapse: separate; border-spacing: 10px 0; }
.stats td { width: 25%; border: 1px solid #cbd5e1; border-radius: 12px; padding: 12px; background: #fff; vertical-align: top; }
.label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; }
.value { font-size: 20px; font-weight: 700; margin-top: 8px; }
table.grid { width: 100%; border-collapse: collapse; margin-top: 16px; }
table.grid th, table.grid td { border: 1px solid #cbd5e1; padding: 8px; vertical-align: top; }
table.grid th { background: #e0f2fe; text-align: left; }
.small { font-size: 10px; color: #475569; }
.page-break { page-break-before: always; }
@media print { body { margin: 12px; } }
</style>
@if(!empty($autoprint))
<script>window.addEventListener('load', () => window.print());</script>
@endif
</head>
<body>
<div class="header">
<div class="label">Studio / Ripartizione riscaldamento</div>
<h1 style="margin-top:8px;">Riepilogo fatture da ripartire</h1>
<div class="muted" style="margin-top:8px;">
{{ $stabile->denominazione ?: ('Stabile #' . $stabile->id) }}
@if(!empty($stabile->codice_stabile)) · {{ $stabile->codice_stabile }} @endif
· anno gestione {{ $year }}
</div>
<div class="small" style="margin-top:6px;">Generato il {{ $generatedAt->format('d/m/Y H:i') }}</div>
<table class="stats">
<tr>
<td><div class="label">FE incluse</div><div class="value">{{ $summary['fatture'] }}</div></td>
<td><div class="label">Totale mc</div><div class="value">{{ number_format((float) $summary['totale_mc'], 3, ',', '.') }}</div></td>
<td><div class="label">Totale spesa</div><div class="value"> {{ number_format((float) $summary['totale_spesa'], 2, ',', '.') }}</div></td>
<td><div class="label">Letture UI</div><div class="value">{{ $summary['letture_ui'] }}</div></td>
</tr>
</table>
</div>
<h2 style="margin-top:24px;">Fatture selezionate per ripartizione</h2>
<table class="grid">
<thead>
<tr>
<th>Fattura</th>
<th>Codici estratti</th>
<th>Periodo FE</th>
<th>Pagamento</th>
<th style="text-align:right;">Mc</th>
<th style="text-align:right;">Spesa</th>
</tr>
</thead>
<tbody>
@forelse($fattureRows as $row)
<tr>
<td>
<div><strong>{{ $row['numero_fattura'] ?: ('FE #' . $row['id']) }}</strong></div>
<div class="small">{{ $row['data_fattura'] ?: 'n/d' }}</div>
</td>
<td>
<div>Utenza {{ $row['utenza'] ?: '—' }}</div>
<div>Cliente {{ $row['cliente'] ?: '—' }}</div>
<div>Contratto {{ $row['contratto'] ?: '—' }}</div>
<div>Matricola {{ $row['matricola'] ?: '—' }}</div>
</td>
<td>{{ $row['periodo'] ?: '—' }}</td>
<td>
<div>CBILL {{ $row['cbill'] ?: '—' }}</div>
<div>Avviso {{ $row['codice_avviso'] ?: '—' }}</div>
</td>
<td style="text-align:right;">{{ number_format((float) $row['totale_mc'], 3, ',', '.') }}</td>
<td style="text-align:right;"> {{ number_format((float) $row['totale_spesa'], 2, ',', '.') }}</td>
</tr>
@empty
<tr>
<td colspan="6">Nessuna FE riscaldamento disponibile per il riepilogo.</td>
</tr>
@endforelse
</tbody>
</table>
<div class="page-break"></div>
<h2>Letture contatori UI</h2>
<div class="small" style="margin-top:6px;">Seconda pagina: storico operativo corrente usato come base letture dalla tab UI.</div>
<table class="grid">
<thead>
<tr>
<th>Data ricezione</th>
<th>Servizio</th>
<th>Unità</th>
<th>Canale</th>
<th>Riferimento</th>
<th>Periodo</th>
<th style="text-align:right;">Lettura</th>
<th style="text-align:right;">Consumo</th>
</tr>
</thead>
<tbody>
@forelse($lettureRows as $row)
<tr>
<td>{{ $row['data_ricezione'] ?: '—' }}</td>
<td>
<div>{{ $row['servizio'] ?: '—' }}</div>
<div class="small">Matr. {{ $row['matricola'] ?: '—' }}</div>
</td>
<td>{{ $row['unita'] ?: '—' }}</td>
<td>{{ $row['canale'] ?: '—' }}</td>
<td>{{ $row['riferimento'] ?: '—' }}</td>
<td>{{ $row['periodo'] ?: '—' }}</td>
<td style="text-align:right;">{{ $row['lettura_fine'] !== null ? number_format((float) $row['lettura_fine'], 3, ',', '.') . ' mc' : '—' }}</td>
<td style="text-align:right;">{{ $row['consumo_valore'] !== null ? number_format((float) $row['consumo_valore'], 3, ',', '.') . ' ' . ($row['consumo_unita'] ?: 'mc') : '—' }}</td>
</tr>
@empty
<tr>
<td colspan="8">Nessuna lettura UI disponibile per l'anno selezionato.</td>
</tr>
@endforelse
</tbody>
</table>
</body>
</html>