Query depende da ordem da digitacao

Delphi

25/06/2005

Olá a todos,

Estou com um novo problema, e gostaria se pudessem me ajudar a resolver esta questão.
BD: Paradox

Estou usando a seguinte sequencia:

procedure TCadProdutos.DBEdit5Exit(Sender: TObject);
var
FValorTotal : Currency;
begin
FValorTotal := 0;
with ItemsGrid.DataSource.Dataset do begin
First;
While not EOF do begin
FValorTotal := FValorTotal + ItemsGrid.Columns[4].Field.value;

DMDados.ItemsProd.Open;
DMDados.ItemsProd.Edit;

DMDados.ItemsProdExtPrice.Value := DMDados.ItemsProdQty.Value * (DMDados.ItemsProdSellPrice.Value);
DMDados.Parts.Open;
DMDados.Parts.Edit;
DMDados.PartsCost.Value := (FValorTotal) ;
Next;
end;
end;

e o resultado pode variar tal como:

Uso um edit para digitar e um dbgrid para mostrar o resultado
Digito:

Digito os Registros na sequencia:

CAMPO QTD VALOR RESULTADO

PECAS1 10 1,00 10,00
PECAS2 20 2,00 40,00
PECAS3 30 3,00 90,00
Total: 130,00

-----

CAMPO QTD VALOR RESULTADO

PECAS3 30 3,00 90,00
PECAS2 20 2,00 40,00
PECAS1 10 1,00 10,00
Total: 130,00

------

CAMPO QTD VALOR RESULTADO

PECAS1 10 1,00 10,00
PECAS3 30 3,00 90,00
PECAS2 20 2,00 40,00
Total: 100,00

Alguem pode me ajudar
desde já agradeço a atenção

Um abraço
Naelson


Naelson

Naelson

Curtidas 0

Respostas

Sremulador

Sremulador

25/06/2005

você poderia explicar melhor!


GOSTEI 0
Naelson

Naelson

25/06/2005

Olá a todos, Estou com um novo problema, e gostaria se pudessem me ajudar a resolver esta questão. BD: Paradox Estou usando a seguinte sequencia: procedure TCadProdutos.DBEdit5Exit(Sender: TObject); var FValorTotal : Currency; begin FValorTotal := 0; with ItemsGrid.DataSource.Dataset do begin First; While not EOF do begin FValorTotal := FValorTotal + ItemsGrid.Columns[4].Field.value; DMDados.ItemsProd.Open; DMDados.ItemsProd.Edit; DMDados.ItemsProdExtPrice.Value := DMDados.ItemsProdQty.Value * (DMDados.ItemsProdSellPrice.Value); DMDados.Parts.Open; DMDados.Parts.Edit; DMDados.PartsCost.Value := (FValorTotal) ; Next; end; end; e o resultado pode variar tal como: Uso um edit para digitar e um dbgrid para mostrar o resultado Digito: Digito os Registros na sequencia: CAMPO QTD VALOR RESULTADO PECAS1 10 1,00 10,00 PECAS2 20 2,00 40,00 PECAS3 30 3,00 90,00 Total: 130,00 ----- CAMPO QTD VALOR RESULTADO PECAS3 30 3,00 90,00 PECAS2 20 2,00 40,00 PECAS1 10 1,00 10,00 Total: 130,00 ------ CAMPO QTD VALOR RESULTADO PECAS1 10 1,00 10,00 PECAS3 30 3,00 90,00 PECAS2 20 2,00 40,00 Total: 100,00 Alguem pode me ajudar desde já agradeço a atenção Um abraço Naelson


Me desculpe sremulador,
de tanto tentar consegui resolver, obrigado pela atenção.
Naelson


GOSTEI 0
POSTAR