up
This commit is contained in:
+12
-12
@@ -55,18 +55,6 @@ class Tintoreria extends Model
|
||||
}
|
||||
});
|
||||
|
||||
/* Recepciones polimórficas */
|
||||
public function recepciones()
|
||||
{
|
||||
return $this->morphMany(\App\Models\Recepcion::class, 'referencia');
|
||||
}
|
||||
|
||||
// Cuantas faltan por recibir
|
||||
public function getFaltantesAttribute()
|
||||
{
|
||||
return max(0, (int)($this->cantidad_enviada ?? 0) - (int)($this->cantidad_recibida ?? 0));
|
||||
}
|
||||
|
||||
// Avanzar OP al cerrar el paso o cuando se complete
|
||||
static::saved(function ($tintoreria) {
|
||||
if ($tintoreria->fecha_recepcion && $tintoreria->cantidad_recibida !== null) {
|
||||
@@ -74,4 +62,16 @@ class Tintoreria extends Model
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Recepciones polimórficas */
|
||||
public function recepciones()
|
||||
{
|
||||
return $this->morphMany(\App\Models\Recepcion::class, 'referencia');
|
||||
}
|
||||
|
||||
// Cuantas faltan por recibir
|
||||
public function getFaltantesAttribute()
|
||||
{
|
||||
return max(0, (int)($this->cantidad_enviada ?? 0) - (int)($this->cantidad_recibida ?? 0));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user