90 lines
2.2 KiB
PHP
90 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Modules\Contabilita\Models\MovimentoBanca;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class OperazioneContabile extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'operazioni_contabili';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'gestione_id',
|
|
'fornitore_id',
|
|
'voce_spesa_id',
|
|
'conto_bancario_id',
|
|
'cassa_id',
|
|
'legacy_id',
|
|
'cod_spe',
|
|
'tabella',
|
|
'cod_for',
|
|
'descrizione',
|
|
'compet',
|
|
'natura2',
|
|
'n_stra',
|
|
'protocollo_numero',
|
|
'protocollo_completo',
|
|
'num_fat',
|
|
'dt_fat',
|
|
'rif_rda',
|
|
'ritenuta_acconto_id',
|
|
'fattura_elettronica_id',
|
|
'fe_fattura_id',
|
|
'movimento_bancario_id',
|
|
'dare',
|
|
'avere',
|
|
'conto_contabile',
|
|
'stato_operazione',
|
|
'data_competenza',
|
|
'data_operazione',
|
|
'voce_spesa_snapshot',
|
|
'fornitore_snapshot',
|
|
'modificato_da_user_id',
|
|
'modificato_il',
|
|
'motivo_modifica',
|
|
'storico_modifiche',
|
|
];
|
|
|
|
protected $casts = [
|
|
'dare' => 'decimal:4',
|
|
'avere' => 'decimal:4',
|
|
'data_operazione' => 'date',
|
|
'data_competenza' => 'date',
|
|
'dt_fat' => 'date',
|
|
'voce_spesa_snapshot' => 'array',
|
|
'fornitore_snapshot' => 'array',
|
|
'storico_modifiche' => 'array',
|
|
];
|
|
|
|
public function gestione(): BelongsTo
|
|
{
|
|
return $this->belongsTo(GestioneContabile::class, 'gestione_id');
|
|
}
|
|
|
|
public function fornitore(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Fornitore::class, 'fornitore_id');
|
|
}
|
|
|
|
public function voceSpesa(): BelongsTo
|
|
{
|
|
return $this->belongsTo(VoceSpesa::class, 'voce_spesa_id');
|
|
}
|
|
|
|
public function movimentoBancario(): BelongsTo
|
|
{
|
|
return $this->belongsTo(MovimentoBanca::class, 'movimento_bancario_id');
|
|
}
|
|
|
|
public function contoBancario(): BelongsTo
|
|
{
|
|
return $this->belongsTo(DatiBancari::class, 'conto_bancario_id');
|
|
}
|
|
}
|