This commit is contained in:
Lizandro Guarnizo
2026-01-29 23:28:33 -05:00
parent 07c54f6bca
commit 1bb9fa0548
3 changed files with 8 additions and 8 deletions
@@ -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)