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:
57
backend/app/Models/Umbral.php
Normal file
57
backend/app/Models/Umbral.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Umbral extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'umbrales';
|
||||
|
||||
protected $fillable = [
|
||||
'metrica',
|
||||
'muy_positivo',
|
||||
'positivo',
|
||||
'neutral',
|
||||
'negativo',
|
||||
'muy_negativo',
|
||||
'giro_id',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'muy_positivo' => 'decimal:4',
|
||||
'positivo' => 'decimal:4',
|
||||
'neutral' => 'decimal:4',
|
||||
'negativo' => 'decimal:4',
|
||||
'muy_negativo' => 'decimal:4',
|
||||
];
|
||||
}
|
||||
|
||||
public function giro(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Giro::class);
|
||||
}
|
||||
|
||||
public function evaluarValor(float $valor): string
|
||||
{
|
||||
if ($this->muy_positivo !== null && $valor >= $this->muy_positivo) {
|
||||
return 'muy_positivo';
|
||||
}
|
||||
if ($this->positivo !== null && $valor >= $this->positivo) {
|
||||
return 'positivo';
|
||||
}
|
||||
if ($this->neutral !== null && $valor >= $this->neutral) {
|
||||
return 'neutral';
|
||||
}
|
||||
if ($this->negativo !== null && $valor >= $this->negativo) {
|
||||
return 'negativo';
|
||||
}
|
||||
return 'muy_negativo';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user