Ver Mensaje Individual
  #2  
Antiguo 14-12-2017
Avatar de The Cid James
The Cid James The Cid James is offline
Miembro
NULL
 
Registrado: jun 2013
Posts: 129
Reputación: 11
The Cid James Va por buen camino
Al final lo resolví con dos radio button de la siguiente manera por no encontrar el erro

Código Delphi [-]
procedure Tfstock.Button1Click(Sender: TObject);
begin
  fmodulo.tProductos.Active := true;
  if rbsumar.Checked = true
    then
      begin
      if fmodulo.tProductos.Locate('id_producto', fmodulo.qProductos['id_producto'], [])
        then
          begin
            fmodulo.qProductos.Active := true;
            fmodulo.tProductos.Edit;
            idproducto := 0;
            idproducto := StrToInt(Esumrest.text);
            fmodulo.tProductos.Fields.FieldByName('Stock').AsInteger := fmodulo.qProductos.Fields.FieldByName('Stock').AsInteger + idproducto;
            fmodulo.tProductos.Post;
            fmodulo.qProductos.Refresh;
          end;
      end
  else
    if RBrestar.Checked = true
      then
        if fmodulo.tProductos.Locate('id_producto', fmodulo.qProductos['id_producto'], [])
        then
          begin
            fmodulo.qProductos.Active := true;
            fmodulo.tProductos.Edit;
            idproducto := 0;
            idproducto := StrToInt(Esumrest.text);
            fmodulo.tProductos.Fields.FieldByName('Stock').AsInteger := fmodulo.qProductos.Fields.FieldByName('Stock').AsInteger - idproducto;
            fmodulo.tProductos.Post;
            fmodulo.qProductos.Refresh;
          end;

end;
__________________
We are told to remember the idea, not the man, because a man can fail. He can be caught, he can be killed and forgotten, but 400 years later, an idea can still change the world.
Responder Con Cita