falta que se actualize numProducto y los infomes
This commit is contained in:
@@ -80,5 +80,29 @@ namespace Modelo
|
||||
|
||||
return ret;
|
||||
}
|
||||
public bool DisminuirStock(DetalleFactura detalleFactura)
|
||||
{
|
||||
bool ret = false;
|
||||
while (detalleFactura.Cantidad >= 0)
|
||||
{
|
||||
var elementoAdisminuir = almacen.Where(x=> x.Habilitado == true)
|
||||
.First(x => x.Producto.Id == detalleFactura.Producto.Id);
|
||||
|
||||
detalleFactura.Cantidad -= elementoAdisminuir.Cantidad;
|
||||
|
||||
if (detalleFactura.Cantidad > 0)
|
||||
{
|
||||
elementoAdisminuir.Cantidad = 0;
|
||||
elementoAdisminuir.Habilitado = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
elementoAdisminuir.Cantidad = -detalleFactura.Cantidad;
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user