- Laravel 11 backend with API REST - React 18 + TypeScript + Vite frontend - Multi-parser architecture for accounting systems (CONTPAQi, Aspel, SAP) - 27+ financial metrics calculation - PDF report generation with Browsershot - Complete documentation (10 documents) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class Balanza extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'cliente_id',
|
|
'periodo_inicio',
|
|
'periodo_fin',
|
|
'sistema_origen',
|
|
'archivo_original',
|
|
'status',
|
|
'error_mensaje',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'periodo_inicio' => 'date',
|
|
'periodo_fin' => 'date',
|
|
];
|
|
}
|
|
|
|
public function cliente(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Cliente::class);
|
|
}
|
|
|
|
public function cuentas(): HasMany
|
|
{
|
|
return $this->hasMany(Cuenta::class);
|
|
}
|
|
|
|
public function reportes(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Reporte::class, 'reporte_balanza');
|
|
}
|
|
|
|
public function cuentasActivas(): HasMany
|
|
{
|
|
return $this->hasMany(Cuenta::class)->where('excluida', false);
|
|
}
|
|
|
|
public function cuentasPadre(): HasMany
|
|
{
|
|
return $this->hasMany(Cuenta::class)->where('es_cuenta_padre', true);
|
|
}
|
|
}
|