[firebase-br] Como fazer estah procedure

Wayder Loyola wayderloyola em gmail.com
Seg Ago 25 11:49:19 -03 2008


Caros colegas,

Estou tendo difilcudade para transforma essa rotina de atualização de saldo,
que estah escrita para acesso a tabela PARADOX
para uma stored procedure em FB.

Obrigado,

Wayder Loyola

procedure TDM2.AtualizaSldoCxa(CxaCodigo:Integer);
var
   xSldo : Extended;
   PrevRecord : TBookmark;
begin
  PrevRecord := cdsMovCxa.GetBookmark;
  try
     with cdsMovCxa do begin
          DisableControls;
          Prior;
          xSldo := 0;
          if not BOF then begin
             xSldo := FieldByName('SLDO_ATUAL').AsFloat;
             Next;
          end else begin
              xSldo := cdsCaixa.FieldByName('SLDO_INICIAL').AsFloat;
          end;
          while not EOF do begin
                xSldo := xSldo + FieldByName('VALOR_CR').AsFloat -
FieldByName('VALOR_DB').AsFloat;
                Edit;
                FieldByName('SLDO_ATUAL').AsFloat := xSldo;
                Next;
          end;
     end;
     with cdsCaixa do begin
          while not EOF do begin
                if FieldByName('CAIXA').AsInteger = CxaCodigo then begin
                  Edit;
                  FieldByName('SLDO_ATUAL').AsFloat := xSldo;
                  Post;
                end;
                Next;
          end;
     end;
  finally
     cdsMovCxa.EnableControls;
     if PrevRecord <> nil then
     begin
       cdsMovCxa.GoToBookmark(PrevRecord);
       cdsMovCxa.FreeBookmark(PrevRecord);
     end;
  end;
end;



Mais detalhes sobre a lista de discussão lista