68 lines
1.7 KiB
PHP
68 lines
1.7 KiB
PHP
<?php
|
|
namespace App\Modules\Contabilita\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class FatturaFornitoreRiga extends Model
|
|
{
|
|
protected $table = 'contabilita_fatture_fornitori_righe';
|
|
|
|
protected $fillable = [
|
|
'fattura_id',
|
|
'product_id',
|
|
'riga',
|
|
'descrizione',
|
|
'imponibile_euro',
|
|
'iva_euro',
|
|
'totale_euro',
|
|
'aliquota_iva',
|
|
'conto_costo_id',
|
|
'voce_spesa_id',
|
|
'gestione_id',
|
|
'percentuale_riparto',
|
|
'tabella_millesimale_id',
|
|
'legacy_cod_spe',
|
|
'legacy_n_spe',
|
|
];
|
|
|
|
protected $casts = [
|
|
'imponibile_euro' => 'decimal:2',
|
|
'iva_euro' => 'decimal:2',
|
|
'totale_euro' => 'decimal:2',
|
|
'aliquota_iva' => 'decimal:2',
|
|
'percentuale_riparto' => 'decimal:2',
|
|
'legacy_n_spe' => 'integer',
|
|
];
|
|
|
|
public function fattura(): BelongsTo
|
|
{
|
|
return $this->belongsTo(FatturaFornitore::class, 'fattura_id');
|
|
}
|
|
|
|
public function product(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\Product::class, 'product_id');
|
|
}
|
|
|
|
public function contoCosto(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PianoConti::class, 'conto_costo_id');
|
|
}
|
|
|
|
public function tabellaMillesimale(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\TabellaMillesimale::class, 'tabella_millesimale_id');
|
|
}
|
|
|
|
public function voceSpesa(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\VoceSpesa::class, 'voce_spesa_id');
|
|
}
|
|
|
|
public function gestione(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\GestioneContabile::class, 'gestione_id');
|
|
}
|
|
}
|