Initial commit: Horux Strategy Platform
- 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>
This commit is contained in:
55
backend/app/Models/Reporte.php
Normal file
55
backend/app/Models/Reporte.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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\BelongsToMany;
|
||||
|
||||
class Reporte extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'cliente_id',
|
||||
'nombre',
|
||||
'periodo_tipo',
|
||||
'periodo_inicio',
|
||||
'periodo_fin',
|
||||
'fecha_generacion',
|
||||
'data_calculada',
|
||||
'pdf_path',
|
||||
'status',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'periodo_inicio' => 'date',
|
||||
'periodo_fin' => 'date',
|
||||
'fecha_generacion' => 'datetime',
|
||||
'data_calculada' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
public function cliente(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Cliente::class);
|
||||
}
|
||||
|
||||
public function balanzas(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Balanza::class, 'reporte_balanza');
|
||||
}
|
||||
|
||||
public function getMetrica(string $nombre): ?array
|
||||
{
|
||||
return $this->data_calculada['metricas'][$nombre] ?? null;
|
||||
}
|
||||
|
||||
public function getEstadoFinanciero(string $tipo): ?array
|
||||
{
|
||||
return $this->data_calculada['estados_financieros'][$tipo] ?? null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user