truequeman
20-01-2007, 12:43:46
hola. necesito una formula para un descuento lo he intentado pero no se por que me sale mal... la cosa es que cuando marca mas de 1,000 (con coma) todo sale mal... pero cuando la cantidad es menor a 999 si saca los descuentos
estoy haciendo esto:
if Descuento.Text <> '0' then
begin
If Length(Descuento.Text) = 1 then
Dsto := StrToFloat('0.0' + Descuento.Text)
else
Dsto := StrToFloat('0.' + Descuento.Text);
ActAReal := '';
for K:=1 to Length(SubTotal.Text) do
begin
If SubTotal.Text[K] in ['0'..'9','.'] then
ActAReal := ActAReal + SubTotal.Text[K]
end;
SubTotal.Text := ActAReal;
Stal := StrToFloat(SubTotal.Text) * Dsto;
SubTotal.Text := FloatToStrF(StrToFloat(Subtotal.Text) - Stal , FFNumber, 9,2);
end;
si alguien sabe una forma mejor o solucionar esto espero me respondan.saludos.
estoy haciendo esto:
if Descuento.Text <> '0' then
begin
If Length(Descuento.Text) = 1 then
Dsto := StrToFloat('0.0' + Descuento.Text)
else
Dsto := StrToFloat('0.' + Descuento.Text);
ActAReal := '';
for K:=1 to Length(SubTotal.Text) do
begin
If SubTotal.Text[K] in ['0'..'9','.'] then
ActAReal := ActAReal + SubTotal.Text[K]
end;
SubTotal.Text := ActAReal;
Stal := StrToFloat(SubTotal.Text) * Dsto;
SubTotal.Text := FloatToStrF(StrToFloat(Subtotal.Text) - Stal , FFNumber, 9,2);
end;
si alguien sabe una forma mejor o solucionar esto espero me respondan.saludos.