@php $query = request()->query(); $tab = $this->tab ?? 'bilancio'; $tab = in_array($tab, ['bilancio', 'crediti', 'debiti', 'conguagli', 'dettaglio'], true) ? $tab : 'bilancio'; $fmt = fn($v) => number_format((float) ($v ?? 0), 2, ',', '.'); $stabile = optional(\App\Support\StabileContext::getActiveStabile(auth()->user())); @endphp
Stabile attivo
{{ $stabile->denominazione ?? '—' }}
Codice: {{ $stabile->codice_stabile ?? '—' }}
@if (request()->query('dett')) @endif
Esercizio archivio
Data bilancio di partenza
Saldo iniziale (manuale)
Aggiorna
Bilancio Crediti Debiti Conguagli apertura Dettaglio @if ($tab === 'dettaglio') {{ $detailMeta['titolo'] ?? 'Dettaglio' }} @if (($detailMeta['tipo'] ?? null) === 'cre_deb_preced')
@forelse(($detailRows ?? []) as $r) @empty @endforelse
C/D Cod. voce Voce Descrizione Straord. Importo €
{{ $r['c_d'] }} {{ $r['cod_voc'] }} {{ $r['des_voce'] }} {{ $r['descrizione'] }} {{ $r['n_stra'] ?? '—' }} {{ $fmt($r['importo_euro'] ?? 0) }}
Nessun dato disponibile.
@elseif (($detailMeta['tipo'] ?? null) === 'dett_tab')
@forelse(($detailRows ?? []) as $r) @empty @endforelse
Tabella Condomino Inquilino MM Straord. Cons. €
{{ $r['cod_tab'] }}
{{ $r['id_cond'] }}
{{ $r['cond_label'] ?? '' }}
{{ $r['cond_inquil'] ?: '—' }} {{ $r['mm'] !== null ? number_format((float) $r['mm'], 3, ',', '.') : '—' }} {{ $r['n_stra'] ?? '—' }} {{ $fmt($r['cons_euro'] ?? 0) }}
Nessun dato disponibile.
@else
Seleziona un dettaglio dal tab Bilancio.
@endif
@elseif ($tab === 'conguagli') Conguagli di apertura Fonte unica: gescon_import.dett_tab con cod_tab = CONG.O. Qui manteniamo solo i residui iniziali ordinari del passaggio consegne.
Modifica righe (dett_tab)
Suggerimento: clicca una riga per modificarla (una alla volta).
Fonte
id_cond
cons_euro
mm
Aggiungi riga
@forelse(($dettTabRows ?? []) as $r) @php $id = (int) ($r['id'] ?? 0); @endphp @php $isEditing = (int) ($this->editingDettTabId ?? 0) === $id; @endphp @empty @endforelse
Tabella id_cond Condomino Cons. € MM Unico Azioni
@if($isEditing) @else
{{ $r['cod_tab'] }}
@endif
@if($isEditing) @else {{ $r['id_cond'] }} @endif
{{ $r['cond_label'] ?? '' }}
@if($isEditing) @else {{ $fmt($r['cons_euro'] ?? 0) }} @endif @if($isEditing) @else {{ $r['mm'] !== null ? number_format((float) $r['mm'], 3, ',', '.') : '—' }} @endif @if($isEditing) @else {{ !empty($r['unico']) ? '✓' : '—' }} @endif @if($isEditing) Salva Annulla Elimina @else Modifica @endif
Nessuna riga CONG.O disponibile.
@elseif ($tab === 'crediti') Crediti @php $manualVociEnabled = \Illuminate\Support\Facades\Schema::hasTable('contabilita_situazione_iniziale_voci'); @endphp @if ($manualVociEnabled)
Gestione
n_stra (solo se Straordinaria)
Codice (opzionale)
Importo €
Descrizione
Aggiungi credito (manuale)
@endif
Crediti legacy (Cre_Deb_preced)
Suggerimento: clicca una riga per modificarla (una alla volta).
Cod_voc
@if(!empty($vocSpeOptions ?? [])) @else @endif
Des_voce
Descrizione
Importo €
Aggiungi riga credito
@forelse(($creDebRows ?? []) as $r) @php $id = (int) ($r['id'] ?? 0); @endphp @php $isEditing = (int) ($this->editingCreDebId ?? 0) === $id; @endphp @empty @endforelse
Cod_voc Des_voce Descrizione n_stra Importo € Incl. Azioni
@if($isEditing) @else
{{ $r['cod_voc'] }}
@endif
@if($isEditing) @else
{{ ($r['voc_spe_descriz'] ?? '') !== '' ? $r['voc_spe_descriz'] : ($r['des_voce'] ?? '') }}
@endif
@if($isEditing) @else
{{ $r['descrizione'] }}
@endif
@if($isEditing) @else {{ $r['n_stra'] ?? '—' }} @endif @if($isEditing) @else {{ $fmt($r['importo_euro'] ?? 0) }} @endif @if($isEditing) @else {{ !empty($r['incluso']) ? '✓' : '—' }} @endif @if($isEditing) Salva Annulla Elimina @else Modifica @endif
Nessun credito legacy disponibile.
@php $totCreditiInclusi = 0.0; foreach (($creDebRows ?? []) as $rr) { if (!empty($rr['incluso'])) { $totCreditiInclusi += (float) str_replace(',', '.', (string) ($rr['importo_euro'] ?? 0)); } } @endphp
Totale crediti (solo inclusi): {{ $fmt($totCreditiInclusi) }}
@elseif ($tab === 'debiti') Debiti
Debiti legacy (Cre_Deb_preced)
Suggerimento: clicca una riga per modificarla (una alla volta).
Cod_voc
@if(!empty($vocSpeOptions ?? [])) @else @endif
Des_voce
Descrizione
Importo €
Aggiungi riga debito
@forelse(($creDebRows ?? []) as $r) @php $id = (int) ($r['id'] ?? 0); @endphp @php $isEditing = (int) ($this->editingCreDebId ?? 0) === $id; @endphp @empty @endforelse
Cod_voc Des_voce Descrizione n_stra Importo € Incl. Azioni
@if($isEditing) @else
{{ $r['cod_voc'] }}
@endif
@if($isEditing) @else
{{ ($r['voc_spe_descriz'] ?? '') !== '' ? $r['voc_spe_descriz'] : ($r['des_voce'] ?? '') }}
@if(($r['voc_spe_preventivo_euro'] ?? null) !== null || ($r['voc_spe_consuntivo_euro'] ?? null) !== null)
@if(($r['voc_spe_preventivo_euro'] ?? null) !== null) Prev: {{ $fmt($r['voc_spe_preventivo_euro']) }} @endif @if(($r['voc_spe_consuntivo_euro'] ?? null) !== null) · Cons: {{ $fmt($r['voc_spe_consuntivo_euro']) }} @endif
@endif @endif
@if($isEditing) @else
{{ $r['descrizione'] }}
@endif
@if($isEditing) @else {{ $r['n_stra'] ?? '—' }} @endif @if($isEditing) @else {{ $fmt($r['importo_euro'] ?? 0) }} @endif @if($isEditing) @else {{ !empty($r['incluso']) ? '✓' : '—' }} @endif @if($isEditing) Salva Annulla Elimina @else Modifica @endif
Nessun debito legacy disponibile.
@php $totDebitiInclusi = 0.0; foreach (($creDebRows ?? []) as $rr) { if (!empty($rr['incluso'])) { $totDebitiInclusi += (float) str_replace(',', '.', (string) ($rr['importo_euro'] ?? 0)); } } @endphp
Totale debiti (solo inclusi): {{ $fmt($totDebitiInclusi) }}
@php $selected = null; if (!empty($this->selectedCreDebId)) { foreach (($creDebRows ?? []) as $rr) { if ((int)($rr['id'] ?? 0) === (int)$this->selectedCreDebId) { $selected = $rr; break; } } } @endphp @if($selected)
Dettaglio riga selezionata
Voce Fatture FE Registro RA
@if($detailTab === 'voce')
Cod_voc: {{ $selected['cod_voc'] }}
Voce (voc_spe.descriz): {{ ($selected['voc_spe_descriz'] ?? '') !== '' ? $selected['voc_spe_descriz'] : '—' }}
Preventivo €: {{ ($selected['voc_spe_preventivo_euro'] ?? null) !== null ? $fmt($selected['voc_spe_preventivo_euro']) : '—' }} · Consuntivo €: {{ ($selected['voc_spe_consuntivo_euro'] ?? null) !== null ? $fmt($selected['voc_spe_consuntivo_euro']) : '—' }}
@elseif($detailTab === 'fe')
Fatture passive non pagate (ordinate dalle più vecchie). Usa “Collega” per associare la fattura a questo debito.
@forelse(($feRows ?? []) as $f) @php $fid = (int) ($f['id'] ?? 0); @endphp @php $isLinked = in_array($fid, ($linkedFeIds ?? []), true); @endphp @empty @endforelse
Data N. Fornitore Totale Stato Azioni
{{ $f['data_fattura'] ?? '—' }} {{ $f['numero_fattura'] ?? '—' }} {{ $f['fornitore_denominazione'] ?? '—' }} {{ ($f['totale'] ?? null) !== null ? $fmt($f['totale']) : '—' }} {{ $f['stato'] ?? '—' }} @if($isLinked) Scollega @else Collega @endif
Nessuna fattura FE da pagare trovata.
@else
Registro ritenute “da versare”/“compensata” per lo stabile. Collega la ritenuta a questo debito (Erario) quando serve.
@forelse(($raRows ?? []) as $ra) @php $rid = (int) ($ra['id'] ?? 0); @endphp @php $isLinked = in_array($rid, ($linkedRaIds ?? []), true); @endphp @empty @endforelse
Data Prog. Fornitore Ritenuta Stato Azioni
{{ $ra['data_competenza'] ?? '—' }} {{ $ra['numero_progressivo'] ?? '—' }} {{ ($ra['fornitore'] ?? '') !== '' ? $ra['fornitore'] : '—' }} {{ ($ra['importo_ritenuta'] ?? null) !== null ? $fmt($ra['importo_ritenuta']) : '—' }} {{ $ra['stato_versamento'] ?? '—' }} @if($isLinked) Scollega @else Collega @endif
Nessuna ritenuta RA “da versare” trovata.
@endif
@endif
@else @php $baseParams = array_merge($query, ['tab' => 'dettaglio']); $link = fn(string $dett) => \App\Filament\Pages\Contabilita\SituazioneIniziale::getUrl(panel: 'admin-filament', parameters: array_merge($baseParams, ['dett' => $dett])); $saldoBancaTot = $bilancio['banca']['saldo_letto'] ?? null; $saldoBancaTot = is_numeric($saldoBancaTot) ? (float) $saldoBancaTot : null; $saldoBancaAtt = $saldoBancaTot !== null && $saldoBancaTot >= 0 ? $saldoBancaTot : null; $saldoBancaPas = $saldoBancaTot !== null && $saldoBancaTot < 0 ? abs($saldoBancaTot) : null; $delta = $bilancio['banca']['delta_letto'] ?? null; // banca - finanziario $delta = is_numeric($delta) ? (float) $delta : null; $mancanza = $delta !== null ? abs($delta) : null; @endphp
SALDO BANCA INIZIALE ALLA DATA
ATTIVITÀ
{{ $saldoBancaAtt !== null ? $fmt($saldoBancaAtt) : '—' }}
PASSIVITÀ
{{ $saldoBancaPas !== null ? $fmt($saldoBancaPas) : '—' }}
Risorse finanziarie (tutti i conti) alla data
@forelse(($risorseFinanziarie ?? []) as $r) @empty @endforelse
Conto Saldo
{{ $r['label'] }} {{ $fmt($r['saldo'] ?? 0) }}
Nessun conto bancario disponibile.
FINANZIARIO (Attività - Passività): {{ $fmt($bilancio['finanziario'] ?? 0) }}
Delta banca - finanziario: {{ $delta !== null ? $fmt($delta) : '—' }}
@if ($delta !== null) @if (abs($delta) <= 0.01)
Quadratura OK (0)
@elseif ($delta < 0)
Mancano PASSIVITÀ (oppure ci sono ATTIVITÀ in eccesso) per: {{ $mancanza !== null ? $fmt($mancanza) : '—' }}
@else
Mancano ATTIVITÀ (oppure ci sono PASSIVITÀ in eccesso) per: {{ $mancanza !== null ? $fmt($mancanza) : '—' }}
@endif @endif
ORDINARIA RISCALDAMENTO TUTTE LE SPESE STRAORDINARIE
@forelse(($bilancio['straordinarie'] ?? []) as $straKey => $row)
{{ $row['label'] ?? $row['titolo'] ?? ('Straordinaria #' . ($row['n_stra'] ?? $straKey)) }}
ATTIVITÀ
PASSIVITÀ
@empty
Nessuna straordinaria trovata.
@endforelse
TOTALI GENERALI (STABILE)
Tot. ATTIVITÀ
{{ $fmt($bilancio['tot_attivita'] ?? 0) }}
Tot. PASSIVITÀ
{{ $fmt($bilancio['tot_passivita'] ?? 0) }}
FINANZIARIO (Attività - Passività): {{ $fmt($bilancio['finanziario'] ?? 0) }}
@endif