This commit is contained in:
lizandrogd
2026-01-19 20:05:07 -05:00
parent 1eb41c5725
commit 132b266948
7 changed files with 35 additions and 12 deletions
@@ -110,7 +110,7 @@ class ConfeccionResource extends Resource
$total = \App\Models\Recepcion::where('referencia_type', \App\Models\Confeccion::class)
->where('referencia_id', $id)
->sum('cantidad');
->sum(\DB::raw('cantidad - COALESCE(prendas_defectuosas, 0)'));
$enviada = (int) ($get('cantidad_enviada') ?? 0);
$faltan = max(0, $enviada - $total);