buen dia ya encontre la solucion que fue esta
Código:
var
C,A,res,x, Valor:REAL;
flg : boolean;
begin
a:=StrToFloat(cantidad);
flg := False;
ADOQuery1.First;
While not adoquery1.eof do
begin
b:=StrToFloat(ADOQUERY1.FieldByName('pendiente').Value);
if (a > b) then
Valor := 0
else
if a>0 then
begin
Valor := b-a;
flg := True;
end;
a := a-b;
ABONO.Close;
ABONO.SQL.Clear;
ABONO.SQL.Add('UPDATE FACTURA SET PENDIENTE=:VALOR WHERE NUMVENTA=:NUMVENTA');
ABONO.Parameters.ParamByName('NUMVENTA').Value:=ADOQuery1.Fields.FieldByNumber(1).Value;
ABONO.Parameters.ParamByName('valor').Value:=valor;
ABONO.ExecSQL;
if Not flg then
adoquery1.next
else
break;
end;
end;
el codigo lo saque de este post
clubdelphi.com/foros/showthread.php?t=74911
muchas gracias por su ayuda
espero no romper alguna regla del foro.