From 1bb9fa0548fbde67f51076325059be0c99cefa32 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Thu, 29 Jan 2026 23:28:33 -0500 Subject: [PATCH] up --- app/Filament/Resources/OjalPresillaResource.php | 8 ++++---- app/Models/Ojal.php | 4 ++-- app/Models/Prensilla.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Filament/Resources/OjalPresillaResource.php b/app/Filament/Resources/OjalPresillaResource.php index c3b23cd..004307e 100644 --- a/app/Filament/Resources/OjalPresillaResource.php +++ b/app/Filament/Resources/OjalPresillaResource.php @@ -39,8 +39,8 @@ class OjalPresillaResource extends Resource })->get()->mapWithKeys(function ($op) { // Calcular cantidad disponible desde confecciones (recibidas - arreglos - cobros) $cantidadRecibida = $op->confecciones->sum('cantidad_recibida'); - $arreglos = \App\Models\Ajuste::where('ajustable_type', \App\Models\Confeccion::class) - ->whereHas('ajustable', function($q) use ($op) { + $arreglos = \App\Models\Ajuste::where('referencia_type', \App\Models\Confeccion::class) + ->whereHas('referencia', function($q) use ($op) { $q->where('orden_produccion_id', $op->id); })->where('tipo', 'arreglo')->sum('cantidad'); $cobros = \App\Models\Cobro::where('cobreable_type', \App\Models\Confeccion::class) @@ -72,8 +72,8 @@ class OjalPresillaResource extends Resource if ($op) { // Calcular cantidad disponible (confecciones - arreglos - cobros - ojales ya enviados) $cantidadRecibida = $op->confecciones->sum('cantidad_recibida'); - $arreglos = \App\Models\Ajuste::where('ajustable_type', \App\Models\Confeccion::class) - ->whereHas('ajustable', function($q) use ($state) { + $arreglos = \App\Models\Ajuste::where('referencia_type', \App\Models\Confeccion::class) + ->whereHas('referencia', function($q) use ($state) { $q->where('orden_produccion_id', $state); })->where('tipo', 'arreglo')->sum('cantidad'); $cobros = \App\Models\Cobro::where('cobreable_type', \App\Models\Confeccion::class) diff --git a/app/Models/Ojal.php b/app/Models/Ojal.php index 8bba881..489fda2 100644 --- a/app/Models/Ojal.php +++ b/app/Models/Ojal.php @@ -42,8 +42,8 @@ class Ojal extends Model $opId = $p->orden_produccion_id; $totalRecibido = \App\Models\Confeccion::where('orden_produccion_id', $opId) ->sum(\DB::raw('COALESCE(cantidad_recibida, 0)')); - $totalArreglos = \App\Models\Ajuste::where('ajustable_type', \App\Models\Confeccion::class) - ->whereHas('ajustable', function($q) use ($opId) { + $totalArreglos = \App\Models\Ajuste::where('referencia_type', \App\Models\Confeccion::class) + ->whereHas('referencia', function($q) use ($opId) { $q->where('orden_produccion_id', $opId); })->where('tipo', 'arreglo')->sum('cantidad'); $totalCobros = \App\Models\Cobro::where('cobreable_type', \App\Models\Confeccion::class) diff --git a/app/Models/Prensilla.php b/app/Models/Prensilla.php index 18b02e6..39c9cc9 100644 --- a/app/Models/Prensilla.php +++ b/app/Models/Prensilla.php @@ -40,8 +40,8 @@ class Prensilla extends Model $opId = $p->orden_produccion_id; $totalRecibido = \App\Models\Confeccion::where('orden_produccion_id', $opId) ->sum(\DB::raw('COALESCE(cantidad_recibida, 0)')); - $totalArreglos = \App\Models\Ajuste::where('ajustable_type', \App\Models\Confeccion::class) - ->whereHas('ajustable', function($q) use ($opId) { + $totalArreglos = \App\Models\Ajuste::where('referencia_type', \App\Models\Confeccion::class) + ->whereHas('referencia', function($q) use ($opId) { $q->where('orden_produccion_id', $opId); })->where('tipo', 'arreglo')->sum('cantidad'); $totalCobros = \App\Models\Cobro::where('cobreable_type', \App\Models\Confeccion::class)