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
+1 -1
View File
@@ -81,7 +81,7 @@ class Confeccion extends Model
// Total recibido calculado desde recepciones (fuente de la verdad)
public function getRecibidoTotalAttribute()
{
return (int) $this->recepciones()->sum('cantidad');
return (int) $this->recepciones()->sum(\DB::raw('cantidad - COALESCE(prendas_defectuosas, 0)'));
}
// Cuantas faltan por recibir (usa la suma real de recepciones)