sintaxe
Não estou sabendo atribuir o valor a variavel corretamente, de uma olhada no código abaixo e me de uma ajuda..obrigado.
[
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a,b,c,d,e,f,g,h:Integer; begin
inherited; a:=1 or 50; b:=51 or 100;
c:=101 or 200;
d:=201 or 300;
e:=301 or 400; ----> ESTÁ ERRADO AQUI COMO A VARIÁVEL RECEBE... EXEMPLO: A:= DE 1 A 50; B:=DE 51 A 100
f:=401 or 500;
g:=501 or 600;---> qual uso para Exemplo a:=de 1 a 50;
h:=601 or 750;
for a:=1 to 50 do
if Dm.ReqCAPATC.Value=a then
begin
Dm.ReqCAPVALOR_TX.Value:= 2*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(b) then
begin
Dm.ReqCAPVALOR_TX.Value:= 3*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(c) then
begin
Dm.ReqCAPVALOR_TX.Value:= 4*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(d) then
begin
Dm.ReqCAPVALOR_TX.Value:= 5*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(e) then
begin
Dm.ReqCAPVALOR_TX.Value:= 6*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(f) then
begin
Dm.ReqCAPVALOR_TX.Value:= 7*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(g) then
begin
Dm.ReqCAPVALOR_TX.Value:= 8*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(h) then
begin
Dm.ReqCAPVALOR_TX.Value:= 9*Dm.ReqCAPUFR.Value;
end
else
if EdtTaxa.Text>'750' then
begin
Dm.ReqCAPVALOR_TX.Value:= Dm.ReqCAPUFR.Value*dm.ReqCAPATC.Value*0.02;
end;]
var a,b,c,d,e,f,g,h:Integer; begin
inherited; a:=1 or 50; b:=51 or 100;
c:=101 or 200;
d:=201 or 300;
e:=301 or 400; ----> ESTÁ ERRADO AQUI COMO A VARIÁVEL RECEBE... EXEMPLO: A:= DE 1 A 50; B:=DE 51 A 100
f:=401 or 500;
g:=501 or 600;---> qual uso para Exemplo a:=de 1 a 50;
h:=601 or 750;
for a:=1 to 50 do
if Dm.ReqCAPATC.Value=a then
begin
Dm.ReqCAPVALOR_TX.Value:= 2*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(b) then
begin
Dm.ReqCAPVALOR_TX.Value:= 3*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(c) then
begin
Dm.ReqCAPVALOR_TX.Value:= 4*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(d) then
begin
Dm.ReqCAPVALOR_TX.Value:= 5*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(e) then
begin
Dm.ReqCAPVALOR_TX.Value:= 6*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(f) then
begin
Dm.ReqCAPVALOR_TX.Value:= 7*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(g) then
begin
Dm.ReqCAPVALOR_TX.Value:= 8*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(h) then
begin
Dm.ReqCAPVALOR_TX.Value:= 9*Dm.ReqCAPUFR.Value;
end
else
if EdtTaxa.Text>'750' then
begin
Dm.ReqCAPVALOR_TX.Value:= Dm.ReqCAPUFR.Value*dm.ReqCAPATC.Value*0.02;
end;]
Benilton
Curtidas 0
Respostas
Ricardo Araujo
15/04/2010
boa tarde,
colega não conseguir entender o que esta querendo pode detalhar mais?
msn: rbbarreto@hotmail.com
colega não conseguir entender o que esta querendo pode detalhar mais?
msn: rbbarreto@hotmail.com
GOSTEI 0
Benilton
15/04/2010
quero que a variavel a:= de 1 a 50; e não sei como fazer
assim não é a:=1 or 50;
Não estou sabendo atribuir o valor a variavel corretamente, de uma olhada no código abaixo e me de uma ajuda..obrigado.
[
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a,b,c,d,e,f,g,h:Integer; begin
inherited; a:=1 or 50; b:=51 or 100;
c:=101 or 200;
d:=201 or 300;
e:=301 or 400; ----> ESTÁ ERRADO AQUI COMO A VARIÁVEL RECEBE... EXEMPLO: A:= DE 1 A 50; B:=DE 51 A 100
f:=401 or 500;
g:=501 or 600;---> qual uso para Exemplo a:=de 1 a 50;
h:=601 or 750;
for a:=1 to 50 do
if Dm.ReqCAPATC.Value=a then
begin
Dm.ReqCAPVALOR_TX.Value:= 2*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(b) then
begin
Dm.ReqCAPVALOR_TX.Value:= 3*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(c) then
begin
Dm.ReqCAPVALOR_TX.Value:= 4*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(d) then
begin
Dm.ReqCAPVALOR_TX.Value:= 5*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(e) then
begin
Dm.ReqCAPVALOR_TX.Value:= 6*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(f) then
begin
Dm.ReqCAPVALOR_TX.Value:= 7*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(g) then
begin
Dm.ReqCAPVALOR_TX.Value:= 8*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(h) then
begin
Dm.ReqCAPVALOR_TX.Value:= 9*Dm.ReqCAPUFR.Value;
end
else
if EdtTaxa.Text>'750' then
begin
Dm.ReqCAPVALOR_TX.Value:= Dm.ReqCAPUFR.Value*dm.ReqCAPATC.Value*0.02;
end;]
var a,b,c,d,e,f,g,h:Integer; begin
inherited; a:=1 or 50; b:=51 or 100;
c:=101 or 200;
d:=201 or 300;
e:=301 or 400; ----> ESTÁ ERRADO AQUI COMO A VARIÁVEL RECEBE... EXEMPLO: A:= DE 1 A 50; B:=DE 51 A 100
f:=401 or 500;
g:=501 or 600;---> qual uso para Exemplo a:=de 1 a 50;
h:=601 or 750;
for a:=1 to 50 do
if Dm.ReqCAPATC.Value=a then
begin
Dm.ReqCAPVALOR_TX.Value:= 2*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(b) then
begin
Dm.ReqCAPVALOR_TX.Value:= 3*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(c) then
begin
Dm.ReqCAPVALOR_TX.Value:= 4*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(d) then
begin
Dm.ReqCAPVALOR_TX.Value:= 5*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(e) then
begin
Dm.ReqCAPVALOR_TX.Value:= 6*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(f) then
begin
Dm.ReqCAPVALOR_TX.Value:= 7*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(g) then
begin
Dm.ReqCAPVALOR_TX.Value:= 8*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(h) then
begin
Dm.ReqCAPVALOR_TX.Value:= 9*Dm.ReqCAPUFR.Value;
end
else
if EdtTaxa.Text>'750' then
begin
Dm.ReqCAPVALOR_TX.Value:= Dm.ReqCAPUFR.Value*dm.ReqCAPATC.Value*0.02;
end;]
GOSTEI 0
Benilton
15/04/2010
quero que a variavel a:= de 1 a 50; e não sei como fazer
assim não é a:=1 or 50;
Não estou sabendo atribuir o valor a variavel corretamente, de uma olhada no código abaixo e me de uma ajuda..obrigado.
[
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a,b,c,d,e,f,g,h:Integer; begin
inherited; a:=1 or 50; b:=51 or 100;
c:=101 or 200;
d:=201 or 300;
e:=301 or 400; ----> ESTÁ ERRADO AQUI COMO A VARIÁVEL RECEBE... EXEMPLO: A:= DE 1 A 50; B:=DE 51 A 100
f:=401 or 500;
g:=501 or 600;---> qual uso para Exemplo a:=de 1 a 50;
h:=601 or 750;
for a:=1 to 50 do
if Dm.ReqCAPATC.Value=a then
begin
Dm.ReqCAPVALOR_TX.Value:= 2*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(b) then
begin
Dm.ReqCAPVALOR_TX.Value:= 3*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(c) then
begin
Dm.ReqCAPVALOR_TX.Value:= 4*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(d) then
begin
Dm.ReqCAPVALOR_TX.Value:= 5*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(e) then
begin
Dm.ReqCAPVALOR_TX.Value:= 6*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(f) then
begin
Dm.ReqCAPVALOR_TX.Value:= 7*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(g) then
begin
Dm.ReqCAPVALOR_TX.Value:= 8*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(h) then
begin
Dm.ReqCAPVALOR_TX.Value:= 9*Dm.ReqCAPUFR.Value;
end
else
if EdtTaxa.Text>'750' then
begin
Dm.ReqCAPVALOR_TX.Value:= Dm.ReqCAPUFR.Value*dm.ReqCAPATC.Value*0.02;
end;]
var a,b,c,d,e,f,g,h:Integer; begin
inherited; a:=1 or 50; b:=51 or 100;
c:=101 or 200;
d:=201 or 300;
e:=301 or 400; ----> ESTÁ ERRADO AQUI COMO A VARIÁVEL RECEBE... EXEMPLO: A:= DE 1 A 50; B:=DE 51 A 100
f:=401 or 500;
g:=501 or 600;---> qual uso para Exemplo a:=de 1 a 50;
h:=601 or 750;
for a:=1 to 50 do
if Dm.ReqCAPATC.Value=a then
begin
Dm.ReqCAPVALOR_TX.Value:= 2*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(b) then
begin
Dm.ReqCAPVALOR_TX.Value:= 3*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(c) then
begin
Dm.ReqCAPVALOR_TX.Value:= 4*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(d) then
begin
Dm.ReqCAPVALOR_TX.Value:= 5*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(e) then
begin
Dm.ReqCAPVALOR_TX.Value:= 6*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(f) then
begin
Dm.ReqCAPVALOR_TX.Value:= 7*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(g) then
begin
Dm.ReqCAPVALOR_TX.Value:= 8*Dm.ReqCAPUFR.Value;
end; if EdtTaxa.Text=IntToStr(h) then
begin
Dm.ReqCAPVALOR_TX.Value:= 9*Dm.ReqCAPUFR.Value;
end
else
if EdtTaxa.Text>'750' then
begin
Dm.ReqCAPVALOR_TX.Value:= Dm.ReqCAPUFR.Value*dm.ReqCAPATC.Value*0.02;
end;]
GOSTEI 0
Emerson Nascimento
15/04/2010
rapaz....
explique o que você precisa fazer pois, sinceramente, não entendi seu código...
explique o que você precisa fazer pois, sinceramente, não entendi seu código...
GOSTEI 0
Benilton
15/04/2010
boa tarde,
colega não conseguir entender o que esta querendo pode detalhar mais?
msn: rbbarreto@hotmail.com quero que a variavel a:= de 1 a 50; e não sei como fazer coloquei assim mais não está correto a:=1 or 50;
colega não conseguir entender o que esta querendo pode detalhar mais?
msn: rbbarreto@hotmail.com quero que a variavel a:= de 1 a 50; e não sei como fazer coloquei assim mais não está correto a:=1 or 50;
GOSTEI 0
Emerson Nascimento
15/04/2010
se eu entendi direito...
pode ser assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
begin
inherited;
case StrToInt(EdtTaxa.Text) of
1..50: Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat;
51..100: Dm.ReqCAPVALOR_TX.AsFloat := 3 * Dm.ReqCAPUFR.AsFloat;
101..200: Dm.ReqCAPVALOR_TX.AsFloat := 4 * Dm.ReqCAPUFR.AsFloat;
201..300: Dm.ReqCAPVALOR_TX.AsFloat := 5 * Dm.ReqCAPUFR.AsFloat;
301..400: Dm.ReqCAPVALOR_TX.AsFloat := 6 * Dm.ReqCAPUFR.AsFloat;
401..500: Dm.ReqCAPVALOR_TX.AsFloat := 7 * Dm.ReqCAPUFR.AsFloat;
501..600: Dm.ReqCAPVALOR_TX.AsFloat := 8 * Dm.ReqCAPUFR.AsFloat;
601..750: Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat;
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * dm.ReqCAPATC.Value * 0.02;
end;
end;
ou assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a: integer;
begin
inherited;
a := StrToInt(EdtTaxa.Text);
if a < 51 then
Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat
else
if a < 101 then
Dm.ReqCAPVALOR_TX.AsFloat := 3 * Dm.ReqCAPUFR.AsFloat
else
if a < 201 then
Dm.ReqCAPVALOR_TX.AsFloat := 4 * Dm.ReqCAPUFR.AsFloat
else
if a < 301 then
Dm.ReqCAPVALOR_TX.AsFloat := 5 * Dm.ReqCAPUFR.AsFloat
else
if a < 401 then
Dm.ReqCAPVALOR_TX.AsFloat := 6 * Dm.ReqCAPUFR.AsFloat
else
if a < 501 then
Dm.ReqCAPVALOR_TX.AsFloat := 7 * Dm.ReqCAPUFR.AsFloat
else
if a < 601 then
Dm.ReqCAPVALOR_TX.AsFloat := 8 * Dm.ReqCAPUFR.AsFloat
else
if a < 751 then
Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * Dm.ReqCAPATC.Value * 0.02;
end;
ou ainda, assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a, mult: integer;
begin
inherited;
a := StrToInt(EdtTaxa.Text);
mult := StrToInt(formatfloat('000', a+99)[1])+2;
if a < 51 then
Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat
else
if a < 601 then
Dm.ReqCAPVALOR_TX.AsFloat := mult * Dm.ReqCAPUFR.AsFloat
else
if a < 751 then
Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * Dm.ReqCAPATC.Value * 0.02;
end;
pode ser assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
begin
inherited;
case StrToInt(EdtTaxa.Text) of
1..50: Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat;
51..100: Dm.ReqCAPVALOR_TX.AsFloat := 3 * Dm.ReqCAPUFR.AsFloat;
101..200: Dm.ReqCAPVALOR_TX.AsFloat := 4 * Dm.ReqCAPUFR.AsFloat;
201..300: Dm.ReqCAPVALOR_TX.AsFloat := 5 * Dm.ReqCAPUFR.AsFloat;
301..400: Dm.ReqCAPVALOR_TX.AsFloat := 6 * Dm.ReqCAPUFR.AsFloat;
401..500: Dm.ReqCAPVALOR_TX.AsFloat := 7 * Dm.ReqCAPUFR.AsFloat;
501..600: Dm.ReqCAPVALOR_TX.AsFloat := 8 * Dm.ReqCAPUFR.AsFloat;
601..750: Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat;
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * dm.ReqCAPATC.Value * 0.02;
end;
end;
ou assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a: integer;
begin
inherited;
a := StrToInt(EdtTaxa.Text);
if a < 51 then
Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat
else
if a < 101 then
Dm.ReqCAPVALOR_TX.AsFloat := 3 * Dm.ReqCAPUFR.AsFloat
else
if a < 201 then
Dm.ReqCAPVALOR_TX.AsFloat := 4 * Dm.ReqCAPUFR.AsFloat
else
if a < 301 then
Dm.ReqCAPVALOR_TX.AsFloat := 5 * Dm.ReqCAPUFR.AsFloat
else
if a < 401 then
Dm.ReqCAPVALOR_TX.AsFloat := 6 * Dm.ReqCAPUFR.AsFloat
else
if a < 501 then
Dm.ReqCAPVALOR_TX.AsFloat := 7 * Dm.ReqCAPUFR.AsFloat
else
if a < 601 then
Dm.ReqCAPVALOR_TX.AsFloat := 8 * Dm.ReqCAPUFR.AsFloat
else
if a < 751 then
Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * Dm.ReqCAPATC.Value * 0.02;
end;
ou ainda, assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a, mult: integer;
begin
inherited;
a := StrToInt(EdtTaxa.Text);
mult := StrToInt(formatfloat('000', a+99)[1])+2;
if a < 51 then
Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat
else
if a < 601 then
Dm.ReqCAPVALOR_TX.AsFloat := mult * Dm.ReqCAPUFR.AsFloat
else
if a < 751 then
Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * Dm.ReqCAPATC.Value * 0.02;
end;
GOSTEI 0
Benilton
15/04/2010
Valeu ..deu certinho o primero exemplo....obrigado
se eu entendi direito...
pode ser assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
begin
inherited;
case StrToInt(EdtTaxa.Text) of
1..50: Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat;
51..100: Dm.ReqCAPVALOR_TX.AsFloat := 3 * Dm.ReqCAPUFR.AsFloat;
101..200: Dm.ReqCAPVALOR_TX.AsFloat := 4 * Dm.ReqCAPUFR.AsFloat;
201..300: Dm.ReqCAPVALOR_TX.AsFloat := 5 * Dm.ReqCAPUFR.AsFloat;
301..400: Dm.ReqCAPVALOR_TX.AsFloat := 6 * Dm.ReqCAPUFR.AsFloat;
401..500: Dm.ReqCAPVALOR_TX.AsFloat := 7 * Dm.ReqCAPUFR.AsFloat;
501..600: Dm.ReqCAPVALOR_TX.AsFloat := 8 * Dm.ReqCAPUFR.AsFloat;
601..750: Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat;
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * dm.ReqCAPATC.Value * 0.02;
end;
end;
ou assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a: integer;
begin
inherited;
a := StrToInt(EdtTaxa.Text);
if a < 51 then
Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat
else
if a < 101 then
Dm.ReqCAPVALOR_TX.AsFloat := 3 * Dm.ReqCAPUFR.AsFloat
else
if a < 201 then
Dm.ReqCAPVALOR_TX.AsFloat := 4 * Dm.ReqCAPUFR.AsFloat
else
if a < 301 then
Dm.ReqCAPVALOR_TX.AsFloat := 5 * Dm.ReqCAPUFR.AsFloat
else
if a < 401 then
Dm.ReqCAPVALOR_TX.AsFloat := 6 * Dm.ReqCAPUFR.AsFloat
else
if a < 501 then
Dm.ReqCAPVALOR_TX.AsFloat := 7 * Dm.ReqCAPUFR.AsFloat
else
if a < 601 then
Dm.ReqCAPVALOR_TX.AsFloat := 8 * Dm.ReqCAPUFR.AsFloat
else
if a < 751 then
Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * Dm.ReqCAPATC.Value * 0.02;
end;
ou ainda, assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a, mult: integer;
begin
inherited;
a := StrToInt(EdtTaxa.Text);
mult := StrToInt(formatfloat('000', a+99)[1])+2;
if a < 51 then
Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat
else
if a < 601 then
Dm.ReqCAPVALOR_TX.AsFloat := mult * Dm.ReqCAPUFR.AsFloat
else
if a < 751 then
Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * Dm.ReqCAPATC.Value * 0.02;
end;
pode ser assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
begin
inherited;
case StrToInt(EdtTaxa.Text) of
1..50: Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat;
51..100: Dm.ReqCAPVALOR_TX.AsFloat := 3 * Dm.ReqCAPUFR.AsFloat;
101..200: Dm.ReqCAPVALOR_TX.AsFloat := 4 * Dm.ReqCAPUFR.AsFloat;
201..300: Dm.ReqCAPVALOR_TX.AsFloat := 5 * Dm.ReqCAPUFR.AsFloat;
301..400: Dm.ReqCAPVALOR_TX.AsFloat := 6 * Dm.ReqCAPUFR.AsFloat;
401..500: Dm.ReqCAPVALOR_TX.AsFloat := 7 * Dm.ReqCAPUFR.AsFloat;
501..600: Dm.ReqCAPVALOR_TX.AsFloat := 8 * Dm.ReqCAPUFR.AsFloat;
601..750: Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat;
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * dm.ReqCAPATC.Value * 0.02;
end;
end;
ou assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a: integer;
begin
inherited;
a := StrToInt(EdtTaxa.Text);
if a < 51 then
Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat
else
if a < 101 then
Dm.ReqCAPVALOR_TX.AsFloat := 3 * Dm.ReqCAPUFR.AsFloat
else
if a < 201 then
Dm.ReqCAPVALOR_TX.AsFloat := 4 * Dm.ReqCAPUFR.AsFloat
else
if a < 301 then
Dm.ReqCAPVALOR_TX.AsFloat := 5 * Dm.ReqCAPUFR.AsFloat
else
if a < 401 then
Dm.ReqCAPVALOR_TX.AsFloat := 6 * Dm.ReqCAPUFR.AsFloat
else
if a < 501 then
Dm.ReqCAPVALOR_TX.AsFloat := 7 * Dm.ReqCAPUFR.AsFloat
else
if a < 601 then
Dm.ReqCAPVALOR_TX.AsFloat := 8 * Dm.ReqCAPUFR.AsFloat
else
if a < 751 then
Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * Dm.ReqCAPATC.Value * 0.02;
end;
ou ainda, assim:
procedure TFCadastroReqCAP.EdtTaxaExit(Sender: TObject);
var a, mult: integer;
begin
inherited;
a := StrToInt(EdtTaxa.Text);
mult := StrToInt(formatfloat('000', a+99)[1])+2;
if a < 51 then
Dm.ReqCAPVALOR_TX.AsFloat := 2 * Dm.ReqCAPUFR.AsFloat
else
if a < 601 then
Dm.ReqCAPVALOR_TX.AsFloat := mult * Dm.ReqCAPUFR.AsFloat
else
if a < 751 then
Dm.ReqCAPVALOR_TX.AsFloat := 9 * Dm.ReqCAPUFR.AsFloat
else
Dm.ReqCAPVALOR_TX.Value := Dm.ReqCAPUFR.Value * Dm.ReqCAPATC.Value * 0.02;
end;
GOSTEI 0