72 lines
1.7 KiB
PHP
72 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class FatturaElettronica extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'fatture_elettroniche';
|
|
|
|
protected $fillable = [
|
|
'stabile_id',
|
|
'fornitore_id',
|
|
'registrazione_contabile_id',
|
|
'sdi_file',
|
|
'numero_fattura',
|
|
'data_fattura',
|
|
'data_scadenza',
|
|
'pagamento_modalita',
|
|
'pagamento_iban',
|
|
'pagamento_bic',
|
|
'fornitore_piva',
|
|
'fornitore_cf',
|
|
'fornitore_denominazione',
|
|
'imponibile',
|
|
'iva',
|
|
'totale',
|
|
'consumo_valore',
|
|
'consumo_unita',
|
|
'consumo_riferimento',
|
|
'consumo_raw',
|
|
'codice_destinatario',
|
|
'pec_destinatario',
|
|
'destinatario_cf',
|
|
'destinatario_denominazione',
|
|
'stato',
|
|
'xml_content',
|
|
'nome_file_xml',
|
|
'nome_file_p7m',
|
|
'p7m_path',
|
|
'xml_path',
|
|
'allegato_pdf_nome',
|
|
'allegato_pdf_mime',
|
|
'allegato_pdf_path',
|
|
'allegato_pdf_hash',
|
|
'xml_hash',
|
|
];
|
|
|
|
protected $casts = [
|
|
'data_fattura' => 'date',
|
|
'data_scadenza' => 'date',
|
|
'imponibile' => 'decimal:2',
|
|
'iva' => 'decimal:2',
|
|
'totale' => 'decimal:2',
|
|
'consumo_valore' => 'decimal:3',
|
|
];
|
|
|
|
public function stabile(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Stabile::class, 'stabile_id');
|
|
}
|
|
|
|
public function fornitore(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Fornitore::class, 'fornitore_id');
|
|
}
|
|
}
|