1507 lines
112 KiB
PHP
1507 lines
112 KiB
PHP
@php
|
|
/** @var string $sectionKey */
|
|
$sectionKey = $this->sectionKey ?? 'section';
|
|
|
|
$titles = [
|
|
'anagrafica' => ['title' => 'Anagrafica', 'desc' => 'Rubrica/Anagrafiche condominiali, soggetti, recapiti, ruoli.'],
|
|
'ordinarie' => ['title' => 'Gestione ordinaria', 'desc' => 'Rate, riparti, voci spesa, registrazioni contabili.'],
|
|
'riscaldamento' => ['title' => 'Riscaldamento', 'desc' => 'Riparti riscaldamento, letture/consumi, quote.'],
|
|
'straordinarie' => ['title' => 'Straordinarie', 'desc' => 'Lavori straordinari, SAL, consuntivi, delibere.'],
|
|
'varie' => ['title' => 'Varie', 'desc' => 'Estratti conto, incassi, utilità operative.'],
|
|
'utilita' => ['title' => 'Utilità', 'desc' => 'Strumenti, importazioni, verifiche, manutenzioni dati.'],
|
|
];
|
|
|
|
$meta = $titles[$sectionKey] ?? ['title' => ucfirst($sectionKey), 'desc' => ''];
|
|
if ($sectionKey === 'ordinarie' && !empty($this->legacyGestioneAnno)) {
|
|
$meta['desc'] = trim(($meta['desc'] ?? '') . ' (Anno ' . $this->legacyGestioneAnno . ')');
|
|
}
|
|
$activeTab = $this->viewTab ?? 'operazioni';
|
|
$workflowMode = (bool) ($this->netgesconWorkflowMode ?? false);
|
|
$sections = [
|
|
'ordinarie' => 'Ordinarie',
|
|
'straordinarie' => 'Straordinarie',
|
|
'acqua' => 'Acqua',
|
|
];
|
|
@endphp
|
|
|
|
<x-filament-panels::page>
|
|
<div class="mx-auto max-w-7xl space-y-4">
|
|
<x-filament::section>
|
|
<x-slot name="heading">{{ $meta['title'] }}</x-slot>
|
|
@if(!empty($meta['desc']))
|
|
<x-slot name="description">{{ $meta['desc'] }}</x-slot>
|
|
@endif
|
|
|
|
<div class="flex flex-wrap gap-2">
|
|
<x-filament::button color="primary" disabled>Nuovo</x-filament::button>
|
|
<x-filament::button color="gray" disabled>Salva</x-filament::button>
|
|
<x-filament::button color="gray" disabled>Stampa</x-filament::button>
|
|
<x-filament::button color="gray" disabled>Esporta</x-filament::button>
|
|
</div>
|
|
|
|
@if($sectionKey === 'anagrafica')
|
|
<div class="mt-4 flex flex-wrap gap-2">
|
|
<x-filament::button
|
|
color="primary"
|
|
tag="a"
|
|
href="{{ \App\Filament\Pages\Gescon\StabiliArchivio::getUrl() }}"
|
|
>Stabili (archivio)</x-filament::button>
|
|
|
|
<x-filament::button
|
|
color="gray"
|
|
tag="a"
|
|
href="{{ \App\Filament\Pages\Gescon\GestioniArchivio::getUrl() }}"
|
|
>Gestioni (archivio)</x-filament::button>
|
|
|
|
<x-filament::button
|
|
color="gray"
|
|
tag="a"
|
|
href="{{ \App\Filament\Pages\Gescon\AnagraficaUnica::getUrl() }}"
|
|
>Anagrafica unica</x-filament::button>
|
|
</div>
|
|
@endif
|
|
|
|
@if(in_array($sectionKey, ['ordinarie', 'straordinarie'], true))
|
|
@php
|
|
$isStraordPage = $sectionKey === 'straordinarie';
|
|
$straordinarieGestioni = $this->straordinarieGestioni ?? [];
|
|
@endphp
|
|
|
|
<div class="mt-4 flex flex-wrap gap-2">
|
|
<x-filament::button
|
|
color="primary"
|
|
tag="a"
|
|
href="{{ \App\Filament\Pages\Gescon\RegistrazioneUnificata::getUrl(panel: 'admin-filament') }}"
|
|
>Registrazione unificata</x-filament::button>
|
|
</div>
|
|
|
|
@if($isStraordPage)
|
|
<div class="mt-4 grid grid-cols-1 md:grid-cols-3 gap-3 text-xs">
|
|
<label class="flex flex-col gap-1">
|
|
<span class="text-gray-600">Gestione straordinaria</span>
|
|
<select wire:model.live="selectedStraordinaria" class="rounded border-gray-300 text-xs">
|
|
@forelse($straordinarieGestioni as $gestioneStra)
|
|
<option value="{{ $gestioneStra['n_stra'] }}">
|
|
{{ $gestioneStra['label'] }}
|
|
</option>
|
|
@empty
|
|
<option value="">Nessuna gestione straordinaria trovata</option>
|
|
@endforelse
|
|
</select>
|
|
</label>
|
|
<div class="md:col-span-2 flex items-end text-gray-600">
|
|
@php
|
|
$currentStra = collect($straordinarieGestioni)->firstWhere('n_stra', $this->selectedStraordinaria);
|
|
@endphp
|
|
@if($currentStra)
|
|
<span>{{ $currentStra['periodo'] ?? 'Periodo non disponibile' }} · {{ $currentStra['totale'] ?? 0 }} operazioni</span>
|
|
@else
|
|
<span>Seleziona una gestione per visualizzare le operazioni.</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="mt-4 flex flex-wrap items-center gap-2">
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'operazioni' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','operazioni')"
|
|
>Operazioni</x-filament::button>
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'consuntivo' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','consuntivo')"
|
|
>Consuntivo</x-filament::button>
|
|
@if(! $isStraordPage)
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'preventivo' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','preventivo')"
|
|
>Preventivo</x-filament::button>
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'riparto' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','riparto')"
|
|
>Riparto</x-filament::button>
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'persone' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','persone')"
|
|
>Persone</x-filament::button>
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'straordinarie' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','straordinarie')"
|
|
>Straordinarie</x-filament::button>
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'acqua' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','acqua')"
|
|
>Acqua</x-filament::button>
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'incassi' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','incassi')"
|
|
>Incassi</x-filament::button>
|
|
<x-filament::button
|
|
size="sm"
|
|
:color="$activeTab === 'fatture' ? 'primary' : 'gray'"
|
|
wire:click="$set('viewTab','fatture')"
|
|
>Fatture</x-filament::button>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="mt-4 flex flex-wrap items-center gap-2 text-xs">
|
|
<input wire:model.debounce.500ms="search" placeholder="Cerca (forn/voce/FE/RDA)" class="rounded border-gray-300 text-xs" />
|
|
<input wire:model="filterCodForn" placeholder="Cod. forn" class="rounded border-gray-300 text-xs" />
|
|
<input wire:model="filterCodSpe" placeholder="Cod. spesa" class="rounded border-gray-300 text-xs" />
|
|
<input wire:model="filterTabella" placeholder="Tabella" class="rounded border-gray-300 text-xs" />
|
|
<input wire:model="filterBenef" placeholder="Descrizione" class="rounded border-gray-300 text-xs" />
|
|
<input wire:model="filterAnno" type="number" placeholder="Anno" class="rounded border-gray-300 text-xs" />
|
|
<label class="flex items-center gap-2 text-xs text-gray-600">
|
|
<input type="checkbox" wire:model="filterRdaOnly" /> Solo RDA
|
|
</label>
|
|
</div>
|
|
|
|
@if(!($this->legacyOperazioniScopedByStabile ?? false))
|
|
<div class="mt-3 rounded border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900">
|
|
Archivio legacy operazioni non segmentato per stabile: questa sezione puo' mostrare sempre lo stesso storico.
|
|
I blocchi locali (es. fatture ricevute) restano invece filtrati sullo stabile attivo.
|
|
</div>
|
|
@endif
|
|
|
|
@php
|
|
$operazioni = $this->operazioni ?? null;
|
|
$incassi = $this->incassi ?? null;
|
|
$incassiRifSummary = $this->incassiRifSummary ?? ['rows' => [], 'totale' => 0, 'totale_ccb' => 0, 'count' => 0];
|
|
$fattureLegacy = $this->fattureLegacy ?? null;
|
|
$fattureRicevute = $this->fattureRicevuteConsolidate ?? null;
|
|
$raMonthlyTributoSummary = $this->raMonthlyTributoSummary ?? ['rows' => [], 'totale_fatta' => 0, 'totale_versata' => 0, 'totale_delta' => 0];
|
|
@endphp
|
|
|
|
@if($activeTab === 'operazioni')
|
|
<div class="mt-6 overflow-hidden rounded-lg border">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-600">
|
|
Operazioni GESCON (singolo_anno.mdb)
|
|
@if(!empty($this->legacyGestioneLabel))
|
|
· {{ $this->legacyGestioneLabel }}
|
|
@endif
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('id_operaz')" class="font-semibold">ID</button>
|
|
@if(($this->sortField ?? '') === 'id_operaz')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('dt_spe')" class="font-semibold">Data</button>
|
|
@if(($this->sortField ?? '') === 'dt_spe')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('cod_spe')" class="font-semibold">Cod. Spesa</button>
|
|
@if(($this->sortField ?? '') === 'cod_spe')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">Voce spesa</th>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('tabella')" class="font-semibold">Tabella</button>
|
|
@if(($this->sortField ?? '') === 'tabella')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('cod_for')" class="font-semibold">Fornitore</button>
|
|
@if(($this->sortField ?? '') === 'cod_for')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('benef')" class="font-semibold">Descrizione</button>
|
|
@if(($this->sortField ?? '') === 'benef')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('rif_rda')" class="font-semibold">RDA</button>
|
|
@if(($this->sortField ?? '') === 'rif_rda')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-right">
|
|
<button wire:click="sortBy('importo_euro')" class="font-semibold">Importo €</button>
|
|
@if(($this->sortField ?? '') === 'importo_euro')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('num_fat')" class="font-semibold">Fattura</button>
|
|
@if(($this->sortField ?? '') === 'num_fat')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">
|
|
<button wire:click="sortBy('fe_uid')" class="font-semibold">FE</button>
|
|
@if(($this->sortField ?? '') === 'fe_uid')<span class="text-[10px]">{{ $this->sortDirection === 'asc' ? ' ▲' : ' ▼' }}</span>@endif
|
|
</th>
|
|
<th class="px-3 py-2 text-left">Dett.</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($operazioni ?? [] as $row)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">{{ $row->id_operaz ?? '—' }}</td>
|
|
<td class="px-3 py-2">
|
|
@if(!empty($row->dt_spe))
|
|
{{ \Carbon\Carbon::parse($row->dt_spe)->format('d/m/Y') }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">{{ $row->cod_spe ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $row->voce_descrizione ?? '—' }}</td>
|
|
<td class="px-3 py-2">
|
|
<div class="text-xs">{{ $row->tabella ?? '—' }}</div>
|
|
<div class="text-[10px] text-gray-500">{{ $row->tabella_descrizione ?? '' }}</div>
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
<div class="text-xs font-medium">{{ $row->cod_for ?? '—' }}</div>
|
|
<div class="text-[10px] text-gray-500">{{ $row->fornitore_nome ?? '' }}</div>
|
|
@if($workflowMode && !empty($row->fornitore_locale_nome))
|
|
<div class="text-[10px] text-blue-700">Locale: {{ $row->fornitore_locale_nome }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
<div>{{ $row->benef ?? '—' }}</div>
|
|
@if($workflowMode && (!empty($row->voce_spesa_locale) || !empty($row->tabella_locale)))
|
|
<div class="mt-1 text-[10px] text-gray-600">
|
|
@if(!empty($row->voce_spesa_locale))
|
|
Voce locale: {{ $row->voce_spesa_locale }}
|
|
@endif
|
|
@if(!empty($row->tabella_locale))
|
|
· Tabella: {{ $row->tabella_locale }}
|
|
@endif
|
|
</div>
|
|
@endif
|
|
@if($workflowMode && ($row->protocollo_logico ?? null) === 'bonifico+rda')
|
|
<span class="mt-1 inline-flex items-center rounded bg-blue-100 px-1.5 py-0.5 text-[10px] font-medium text-blue-800">Flusso: Debito → Bonifico → RDA</span>
|
|
@elseif($workflowMode)
|
|
<span class="mt-1 inline-flex items-center rounded bg-gray-100 px-1.5 py-0.5 text-[10px] font-medium text-gray-700">Flusso: Debito/Costo</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">{{ $row->rda_code ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right">
|
|
{{ number_format((float)($row->importo_signed ?? ($row->importo_euro ?? $row->importo ?? 0)), 2, ',', '.') }}
|
|
@if(!empty($row->natura2))
|
|
<div class="text-[10px] text-gray-500">{{ $row->natura2 }}</div>
|
|
@endif
|
|
@if($workflowMode && !empty($row->bonifico_data))
|
|
<div class="text-[10px] text-gray-500">Bonifico: {{ \Carbon\Carbon::parse($row->bonifico_data)->format('d/m/Y') }}</div>
|
|
@endif
|
|
@if(!empty($row->rda_row_importo))
|
|
<a class="text-[10px] text-blue-600" target="_blank" href="{{ \App\Filament\Pages\Contabilita\RegistroRitenuteAccontoArchivio::getUrl(panel: 'admin-filament') }}">RDA € {{ number_format((float)$row->rda_row_importo, 2, ',', '.') }}</a>
|
|
@endif
|
|
@if($workflowMode && !empty($row->rda_scadenza))
|
|
<div class="text-[10px] {{ ($row->rda_stato ?? '') === 'versata in ritardo' ? 'text-red-600' : 'text-gray-500' }}">
|
|
Scad. RDA: {{ \Carbon\Carbon::parse($row->rda_scadenza)->format('d/m/Y') }}
|
|
@if(!empty($row->rda_stato)) · {{ $row->rda_stato }} @endif
|
|
</div>
|
|
@endif
|
|
@if(empty($row->rda_row_importo))
|
|
@if(!empty($row->fe_fattura_id))
|
|
<a class="text-[10px] text-blue-600" target="_blank" href="{{ \App\Filament\Pages\Contabilita\FatturaFornitoreScheda::getUrl(['record' => $row->fe_fattura_id], panel: 'admin-filament') }}">Apri FE</a>
|
|
@endif
|
|
@if(!empty($row->fe_ricevuta_id))
|
|
<a class="text-[10px] text-blue-600" target="_blank" href="{{ \App\Filament\Pages\Contabilita\FatturaElettronicaScheda::getUrl(['record' => $row->fe_ricevuta_id], panel: 'admin-filament') }}">Apri FE XML</a>
|
|
@endif
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
@php
|
|
$feUrl = null;
|
|
if (!empty($row->fe_fattura_id)) {
|
|
$feUrl = \App\Filament\Pages\Contabilita\FatturaFornitoreScheda::getUrl(['record' => $row->fe_fattura_id], panel: 'admin-filament');
|
|
} elseif (!empty($row->fe_ricevuta_id)) {
|
|
$feUrl = \App\Filament\Pages\Contabilita\FatturaElettronicaScheda::getUrl(['record' => $row->fe_ricevuta_id], panel: 'admin-filament');
|
|
}
|
|
@endphp
|
|
<div class="text-[10px] text-gray-500">
|
|
{{ number_format((float)($row->importo_signed ?? ($row->importo_euro ?? $row->importo ?? 0)), 2, ',', '.') }}
|
|
@if(!empty($row->dt_spe))
|
|
({{ \Carbon\Carbon::parse($row->dt_spe)->format('d/m/Y') }})
|
|
@endif
|
|
</div>
|
|
@if($feUrl && !empty($row->num_fat))
|
|
<a class="text-xs text-blue-600" target="_blank" href="{{ $feUrl }}">{{ $row->num_fat }}</a>
|
|
@else
|
|
<div class="text-xs">{{ $row->num_fat ?? '—' }}</div>
|
|
@endif
|
|
@if(!empty($row->dt_fat))
|
|
<div class="text-[10px] text-gray-500">{{ \Carbon\Carbon::parse($row->dt_fat)->format('d/m/Y') }}</div>
|
|
@endif
|
|
@if($workflowMode && !empty($row->fe_totale))
|
|
<div class="text-[10px] text-gray-500">Totale doc € {{ number_format((float) $row->fe_totale, 2, ',', '.') }}</div>
|
|
@endif
|
|
@if($workflowMode && !empty($row->fe_netto))
|
|
<div class="text-[10px] text-gray-500">Netto bonifico € {{ number_format((float) $row->fe_netto, 2, ',', '.') }}</div>
|
|
@endif
|
|
@if(!empty($row->rda_row_data))
|
|
<div class="text-[10px] text-gray-500">RDA {{ \Carbon\Carbon::parse($row->rda_row_data)->format('d/m/Y') }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
@if(!empty($row->fe_totale))
|
|
<div class="text-xs font-medium">{{ number_format((float)$row->fe_totale, 2, ',', '.') }}</div>
|
|
@endif
|
|
@if(!empty($row->fe_fattura_id) || !empty($row->fe_ricevuta_id))
|
|
<div class="text-[10px] text-gray-500">ID FE: {{ $row->fe_fattura_id ?? $row->fe_ricevuta_id }}</div>
|
|
@endif
|
|
@if(!empty($row->fe_display) || !empty($row->fe_uid))
|
|
<div class="text-xs font-medium">{{ $row->fe_display ?? $row->fe_uid }}</div>
|
|
@endif
|
|
@if(!empty($row->fe_numero))
|
|
<div class="text-[10px] text-gray-500">{{ $row->fe_numero }}</div>
|
|
@endif
|
|
@if(!empty($row->ra_importo) || !empty($row->ra_data))
|
|
<div class="text-[10px] text-gray-500">
|
|
RA
|
|
@if(!empty($row->ra_data))
|
|
· {{ \Carbon\Carbon::parse($row->ra_data)->format('d/m/Y') }}
|
|
@endif
|
|
@if(!empty($row->ra_importo))
|
|
· € {{ number_format((float)$row->ra_importo, 2, ',', '.') }}
|
|
@endif
|
|
</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
@if(in_array(strtoupper((string) ($row->cod_spe ?? '')), ['I05', 'I06'], true) && !empty($row->n_spe))
|
|
<x-filament::button
|
|
size="xs"
|
|
color="gray"
|
|
x-data
|
|
x-on:click="$wire.openDettPersModal({{ (int) $row->n_spe }}); $dispatch('open-modal', { id: 'dett-pers-modal' })"
|
|
>Apri</x-filament::button>
|
|
@if(isset($row->dett_pers_ok) && !$row->dett_pers_ok)
|
|
<div class="mt-1 text-[10px] text-red-600">Da completare</div>
|
|
@endif
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="13" class="px-3 py-2 text-gray-500">Nessuna operazione trovata.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@if($operazioni)
|
|
<div class="px-3 py-2">
|
|
{{ $operazioni->links() }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($activeTab === 'preventivo')
|
|
@php
|
|
$preventivoSummaryCollection = collect($this->preventivoSummaryRows ?? []);
|
|
$preventivoRowsCollection = collect($this->preventivoEditorRows ?? []);
|
|
$preventivoRowsGrouped = $preventivoSummaryCollection
|
|
->map(function ($summary) use ($preventivoRowsCollection) {
|
|
$code = (string) ($summary['codice'] ?? '');
|
|
|
|
return [
|
|
'summary' => $summary,
|
|
'rows' => $preventivoRowsCollection
|
|
->filter(fn ($row) => (string) ($row['tabella_codice'] ?? '') === $code)
|
|
->values()
|
|
->all(),
|
|
];
|
|
})
|
|
->filter(fn (array $group) => ! empty($group['rows']) || ! empty($group['summary']))
|
|
->values();
|
|
$preventivoOrdTotal = (float) $preventivoSummaryCollection
|
|
->reject(fn ($summary) => strtoupper((string) ($summary['codice'] ?? '')) === 'ACQUA')
|
|
->sum(fn ($summary) => (float) ($summary['totale_preventivo'] ?? 0));
|
|
$preventivoAcquaTotal = (float) $preventivoSummaryCollection
|
|
->filter(fn ($summary) => strtoupper((string) ($summary['codice'] ?? '')) === 'ACQUA')
|
|
->sum(fn ($summary) => (float) ($summary['totale_preventivo'] ?? 0));
|
|
$preventivoGeneralTotal = $preventivoOrdTotal + $preventivoAcquaTotal;
|
|
@endphp
|
|
<div class="mt-6 space-y-6">
|
|
<div class="rounded-lg border border-blue-200 bg-blue-50 px-4 py-3 text-xs text-blue-900">
|
|
<div class="font-semibold">Preventivo ordinario operativo</div>
|
|
<div class="mt-1">
|
|
Gestione {{ $this->preventivoGestioneMeta['denominazione'] ?? 'ordinaria' }}
|
|
@if(!empty($this->preventivoGestioneMeta['anno']))
|
|
· anno {{ $this->preventivoGestioneMeta['anno'] }}
|
|
@endif
|
|
· rate emesse su
|
|
@if(!empty($this->ripartoRateMonths))
|
|
{{ collect($this->ripartoRateMonths)->pluck('label')->implode(', ') }}
|
|
@else
|
|
mesi non configurati
|
|
@endif
|
|
</div>
|
|
<div class="mt-1 text-[11px] text-blue-800">Visualizzazione ordinata per tabella, con ACQUA separata ma riportata anche nel totale finale.</div>
|
|
</div>
|
|
|
|
<div class="overflow-hidden rounded-lg border">
|
|
<div class="flex items-center justify-between gap-3 bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-700">
|
|
<span>Voci di spesa per tabella</span>
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Codice</th>
|
|
<th class="px-3 py-2 text-left">Descrizione</th>
|
|
<th class="px-3 py-2 text-left">Tabella</th>
|
|
<th class="px-3 py-2 text-right">Preventivo €</th>
|
|
<th class="px-3 py-2 text-right">Consuntivo €</th>
|
|
<th class="px-3 py-2 text-right">% Inquilino</th>
|
|
<th class="px-3 py-2 text-left">Conto PD</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($preventivoRowsGrouped as $group)
|
|
@php
|
|
$summary = $group['summary'] ?? [];
|
|
@endphp
|
|
<tr class="border-t bg-gray-50">
|
|
<td class="px-3 py-2 font-semibold text-gray-900" colspan="7">
|
|
{{ $summary['codice'] ?? '—' }}
|
|
@if(!empty($summary['label']))
|
|
<span class="font-normal text-gray-600">· {{ $summary['label'] }}</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@foreach(($group['rows'] ?? []) as $row)
|
|
<tr class="border-t align-top">
|
|
<td class="px-3 py-2 font-medium text-gray-900">{{ $row['codice'] }}</td>
|
|
<td class="px-3 py-2">
|
|
<div class="font-medium text-gray-900">{{ $row['descrizione'] }}</div>
|
|
</td>
|
|
<td class="px-3 py-2 text-gray-600">{{ ($row['tabella_codice'] ?? '—') !== '' ? $row['tabella_codice'] : '—' }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) ($row['importo_default'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) ($row['importo_consuntivo'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) ($row['percentuale_inquilino'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-[11px] text-gray-600">
|
|
{{ $row['conto_pd'] ?: '—' }}
|
|
@if(!empty($row['sottoconto_pd']))
|
|
<div>{{ $row['sottoconto_pd'] }}</div>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
<tr class="border-t bg-gray-50">
|
|
<td class="px-3 py-2 font-semibold" colspan="3">Subtotale {{ $summary['codice'] ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right font-semibold tabular-nums">{{ number_format((float) ($summary['totale_preventivo'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right font-semibold tabular-nums">{{ number_format((float) ($summary['totale_consuntivo'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2"></td>
|
|
<td class="px-3 py-2"></td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="7" class="px-3 py-4 text-gray-500">Nessuna voce ordinaria trovata per la gestione attiva.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
@if(!empty($this->preventivoSummaryRows))
|
|
<div class="overflow-hidden rounded-lg border">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-700">Riepilogo per tabella</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Tabella</th>
|
|
<th class="px-3 py-2 text-left">Tipo</th>
|
|
<th class="px-3 py-2 text-right">Preventivo €</th>
|
|
<th class="px-3 py-2 text-right">Consuntivo €</th>
|
|
<th class="px-3 py-2 text-right">Quota condomini €</th>
|
|
<th class="px-3 py-2 text-right">Quota inquilini €</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($this->preventivoSummaryRows as $summary)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">
|
|
<div class="font-medium text-gray-900">{{ $summary['codice'] }}</div>
|
|
<div class="text-[10px] text-gray-500">{{ $summary['label'] }}</div>
|
|
</td>
|
|
<td class="px-3 py-2 text-gray-700">{{ $summary['legacy_tipo'] ?? $summary['tipo_calcolo'] ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $summary['totale_preventivo'], 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $summary['totale_consuntivo'], 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $summary['quota_condomini'], 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $summary['quota_inquilini'], 2, ',', '.') }}</td>
|
|
</tr>
|
|
@endforeach
|
|
<tr class="border-t bg-gray-50">
|
|
<td class="px-3 py-2 font-semibold" colspan="2">Totale ordinarie senza ACQUA</td>
|
|
<td class="px-3 py-2 text-right font-semibold tabular-nums">{{ number_format((float) $preventivoOrdTotal, 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2"></td>
|
|
<td class="px-3 py-2"></td>
|
|
<td class="px-3 py-2"></td>
|
|
</tr>
|
|
@if($preventivoAcquaTotal > 0)
|
|
<tr class="border-t bg-blue-50">
|
|
<td class="px-3 py-2 font-semibold" colspan="2">ACQUA</td>
|
|
<td class="px-3 py-2 text-right font-semibold tabular-nums">{{ number_format((float) $preventivoAcquaTotal, 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2"></td>
|
|
<td class="px-3 py-2"></td>
|
|
<td class="px-3 py-2"></td>
|
|
</tr>
|
|
@endif
|
|
<tr class="border-t bg-gray-100">
|
|
<td class="px-3 py-2 font-semibold" colspan="2">Totale generale</td>
|
|
<td class="px-3 py-2 text-right font-semibold tabular-nums">{{ number_format((float) $preventivoGeneralTotal, 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2"></td>
|
|
<td class="px-3 py-2"></td>
|
|
<td class="px-3 py-2"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($activeTab === 'riparto')
|
|
<div class="mt-6 space-y-6">
|
|
<div class="rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-xs text-emerald-900">
|
|
<div class="font-semibold">Ripartizione simulata per unità</div>
|
|
<div class="mt-1">Sequenza applicata: totale voce → tabella/unità → quota condomini e quota inquilini → rate sui mesi configurati.</div>
|
|
<div class="mt-1 text-[11px] text-emerald-800">Le colonne `TAB.A`, `TAB.B`, `ACQUA` ecc. sono il formato base stampabile richiesto per distribuire il riparto per unità immobiliari.</div>
|
|
</div>
|
|
|
|
<div class="overflow-hidden rounded-lg border">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-700">Matrice ripartizione per unità</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Unità</th>
|
|
<th class="px-3 py-2 text-left">Soggetti</th>
|
|
@foreach($this->ripartoPreviewColumns as $column)
|
|
<th class="px-3 py-2 text-right">{{ $column['label'] }}</th>
|
|
@endforeach
|
|
<th class="px-3 py-2 text-right">Condomini €</th>
|
|
<th class="px-3 py-2 text-right">Inquilini €</th>
|
|
<th class="px-3 py-2 text-right">Totale €</th>
|
|
@foreach($this->ripartoRateMonths as $month)
|
|
<th class="px-3 py-2 text-right">{{ $month['label'] }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($this->ripartoPreviewRows as $row)
|
|
<tr class="border-t align-top">
|
|
<td class="px-3 py-2">
|
|
<div class="font-medium text-gray-900">{{ $row['unit_label'] }}</div>
|
|
<div class="text-[10px] text-gray-500">{{ $row['stato_occupazione'] ?: 'occupazione non indicata' }}</div>
|
|
</td>
|
|
<td class="px-3 py-2 text-[11px] text-gray-700">{{ $row['people_summary'] }}</td>
|
|
@foreach($this->ripartoPreviewColumns as $column)
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) ($row['columns'][$column['codice']] ?? 0), 2, ',', '.') }}</td>
|
|
@endforeach
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $row['totale_condomini'], 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $row['totale_inquilini'], 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right font-semibold tabular-nums">{{ number_format((float) $row['totale_unita'], 2, ',', '.') }}</td>
|
|
@foreach($row['rate'] as $rate)
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $rate['amount'], 2, ',', '.') }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="99" class="px-3 py-4 text-gray-500">Riparto non disponibile per lo stabile o per l'anno selezionato.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
@if(!empty($this->ripartoPreviewRows))
|
|
<div class="rounded-lg border">
|
|
<div class="flex flex-wrap items-center justify-between gap-3 bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-700">
|
|
<span>Dettaglio soggetti per unità</span>
|
|
<select wire:model.live="ripartoFocusUnitId" class="rounded border-gray-300 text-xs">
|
|
@foreach($this->ripartoPreviewRows as $row)
|
|
<option value="{{ $row['unit_id'] }}">{{ $row['unit_label'] }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Soggetto</th>
|
|
<th class="px-3 py-2 text-left">Ruolo</th>
|
|
<th class="px-3 py-2 text-right">Quota %</th>
|
|
@foreach($this->ripartoPreviewColumns as $column)
|
|
<th class="px-3 py-2 text-right">{{ $column['label'] }}</th>
|
|
@endforeach
|
|
<th class="px-3 py-2 text-right">Totale €</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($this->ripartoFocusBreakdown as $subject)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2 font-medium text-gray-900">{{ $subject['name'] }}</td>
|
|
<td class="px-3 py-2">{{ $subject['role'] }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $subject['quota_percent'], 2, ',', '.') }}</td>
|
|
@foreach($this->ripartoPreviewColumns as $column)
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) ($subject['columns'][$column['codice']] ?? 0), 2, ',', '.') }}</td>
|
|
@endforeach
|
|
<td class="px-3 py-2 text-right font-semibold tabular-nums">{{ number_format((float) $subject['totale'], 2, ',', '.') }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="99" class="px-3 py-4 text-gray-500">Nessun soggetto disponibile per il dettaglio dell'unità selezionata.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($activeTab === 'persone')
|
|
<div class="mt-6 space-y-4">
|
|
<div class="rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-xs text-amber-900">
|
|
<div class="font-semibold">Controllo persone collegate alle unità</div>
|
|
<div class="mt-1">Questo controllo evidenzia unità senza proprietario attivo, unità con solo nominativi legacy e unità occupate da inquilino senza un inquilino attivo collegato.</div>
|
|
</div>
|
|
|
|
<div class="overflow-hidden rounded-lg border">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-700">Audit collegamenti stabile attivo</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Unità</th>
|
|
<th class="px-3 py-2 text-left">Proprietari</th>
|
|
<th class="px-3 py-2 text-left">Inquilini</th>
|
|
<th class="px-3 py-2 text-right">Quota prop. %</th>
|
|
<th class="px-3 py-2 text-left">Segnalazioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($this->personeCollegateAudit as $audit)
|
|
<tr class="border-t align-top">
|
|
<td class="px-3 py-2 font-medium text-gray-900">{{ $audit['unit_label'] }}</td>
|
|
<td class="px-3 py-2">{{ $audit['owners'] ?: '—' }}</td>
|
|
<td class="px-3 py-2">{{ $audit['tenants'] ?: '—' }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">
|
|
@if($audit['owner_quota'] !== null)
|
|
{{ number_format((float) $audit['owner_quota'], 2, ',', '.') }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
@if(!empty($audit['flags']))
|
|
{{ implode(' · ', $audit['flags']) }}
|
|
@else
|
|
<span class="text-emerald-700">Nessuna anomalia immediata</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="5" class="px-3 py-4 text-gray-500">Nessun dato persone/unità disponibile per lo stabile attivo.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if($activeTab === 'incassi')
|
|
<div class="mt-6 overflow-hidden rounded-lg border">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-600">
|
|
Incassi GESCON (singolo_anno.mdb)
|
|
@if(!empty($this->legacyGestioneLabel))
|
|
· {{ $this->legacyGestioneLabel }}
|
|
@endif
|
|
</div>
|
|
@if(empty($incassi) || $incassi->count() === 0)
|
|
<div class="px-3 py-3 text-xs text-gray-500">Nessun incasso trovato per la gestione selezionata.</div>
|
|
@else
|
|
@php
|
|
$movimentiBancaUrl = \App\Filament\Pages\Contabilita\CasseBancheMovimenti::getUrl(panel: 'admin-filament');
|
|
$rifSubtotals = collect($incassi->items() ?? [])->reduce(function ($carry, $item) {
|
|
$rifKey = trim((string) ($item->riferimento_visuale ?? $item->n_riferimento ?? $item->n_ricevuta ?? $item->n_mese ?? ''));
|
|
if ($rifKey === '') {
|
|
$rifKey = '—';
|
|
}
|
|
|
|
$importo = (float) ($item->importo_visualizzato ?? $item->importo_pagato_euro ?? $item->importo_euro ?? $item->importo ?? 0);
|
|
if (! isset($carry[$rifKey])) {
|
|
$carry[$rifKey] = ['totale' => 0.0, 'count' => 0];
|
|
}
|
|
|
|
$carry[$rifKey]['totale'] += $importo;
|
|
$carry[$rifKey]['count']++;
|
|
|
|
return $carry;
|
|
}, []);
|
|
@endphp
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Data</th>
|
|
<th class="px-3 py-2 text-left">Nominativo</th>
|
|
<th class="px-3 py-2 text-left">Scala/Int.</th>
|
|
<th class="px-3 py-2 text-left">Tipo</th>
|
|
<th class="px-3 py-2 text-left">Cod. cond</th>
|
|
<th class="px-3 py-2 text-right">Importo €</th>
|
|
<th class="px-3 py-2 text-left">Rif.</th>
|
|
<th class="px-3 py-2 text-left">Cassa</th>
|
|
<th class="px-3 py-2 text-right">Subtotale Rif. (pag.)</th>
|
|
<th class="px-3 py-2 text-left">Descrizione</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($incassi as $row)
|
|
@php
|
|
$tipo = $row->cond_inq ?? $row->cond_inquil ?? '—';
|
|
$data = $row->data_visuale ?? ($row->dt_empag ?? null);
|
|
$importo = $row->importo_visualizzato ?? ($row->importo_pagato_euro ?? $row->importo_euro ?? $row->importo ?? 0);
|
|
$rif = $row->riferimento_visuale ?? ($row->n_riferimento ?? $row->n_ricevuta ?? $row->n_mese ?? null);
|
|
$rifKey = trim((string) ($rif ?? ''));
|
|
if ($rifKey === '') {
|
|
$rifKey = '—';
|
|
}
|
|
$rifSubtotal = (float) (($rifSubtotals[$rifKey]['totale'] ?? 0));
|
|
$rifCount = (int) (($rifSubtotals[$rifKey]['count'] ?? 0));
|
|
@endphp
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">
|
|
@if(!empty($data))
|
|
{{ \Carbon\Carbon::parse($data)->format('d/m/Y') }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
@if(!empty($row->persona_url))
|
|
<a href="{{ $row->persona_url }}" class="text-primary-600 hover:underline">
|
|
{{ $row->nominativo_pagante ?? '—' }}
|
|
</a>
|
|
@else
|
|
{{ $row->nominativo_pagante ?? '—' }}
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">{{ $row->scala_interno_short ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $tipo }}</td>
|
|
<td class="px-3 py-2">{{ $row->cod_cond ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) $importo, 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2">{{ $rif ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $row->cod_cassa ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">
|
|
<div>{{ number_format($rifSubtotal, 2, ',', '.') }}</div>
|
|
@if($rifCount > 1)
|
|
<div class="text-[10px] text-gray-500">{{ $rifCount }} mov.</div>
|
|
@endif
|
|
<a href="{{ $movimentiBancaUrl }}" class="text-[10px] text-primary-600 hover:underline" target="_blank">Banca</a>
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
<div>{{ $row->descrizione ?? '—' }}</div>
|
|
@if(!empty($row->rata_match))
|
|
<div class="text-[10px] text-gray-500">
|
|
Rata {{ !empty($row->rata_match['n_emissione']) ? ('#' . $row->rata_match['n_emissione']) : 'match importo' }}
|
|
· € {{ number_format((float)($row->rata_match['importo'] ?? 0), 2, ',', '.') }}
|
|
@if(!empty($row->rata_match['data_emissione']))
|
|
· {{ \Carbon\Carbon::parse($row->rata_match['data_emissione'])->format('d/m/Y') }}
|
|
@endif
|
|
</div>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="border-t bg-gray-50 px-3 py-2 text-xs text-gray-600">
|
|
{{ $incassi->total() }} incassi · pagina {{ $incassi->currentPage() }} / {{ $incassi->lastPage() }}
|
|
</div>
|
|
<div class="border-t bg-white px-3 py-2">
|
|
{{ $incassi->links() }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($activeTab === 'fatture')
|
|
<div class="mt-6 overflow-hidden rounded-lg border">
|
|
<div class="bg-emerald-50 px-3 py-2 text-xs font-semibold text-emerald-800">
|
|
Fatture ricevute (contabilità locale: FE + manuali)
|
|
</div>
|
|
@if(empty($fattureRicevute) || $fattureRicevute->count() === 0)
|
|
<div class="px-3 py-3 text-xs text-gray-500">Nessuna fattura ricevuta trovata per i filtri correnti.</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Data</th>
|
|
<th class="px-3 py-2 text-left">N. documento</th>
|
|
<th class="px-3 py-2 text-left">Fornitore</th>
|
|
<th class="px-3 py-2 text-left">Origine</th>
|
|
<th class="px-3 py-2 text-right">Totale €</th>
|
|
<th class="px-3 py-2 text-right">Netto €</th>
|
|
<th class="px-3 py-2 text-left">Stato</th>
|
|
<th class="px-3 py-2 text-left">Azioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($fattureRicevute as $row)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">
|
|
@if(!empty($row->data_documento))
|
|
{{ \Carbon\Carbon::parse($row->data_documento)->format('d/m/Y') }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">{{ $row->numero_documento ?? '—' }}</td>
|
|
<td class="px-3 py-2">
|
|
<div>{{ $row->fornitore_nome ?? '—' }}</div>
|
|
@if(!empty($row->cod_fornitore_legacy))
|
|
<div class="text-[10px] text-gray-500">cod. {{ $row->cod_fornitore_legacy }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
@if(!empty($row->fattura_elettronica_id))
|
|
<span class="inline-flex items-center rounded bg-blue-100 px-1.5 py-0.5 text-[10px] font-medium text-blue-700">FE</span>
|
|
@if(!empty($row->fe_sdi_file))
|
|
<div class="text-[10px] text-gray-500">{{ $row->fe_sdi_file }}</div>
|
|
@endif
|
|
@else
|
|
<span class="inline-flex items-center rounded bg-gray-100 px-1.5 py-0.5 text-[10px] font-medium text-gray-700">Manuale</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) ($row->totale ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float) ($row->netto_da_pagare ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2">
|
|
<div>{{ $row->stato ?? '—' }}</div>
|
|
@if(!empty($row->data_pagamento))
|
|
<div class="text-[10px] text-gray-500">Pagata: {{ \Carbon\Carbon::parse($row->data_pagamento)->format('d/m/Y') }}</div>
|
|
@endif
|
|
@if((float) ($row->ritenuta_importo ?? 0) > 0)
|
|
<div class="text-[10px] text-gray-500">RA: € {{ number_format((float) ($row->ritenuta_importo ?? 0), 2, ',', '.') }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
<a class="text-primary-600 hover:underline" target="_blank" href="{{ \App\Filament\Pages\Contabilita\FatturaFornitoreScheda::getUrl(['record' => (int) $row->id], panel: 'admin-filament') }}">Apri</a>
|
|
@if(!empty($row->fattura_elettronica_id))
|
|
<div>
|
|
<a class="text-[10px] text-blue-600 hover:underline" target="_blank" href="{{ \App\Filament\Pages\Contabilita\FatturaElettronicaScheda::getUrl(['record' => (int) $row->fattura_elettronica_id], panel: 'admin-filament') }}">Apri FE XML</a>
|
|
</div>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="border-t bg-emerald-50 px-3 py-2 text-xs text-emerald-900">
|
|
{{ $fattureRicevute->total() }} fatture ricevute · pagina {{ $fattureRicevute->currentPage() }} / {{ $fattureRicevute->lastPage() }}
|
|
</div>
|
|
<div class="border-t bg-white px-3 py-2">
|
|
{{ $fattureRicevute->links() }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="mt-6 overflow-hidden rounded-lg border">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-600">
|
|
Fatture legacy GESCON (generale_stabile.mdb)
|
|
@if(!empty($this->legacyGestioneLabel))
|
|
· {{ $this->legacyGestioneLabel }}
|
|
@endif
|
|
</div>
|
|
<div class="border-b bg-white px-3 py-2">
|
|
<x-filament::button
|
|
size="xs"
|
|
color="primary"
|
|
wire:click="importaFattureLegacy"
|
|
wire:loading.attr="disabled"
|
|
wire:target="importaFattureLegacy"
|
|
>Importa in contabilità</x-filament::button>
|
|
</div>
|
|
@if(empty($fattureLegacy) || $fattureLegacy->count() === 0)
|
|
<div class="px-3 py-3 text-xs text-gray-500">Nessuna fattura trovata per i filtri correnti.</div>
|
|
@else
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Data</th>
|
|
<th class="px-3 py-2 text-left">N. fattura</th>
|
|
<th class="px-3 py-2 text-left">Cod. forn.</th>
|
|
<th class="px-3 py-2 text-left">Fornitore</th>
|
|
<th class="px-3 py-2 text-left">Descrizione</th>
|
|
<th class="px-3 py-2 text-right">Imponibile €</th>
|
|
<th class="px-3 py-2 text-right">RA € / Stato</th>
|
|
<th class="px-3 py-2 text-right">Totale €</th>
|
|
<th class="px-3 py-2 text-left">Sync locale</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($fattureLegacy as $row)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">
|
|
@if(!empty($row->data_fattura))
|
|
{{ \Carbon\Carbon::parse($row->data_fattura)->format('d/m/Y') }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
<div>{{ $row->numero_fattura ?? '—' }}</div>
|
|
</td>
|
|
<td class="px-3 py-2">{{ $row->cod_fornitore ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $row->fornitore_nome ?? '—' }}</td>
|
|
<td class="px-3 py-2">
|
|
<div>{{ $row->descrizione_view ?? '—' }}</div>
|
|
@if(!empty($row->note))
|
|
<div class="text-[10px] text-gray-500">{{ $row->note }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float)($row->imponibile ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">
|
|
@if((float)($row->ra_fatta_importo ?? 0) > 0)
|
|
<div>{{ number_format((float)($row->ra_fatta_importo ?? 0), 2, ',', '.') }}</div>
|
|
<div class="text-[10px] text-gray-500">Fatta @if(!empty($row->ra_tributo)) · trib. {{ $row->ra_tributo }} @endif</div>
|
|
@if(!empty($row->ra_riferimento))
|
|
<div class="text-[10px] text-gray-500">Rif. F24: {{ $row->ra_riferimento }}</div>
|
|
@endif
|
|
@if(!empty($row->ra_versata_data))
|
|
<div class="text-[10px] text-emerald-600">Versata: {{ \Carbon\Carbon::parse($row->ra_versata_data)->format('d/m/Y') }}</div>
|
|
@else
|
|
<div class="text-[10px] text-amber-600">Data versamento: —</div>
|
|
<div class="text-[10px] text-amber-600">Da versare</div>
|
|
@endif
|
|
<a class="text-[10px] text-primary-600 hover:underline" target="_blank" href="{{ \App\Filament\Pages\Contabilita\RegistroRitenuteAccontoArchivio::getUrl(panel: 'admin-filament') }}">Registro RA</a>
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">
|
|
<div>{{ number_format((float)($row->totale_view ?? 0), 2, ',', '.') }}</div>
|
|
@if(!empty($row->data_pagamento))
|
|
<div class="text-[10px] text-gray-500">Pagata: {{ \Carbon\Carbon::parse($row->data_pagamento)->format('d/m/Y') }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
@if(!empty($row->local_match_url))
|
|
<a href="{{ $row->local_match_url }}" class="text-primary-600 hover:underline" target="_blank">Collegata #{{ $row->local_match_id }}</a>
|
|
@if(!empty($row->local_match_stato))
|
|
<div class="text-[10px] text-gray-500">{{ $row->local_match_stato }}</div>
|
|
@endif
|
|
@if(!empty($row->local_match_fe_url))
|
|
<a href="{{ $row->local_match_fe_url }}" class="text-[10px] text-blue-600 hover:underline" target="_blank">Apri FE XML #{{ $row->local_match_fe_id }}</a>
|
|
@endif
|
|
@elseif(!empty($row->local_match_fe_url))
|
|
<a href="{{ $row->local_match_fe_url }}" class="text-amber-600 hover:underline" target="_blank">FE XML #{{ $row->local_match_fe_id }}</a>
|
|
<div class="text-[10px] text-amber-600">FE trovata, manca registrazione contabile</div>
|
|
@else
|
|
<span class="text-gray-500">Da mappare</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="border-t bg-gray-50 px-3 py-2 text-xs text-gray-600">
|
|
{{ $fattureLegacy->total() }} fatture · pagina {{ $fattureLegacy->currentPage() }} / {{ $fattureLegacy->lastPage() }}
|
|
</div>
|
|
<div class="border-t bg-white px-3 py-2">
|
|
{{ $fattureLegacy->links() }}
|
|
</div>
|
|
|
|
<div class="border-t bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-700">
|
|
Ritenute d'acconto (RA) · riepilogo mese / tributo
|
|
</div>
|
|
<div class="border-b bg-white px-3 py-2 text-xs text-gray-600">
|
|
Totale fatta: € {{ number_format((float)($raMonthlyTributoSummary['totale_fatta'] ?? 0), 2, ',', '.') }}
|
|
· Totale versata: € {{ number_format((float)($raMonthlyTributoSummary['totale_versata'] ?? 0), 2, ',', '.') }}
|
|
· Delta: € {{ number_format((float)($raMonthlyTributoSummary['totale_delta'] ?? 0), 2, ',', '.') }}
|
|
</div>
|
|
@if(!empty($raMonthlyTributoSummary['rows']))
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Mese</th>
|
|
<th class="px-3 py-2 text-left">Tributo</th>
|
|
<th class="px-3 py-2 text-right">RA fatta €</th>
|
|
<th class="px-3 py-2 text-right">RA versata €</th>
|
|
<th class="px-3 py-2 text-right">Delta €</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($raMonthlyTributoSummary['rows'] as $raRow)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">{{ \Carbon\Carbon::createFromFormat('Y-m', $raRow['mese'])->format('m/Y') }}</td>
|
|
<td class="px-3 py-2">{{ $raRow['tributo'] }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float)($raRow['fatta'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float)($raRow['versata'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float)($raRow['delta'] ?? 0), 2, ',', '.') }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<div class="px-3 py-3 text-xs text-gray-500">Nessuna ritenuta disponibile per i filtri correnti.</div>
|
|
@endif
|
|
|
|
@php
|
|
$raRows = collect($fattureLegacy?->items() ?? [])
|
|
->filter(fn($row) => (float)($row->ra_fatta_importo ?? 0) > 0)
|
|
->values();
|
|
@endphp
|
|
<div class="border-t bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-700">
|
|
Ritenute d'acconto (RA) · dettaglio fatture in pagina
|
|
</div>
|
|
@if($raRows->isNotEmpty())
|
|
<div class="overflow-x-auto border-b">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Data</th>
|
|
<th class="px-3 py-2 text-left">Fattura / Fornitore</th>
|
|
<th class="px-3 py-2 text-left">Tributo</th>
|
|
<th class="px-3 py-2 text-right">RA fatta €</th>
|
|
<th class="px-3 py-2 text-right">RA versata €</th>
|
|
<th class="px-3 py-2 text-left">Stato</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($raRows as $ra)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">
|
|
@if(!empty($ra->data_fattura))
|
|
{{ \Carbon\Carbon::parse($ra->data_fattura)->format('d/m/Y') }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
<div>{{ $ra->numero_fattura ?? '—' }}</div>
|
|
<div class="text-[10px] text-gray-500">{{ $ra->fornitore_nome ?? '—' }}</div>
|
|
</td>
|
|
<td class="px-3 py-2">{{ $ra->ra_tributo ?? '1040' }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">{{ number_format((float)($ra->ra_fatta_importo ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2 text-right tabular-nums">
|
|
@if(!empty($ra->ra_versata_data))
|
|
{{ number_format((float)($ra->ra_fatta_importo ?? 0), 2, ',', '.') }}
|
|
@else
|
|
0,00
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">
|
|
@if(!empty($ra->ra_versata_data))
|
|
<span class="text-emerald-700">Versata</span>
|
|
<div class="text-[10px] text-gray-500">{{ \Carbon\Carbon::parse($ra->ra_versata_data)->format('d/m/Y') }}</div>
|
|
@else
|
|
<span class="text-amber-700">Da versare</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<div class="border-b px-3 py-3 text-xs text-gray-500">Nessuna RA disponibile nella pagina corrente.</div>
|
|
@endif
|
|
|
|
<div class="border-t bg-white px-3 py-2">
|
|
<div class="flex flex-wrap gap-2">
|
|
<x-filament::button
|
|
size="xs"
|
|
color="gray"
|
|
tag="a"
|
|
href="{{ \App\Filament\Pages\Contabilita\RegistroRitenuteAccontoArchivio::getUrl(panel: 'admin-filament') }}"
|
|
target="_blank"
|
|
>Registro ritenute (versamenti/F24)</x-filament::button>
|
|
<x-filament::button
|
|
size="xs"
|
|
color="gray"
|
|
tag="a"
|
|
href="{{ \App\Filament\Pages\SuperAdmin\CodiciTributiF24::getUrl(panel: 'admin-filament') }}"
|
|
target="_blank"
|
|
>Codici tributo F24</x-filament::button>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($activeTab === 'acqua')
|
|
@php
|
|
$acqua = $this->acquaSummary ?? ['voci' => [], 'totale' => 0, 'riparto_totale' => 0, 'riparto_delta' => 0];
|
|
$riparto = $this->acquaRiparto ?? ['rows' => [], 'totale' => 0];
|
|
@endphp
|
|
<div class="mt-6 space-y-3">
|
|
<div class="rounded-lg border bg-white px-3 py-2">
|
|
<div class="flex flex-wrap gap-4 text-xs">
|
|
<div>
|
|
<div class="text-[10px] text-gray-500">Totale fatture (AC1+AC2)</div>
|
|
<div class="font-semibold">€ {{ number_format((float)($acqua['totale'] ?? 0), 2, ',', '.') }}</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-[10px] text-gray-500">Totale riparto (dett_tab.prev_euro)</div>
|
|
<div class="font-semibold">€ {{ number_format((float)($acqua['riparto_totale'] ?? 0), 2, ',', '.') }}</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-[10px] text-gray-500">Delta</div>
|
|
<div class="font-semibold">€ {{ number_format((float)($acqua['riparto_delta'] ?? 0), 2, ',', '.') }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="rounded-lg border bg-white">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-600">Riparto acqua per unità (solo lettura)</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Ruolo</th>
|
|
<th class="px-3 py-2 text-left">Nominativo</th>
|
|
<th class="px-3 py-2 text-left">Scala</th>
|
|
<th class="px-3 py-2 text-left">Interno</th>
|
|
<th class="px-3 py-2 text-left">Piano</th>
|
|
<th class="px-3 py-2 text-right">Preventivo €</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($riparto['rows'] ?? []) as $row)
|
|
<tr>
|
|
<td class="px-3 py-2">{{ $row['ruolo'] }}</td>
|
|
<td class="px-3 py-2">{{ $row['nominativo'] }}</td>
|
|
<td class="px-3 py-2">{{ $row['scala'] ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $row['interno'] ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $row['piano'] ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right">{{ number_format((float)($row['prev_euro'] ?? 0), 2, ',', '.') }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="px-3 py-2 text-gray-500">Nessun nominativo disponibile.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if($activeTab === 'consuntivo' || (! $isStraordPage && $activeTab === 'straordinarie'))
|
|
@php
|
|
$cons = $this->consuntivo ?? [];
|
|
$specialCodes = $this->specialCodesSummary ?? ['Z01' => 0, 'Z02' => 0, 'totale' => 0];
|
|
$consSectionKey = ($isStraordPage || $activeTab === 'straordinarie') ? 'straordinarie' : 'ordinarie';
|
|
$tabs = $cons[$consSectionKey] ?? [];
|
|
$acquaTabs = $cons['acqua'] ?? [];
|
|
$acquaTotal = collect($acquaTabs)->sum(fn($t) => (float) ($t['subtotal'] ?? 0));
|
|
$totaleGenerale = collect($tabs)->sum(fn($t) => (float) ($t['subtotal'] ?? 0));
|
|
if ($activeTab === 'consuntivo') {
|
|
$totaleGenerale += (float) $acquaTotal;
|
|
}
|
|
@endphp
|
|
<div class="mt-6 overflow-hidden rounded-lg border">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-600">
|
|
{{ $activeTab === 'straordinarie' ? 'Consuntivo straordinarie' : 'Consuntivo per tabella / voce' }}
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Cod. Spesa</th>
|
|
<th class="px-3 py-2 text-left">Voce</th>
|
|
<th class="px-3 py-2 text-right">Totale €</th>
|
|
<th class="px-3 py-2 text-left">Mastrino</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if(!empty($tabs))
|
|
<tr class="border-t bg-gray-100">
|
|
<td class="px-3 py-2 font-semibold" colspan="4">{{ $sections[$consSectionKey] ?? '' }}</td>
|
|
</tr>
|
|
|
|
@foreach($tabs as $tab)
|
|
<tr class="border-t bg-gray-50">
|
|
<td class="px-3 py-2 font-semibold" colspan="4">{{ $tab['header'] ?? '—' }}</td>
|
|
</tr>
|
|
@foreach($tab['rows'] ?? [] as $r)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">{{ $r['cod_spe'] }}</td>
|
|
<td class="px-3 py-2">{{ $r['voce'] ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right">{{ number_format((float)$r['totale'], 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2">
|
|
<x-filament::button
|
|
size="xs"
|
|
color="gray"
|
|
x-data
|
|
x-on:click="$wire.openMastrino(@js($r['tabella']), @js($r['cod_spe'])); $dispatch('open-modal', { id: 'mastrino-modal' })"
|
|
>Apri</x-filament::button>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
<tr class="border-t bg-gray-50">
|
|
<td class="px-3 py-2 font-semibold" colspan="2">Subtotale</td>
|
|
<td class="px-3 py-2 text-right font-semibold">{{ number_format((float)($tab['subtotal'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2"></td>
|
|
</tr>
|
|
@endforeach
|
|
|
|
@if($activeTab === 'consuntivo' && $acquaTotal > 0)
|
|
<tr class="border-t bg-gray-100">
|
|
<td class="px-3 py-2 font-semibold" colspan="2">ACQUA (totale)</td>
|
|
<td class="px-3 py-2 text-right font-semibold">{{ number_format((float) $acquaTotal, 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2"></td>
|
|
</tr>
|
|
@endif
|
|
|
|
<tr class="border-t bg-gray-50">
|
|
<td class="px-3 py-2 font-semibold" colspan="2">Totale generale</td>
|
|
<td class="px-3 py-2 text-right font-semibold">{{ number_format((float) $totaleGenerale, 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2"></td>
|
|
</tr>
|
|
@else
|
|
<tr><td colspan="4" class="px-3 py-2 text-gray-500">Nessun dato.</td></tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-3 rounded-lg border bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-100">
|
|
<div class="font-semibold">Monitor codici speciali legacy (esclusi dal consuntivo principale)</div>
|
|
<div class="mt-1">Z01: € {{ number_format((float)($specialCodes['Z01'] ?? 0), 2, ',', '.') }} · Z02: € {{ number_format((float)($specialCodes['Z02'] ?? 0), 2, ',', '.') }} · Totale: € {{ number_format((float)($specialCodes['totale'] ?? 0), 2, ',', '.') }}</div>
|
|
</div>
|
|
|
|
@if($activeTab === 'consuntivo')
|
|
@php
|
|
$acqua = $this->acquaSummary ?? ['voci' => [], 'totale' => 0, 'riparto_totale' => 0, 'riparto_delta' => 0];
|
|
$riparto = $this->acquaRiparto ?? ['rows' => [], 'totale' => 0];
|
|
@endphp
|
|
<div class="mt-4 overflow-hidden rounded-lg border">
|
|
<div class="bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-600">Riparto acqua (dett_tab)</div>
|
|
<div class="px-3 py-2 text-xs text-gray-600">
|
|
Totale fatture: <span class="font-semibold">€ {{ number_format((float)($acqua['totale'] ?? 0), 2, ',', '.') }}</span>
|
|
· Totale riparto: <span class="font-semibold">€ {{ number_format((float)($acqua['riparto_totale'] ?? 0), 2, ',', '.') }}</span>
|
|
· Delta: <span class="font-semibold">€ {{ number_format((float)($acqua['riparto_delta'] ?? 0), 2, ',', '.') }}</span>
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Ruolo</th>
|
|
<th class="px-3 py-2 text-left">Nominativo</th>
|
|
<th class="px-3 py-2 text-left">Scala</th>
|
|
<th class="px-3 py-2 text-left">Interno</th>
|
|
<th class="px-3 py-2 text-left">Piano</th>
|
|
<th class="px-3 py-2 text-right">Preventivo €</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($riparto['rows'] ?? []) as $row)
|
|
<tr>
|
|
<td class="px-3 py-2">{{ $row['ruolo'] }}</td>
|
|
<td class="px-3 py-2">{{ $row['nominativo'] }}</td>
|
|
<td class="px-3 py-2">{{ $row['scala'] ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $row['interno'] ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $row['piano'] ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right">{{ number_format((float)($row['prev_euro'] ?? 0), 2, ',', '.') }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="px-3 py-2 text-gray-500">Nessun dato di riparto ACQUA.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endif
|
|
|
|
|
|
<x-filament::modal id="dett-pers-modal" width="3xl">
|
|
<x-slot name="heading">Riparto personale (I05)</x-slot>
|
|
<div
|
|
class="space-y-2"
|
|
x-data
|
|
x-on:close-modal.window="if ($event.detail.id === 'dett-pers-modal' && @js(!($this->dettPersQuadraturaOk ?? true))) { alert('Riparto non quadrato: completa i valori fino a differenza 0,00 prima di uscire.'); }"
|
|
>
|
|
<div class="text-xs text-gray-500">N. spesa: {{ $this->dettPersNSpe ?? '—' }}</div>
|
|
@if(!empty($this->dettPersLegacyUnico ?? []))
|
|
<div class="text-xs text-gray-500">ID addebiti legacy (unico): {{ implode(', ', $this->dettPersLegacyUnico) }}</div>
|
|
@endif
|
|
<div class="text-xs text-gray-500">Anno riferimento legacy: {{ $this->dettPersLegacyYear ?? '0001' }}</div>
|
|
<div class="rounded-md border bg-gray-50 px-3 py-2 text-xs flex flex-wrap items-center gap-4">
|
|
<div><span class="text-gray-500">Importo spesa:</span> <span class="font-semibold">{{ number_format((float)($this->dettPersImportoOperazione ?? 0), 2, ',', '.') }}</span></div>
|
|
<div><span class="text-gray-500">Somma riparto:</span> <span class="font-semibold">{{ number_format((float)($this->dettPersTotale ?? 0), 2, ',', '.') }}</span></div>
|
|
<div><span class="text-gray-500">Differenza:</span> <span class="font-semibold">{{ number_format((float)($this->dettPersDelta ?? 0), 2, ',', '.') }}</span></div>
|
|
@if(!$this->dettPersQuadraturaOk)
|
|
<div class="text-red-600 font-semibold">Da completare</div>
|
|
@endif
|
|
</div>
|
|
<div class="grid grid-cols-1 gap-2 md:grid-cols-3">
|
|
<div>
|
|
<label class="mb-1 block text-[11px] font-medium text-gray-600">Criterio riparto</label>
|
|
<select wire:model.live="dettPersRipartoMode" class="w-full rounded-md border-gray-300 text-xs">
|
|
<option value="legacy">Importi legacy</option>
|
|
<option value="parti_uguali">Parti uguali</option>
|
|
<option value="riparto_libero">Riparto individuale (righe editabili)</option>
|
|
<option value="unita_singola">Singola unità (C/I)</option>
|
|
<option value="millesimi_tabella">Millesimi tabella</option>
|
|
</select>
|
|
</div>
|
|
@if(($this->dettPersRipartoMode ?? 'legacy') === 'unita_singola')
|
|
<div class="md:col-span-2">
|
|
<label class="mb-1 block text-[11px] font-medium text-gray-600">Unità destinataria</label>
|
|
<select wire:model.live="dettPersRipartoTarget" class="w-full rounded-md border-gray-300 text-xs">
|
|
@foreach(($this->dettPersRipartoTargetOptions ?? []) as $key => $label)
|
|
<option value="{{ $key }}">{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
@elseif(($this->dettPersRipartoMode ?? 'legacy') === 'millesimi_tabella')
|
|
<div class="md:col-span-2">
|
|
<label class="mb-1 block text-[11px] font-medium text-gray-600">Tabella millesimale</label>
|
|
<select wire:model.live="dettPersRipartoTabella" class="w-full rounded-md border-gray-300 text-xs">
|
|
@forelse(($this->dettPersRipartoTabellaOptions ?? []) as $code => $label)
|
|
<option value="{{ $code }}">{{ $label }}</option>
|
|
@empty
|
|
<option value="">Nessuna tabella disponibile</option>
|
|
@endforelse
|
|
</select>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">Soggetto</th>
|
|
<th class="px-3 py-2 text-left">Unità</th>
|
|
<th class="px-3 py-2 text-left">Tipo</th>
|
|
<th class="px-3 py-2 text-right">Importo €</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($this->dettPersRows ?? [] as $r)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">{{ $r['soggetto'] ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ $r['unita'] ?? '—' }}</td>
|
|
<td class="px-3 py-2">{{ ($r['cond_inq'] ?? '') === 'I' ? 'Inquilino' : 'Condomino' }}</td>
|
|
<td class="px-3 py-2 text-right">
|
|
@if(($this->dettPersRipartoMode ?? 'legacy') === 'riparto_libero')
|
|
<input
|
|
type="number"
|
|
step="0.01"
|
|
inputmode="decimal"
|
|
class="fi-input block w-28 text-right text-xs"
|
|
wire:model.live="dettPersRows.{{ $loop->index }}.importo"
|
|
/>
|
|
@else
|
|
{{ number_format((float)($r['importo'] ?? 0), 2, ',', '.') }}
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="4" class="px-3 py-2 text-gray-500">Nessun dettaglio.</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
@if(!empty($this->dettPersRows))
|
|
<tfoot class="bg-gray-50">
|
|
<tr>
|
|
<td colspan="3" class="px-3 py-2 text-right font-semibold">Totale</td>
|
|
<td class="px-3 py-2 text-right font-semibold">{{ number_format((float)($this->dettPersTotale ?? 0), 2, ',', '.') }}</td>
|
|
</tr>
|
|
</tfoot>
|
|
@endif
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</x-filament::modal>
|
|
|
|
<x-filament::modal id="mastrino-modal" width="5xl">
|
|
<x-slot name="heading">Mastrino: {{ $this->mastrinoTabella ?? '—' }} · {{ $this->mastrinoCodSpe ?? '—' }}</x-slot>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-xs">
|
|
<thead class="bg-white">
|
|
<tr>
|
|
<th class="px-3 py-2 text-left">ID</th>
|
|
<th class="px-3 py-2 text-left">Data</th>
|
|
<th class="px-3 py-2 text-left">Descrizione</th>
|
|
<th class="px-3 py-2 text-right">Importo €</th>
|
|
<th class="px-3 py-2 text-left">Riga origine</th>
|
|
<th class="px-3 py-2 text-left">FE</th>
|
|
<th class="px-3 py-2 text-left">RDA/RA</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($this->mastrinoRows ?? [] as $r)
|
|
<tr class="border-t">
|
|
<td class="px-3 py-2">{{ $r['id'] ?? '—' }}</td>
|
|
<td class="px-3 py-2">
|
|
@if(!empty($r['data']))
|
|
{{ \Carbon\Carbon::parse($r['data'])->format('d/m/Y') }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">{{ $r['descrizione'] ?? '—' }}</td>
|
|
<td class="px-3 py-2 text-right">{{ number_format((float)($r['importo'] ?? 0), 2, ',', '.') }}</td>
|
|
<td class="px-3 py-2">
|
|
@php
|
|
$rowUrl = \App\Filament\Pages\Gescon\Ordinarie::getUrl(panel: 'admin-filament') . '?tab=operazioni&search=' . urlencode((string) ($r['id'] ?? ''));
|
|
@endphp
|
|
@if(!empty($r['id']))
|
|
<a href="{{ $rowUrl }}" class="text-primary-700 hover:underline">#{{ $r['id'] }}</a>
|
|
@if(!empty($r['n_spe']))
|
|
<div class="text-[10px] text-gray-500">n_spe {{ $r['n_spe'] }}</div>
|
|
@endif
|
|
@if(!empty($r['tabella']))
|
|
<div class="text-[10px] text-gray-500">tab {{ $r['tabella'] }}</div>
|
|
@endif
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-2">{{ $r['fe_uid'] ?? '—' }}</td>
|
|
<td class="px-3 py-2">
|
|
<div class="text-xs">{{ $r['rif_rda'] ?? '—' }}</div>
|
|
@if(!empty($r['ra_importo']))
|
|
<div class="text-[10px] text-gray-500">RA € {{ number_format((float)$r['ra_importo'], 2, ',', '.') }}</div>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="7" class="px-3 py-2 text-gray-500">Nessun movimento.</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</x-filament::modal>
|
|
@endif
|
|
</x-filament::section>
|
|
|
|
</div>
|
|
</x-filament-panels::page>
|