79 lines
3.3 KiB
PHP
Executable File
79 lines
3.3 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use App\Models\GestioneCondominiale;
|
|
use App\Models\TabellaMillesimale;
|
|
use App\Models\DettaglioMillesimi;
|
|
use App\Models\UnitaImmobiliare;
|
|
|
|
class ShowPianoContiData extends Command
|
|
{
|
|
protected $signature = 'piano-conti:show {--stabile=1}';
|
|
protected $description = 'Mostra i dati del Piano dei Conti e Tabelle Millesimali';
|
|
|
|
public function handle()
|
|
{
|
|
$stabile_id = $this->option('stabile');
|
|
|
|
$this->info("🏢 PIANO DEI CONTI E TABELLE MILLESIMALI - Stabile ID: {$stabile_id}");
|
|
$this->line(str_repeat('=', 70));
|
|
|
|
// Gestioni Condominiali
|
|
$gestioni = GestioneCondominiale::where('stabile_id', $stabile_id)->get();
|
|
$this->info("📋 GESTIONI CONDOMINIALI ({$gestioni->count()}):");
|
|
|
|
foreach ($gestioni as $gestione) {
|
|
$this->line(" • {$gestione->codice} - {$gestione->descrizione}");
|
|
$this->line(" Tipo: {$gestione->tipo} | Stato: {$gestione->stato}");
|
|
$this->line(" Periodo: {$gestione->data_inizio->format('d/m/Y')} - {$gestione->data_fine->format('d/m/Y')}");
|
|
$this->line("");
|
|
}
|
|
|
|
// Tabelle Millesimali
|
|
$tabelle = TabellaMillesimale::where('stabile_id', $stabile_id)->with('dettagliMillesimi')->get();
|
|
$this->info("🧮 TABELLE MILLESIMALI ({$tabelle->count()}):");
|
|
|
|
$tabelle_grouped = $tabelle->groupBy('tipo_tabella');
|
|
foreach ($tabelle_grouped as $tipo => $gruppo) {
|
|
$this->warn(" 📂 {$tipo} ({$gruppo->count()} tabelle):");
|
|
foreach ($gruppo as $tabella) {
|
|
$dettagli_count = $tabella->dettagliMillesimi->count();
|
|
$millesimi_totali = $tabella->dettagliMillesimi->sum('millesimi');
|
|
$codice = $tabella->codice_tabella ?? $tabella->nome_tabella;
|
|
$denominazione = $tabella->denominazione ?? $tabella->nome_tabella;
|
|
$this->line(" • {$codice}");
|
|
$this->line(" {$denominazione}");
|
|
$this->line(" Unità: {$dettagli_count} | Millesimi: " . number_format($millesimi_totali, 2));
|
|
}
|
|
$this->line("");
|
|
}
|
|
|
|
// Esempi di dettagli millesimi
|
|
$this->info("📊 ESEMPI DETTAGLI MILLESIMI:");
|
|
$dettagli = DettaglioMillesimi::with(['unitaImmobiliare', 'tabellaMillesimale'])
|
|
->whereHas('tabellaMillesimale', function ($q) use ($stabile_id) {
|
|
$q->where('stabile_id', $stabile_id);
|
|
})
|
|
->take(10)
|
|
->get();
|
|
|
|
foreach ($dettagli as $dettaglio) {
|
|
$unita = $dettaglio->unitaImmobiliare;
|
|
$tabella = $dettaglio->tabellaMillesimale;
|
|
$this->line(" • Scala {$unita->scala}, Interno {$unita->interno}");
|
|
$this->line(" Tabella: {$tabella->nome_tabella} = " . number_format($dettaglio->millesimi, 4) . " millesimi");
|
|
}
|
|
|
|
$this->line("");
|
|
$this->info("🌐 ACCESSO WEB:");
|
|
$this->line("Per visualizzare l'interfaccia web completa:");
|
|
$this->line("1. Accedi al sistema: http://localhost:8000/login");
|
|
$this->line("2. Vai al menu 'Piano dei Conti' nella sidebar");
|
|
$this->line("3. Oppure accedi direttamente: http://localhost:8000/piano-conti");
|
|
|
|
return 0;
|
|
}
|
|
}
|