nasreddine
01-02-2011, 01:52 PM
procedure TForm1.Edit1Change(Sender: TObject);
var x: real;
begin
if edit1.Text <> '' then
begin
if strtofloat(edit1.Text)<=15000 then
edit2.Text := '0.00';
if (strtofloat(edit1.Text)>=15000) and (strtofloat(edit1.Text)<=22500) then
begin
x := ((trunc(strtofloat(edit1.text))-15000) div 10) *2;
edit2.Text := formatfloat('# ##0.00',x);
end;
if (strtofloat(edit1.Text)>=22500) and (strtofloat(edit1.Text)<=28750) then
x := (((trunc(strtofloat(edit1.text))-22500) div 10)* 1.2) + 1500;
edit2.Text := formatfloat('# ##0.00',x);
if (strtofloat(edit1.Text)>=28750) and (strtofloat(edit1.Text)<=30000) then
x := ((trunc(strtofloat(edit1.text))-28750) div 10)*2+2250;
edit2.Text := formatfloat('# ##0.00',x);
if (strtofloat(edit1.Text)>=30000) then
x := ((trunc(strtofloat(edit1.text))-30000) div 10)*3+2500;
edit2.Text := formatfloat('# ##0.00',x);
end;
end;
var x: real;
begin
if edit1.Text <> '' then
begin
if strtofloat(edit1.Text)<=15000 then
edit2.Text := '0.00';
if (strtofloat(edit1.Text)>=15000) and (strtofloat(edit1.Text)<=22500) then
begin
x := ((trunc(strtofloat(edit1.text))-15000) div 10) *2;
edit2.Text := formatfloat('# ##0.00',x);
end;
if (strtofloat(edit1.Text)>=22500) and (strtofloat(edit1.Text)<=28750) then
x := (((trunc(strtofloat(edit1.text))-22500) div 10)* 1.2) + 1500;
edit2.Text := formatfloat('# ##0.00',x);
if (strtofloat(edit1.Text)>=28750) and (strtofloat(edit1.Text)<=30000) then
x := ((trunc(strtofloat(edit1.text))-28750) div 10)*2+2250;
edit2.Text := formatfloat('# ##0.00',x);
if (strtofloat(edit1.Text)>=30000) then
x := ((trunc(strtofloat(edit1.text))-30000) div 10)*3+2500;
edit2.Text := formatfloat('# ##0.00',x);
end;
end;