Calculo de impostos

Delphi

15/07/2009

pessoal to com um problemao aqui com uns impostos

fiz umas rotinas esta me dando um problema ela so me soma os valores quando esta 100 dos impostos se eu colocar um valos menor tipo 50¬ ele naum me da o valor de venda correto do produto a funcao q estou usando e essa

quando vou somar os impostos para m dar o valor de venda ele naum soma correto

 prmPercentTributar      := (prmTempIcmsSaida+prmTempPis+prmTempCofins+prmTempContrSocial+prmTempIR+prmTempComissoes+prmTempDespOperacionais+prmTempMargemLucro);
  lbl_percentual_custo_compra.Caption := FloatToStr(prmPercentTributar);
  prmPercentTributar      := 100 - prmPercentTributar;

  lbl_custo_venda.Caption := FormatFloat(´#,0.00´,       // fucoes de prmPrecoVenda
  ((prmCustoCompra * prmTempIcmsSaida) / 100) +
  ((prmCustoCompra * prmTempPis) / 100) +
  ((prmCustoCompra * prmTempCofins) / 100)+
  ((prmCustoCompra * prmTempContrSocial) / 100)+
  ((prmCustoCompra * prmTempIR) / 100)+
  ((prmCustoCompra * prmTempComissoes) / 100)+
  ((prmCustoCompra * prmTempDespOperacionais) / 100)+
  ((prmCustoCompra * prmTempMargemLucro) / 100));

  if prmPercentTributar = 0 then// para evitar erros de divizão;
   prmPercentTributar := 1;

 // prmPrecoVenda           := prmCustoCompra+((prmCustoCompra * 100) / prmPercentTributar);
//  lbl_preco_venda.Caption := FormatFloat(´#,0.00´,prmPrecoVenda);

  prmPrecoVenda           := prmCustoCompra+((prmCustoCompra) / prmPercentTributar);

  lbl_preco_venda.Caption := FormatFloat(´,0.00´,prmPrecoVenda);

  lbl_icms_saida.Caption := FormatFloat(´,0.00´,(prmCustoCompra * prmTempIcmsSaida) / 100);
  lbl_pis.Caption := FormatFloat(´,0.00´,(prmCustoCompra * prmTempPis) / 100);
  lbl_cofins.Caption := FormatFloat(´,0.00´,(prmCustoCompra * prmTempCofins) / 100);
  lbl_contr_social.Caption := FormatFloat(´#,0.00´,(prmCustoCompra * prmTempContrSocial) / 100);
  lbl_imposto_renda.Caption := FormatFloat(´,0.00´,(prmCustoCompra * prmTempIR) / 100);
  lbl_comissao.Caption := FormatFloat(´,0.00´,(prmCustoCompra * prmTempComissoes) / 100);
  lbl_desp_operacionais.Caption := FormatFloat(´,0.00´,(prmCustoCompra * prmTempDespOperacionais) / 100);
  lbl_margem_lucro.Caption := FormatFloat(´,0.00´,(prmCustoCompra * prmTempMargemLucro) / 100);



Tchucky

Tchucky

Curtidas 0

Respostas

Nasguone

Nasguone

15/07/2009

Sua formatação não esta errada, porem eu particularmente não gosto de fazer formatflot neste estilo:
FormatFloat(´#,0.00´,(prmCustoCompra * prmTempPis) / 100);


To te passando um exemplo que fiz rapidinho aqui para testar as formatações do seu problema, veja se te ajuda em algo.


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
edtValorCompra: TEdit;
edtPercentual: TEdit;
Button1: TButton;
edtResPerc: TEdit;
edtValorfinal: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
ValorProduto : string;
Percentual,resulta : string;
valor :currency;
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
valorproduto := edtValorCompra.text;
Percentual := edtPercentual.text;
edtResPerc.text:= Format(´¬f´,[((StrToFloat(valorproduto)*StrToFloat(percentual))/100)]); //[CurrToStr(valor)]
edtValorfinal.Text := FloatToStr(StrToFloat(Valorproduto)+StrToFloat(edtResPerc.Text));

end;

end.


GOSTEI 0
Osocram

Osocram

15/07/2009

cara eu me perdi no que vc flw...
Poderia explicar mais detalhado e passar um exemplo de valor e qual o resultado da sua função e qual deveria ser o resultado correto?

e outra dica vc faz
(prmCustoCompra * prmTempIcmsSaida) / 100)

duas vezes.. pq não joga o valor numa variavel p não ter que ficar recalculando denovo?

E em vez de fazer isso.
if prmPercentTributar = 0 then// para evitar erros de divizão;
   prmPercentTributar := 1;
 // prmPrecoVenda           := prmCustoCompra+((prmCustoCompra * 100) / prmPercentTributar);
//  lbl_preco_venda.Caption := FormatFloat(´#,0.00´,prmPrecoVenda);
  prmPrecoVenda           := prmCustoCompra+((prmCustoCompra) / prmPercentTributar);
  lbl_preco_venda.Caption := FormatFloat(´,0.00´,prmPrecoVenda); 

faz assim
if prmPercentTributar = 0 then
  prmPrecoVenda           := prmCustoCompra+((prmCustoCompra) )
else
  prmPrecoVenda           := prmCustoCompra+((prmCustoCompra) / prmPercentTributar);


Mas o seu problema em si eu não entendi...


GOSTEI 0
Tchucky

Tchucky

15/07/2009

O problema esta sendo aqui

if prmPercentTributar = 0 then// para evitar erros de divizão;
   prmPercentTributar := 1;

  prmPrecoVenda           := prmCustoCompra+(prmCustoCompra / prmPercentTributar);
  lbl_preco_venda.Caption := FormatFloat(´#,0.00´,prmPrecoVenda);


pois oq esta acontecendo vou fazer um exemplo previo

eu tenho 8 tipo de impostos eles calculam o valor certinho em cima do custo de compra... eu tenho q somar o valor dos impostos para tirar o valor da venda dos produtos ai q esta acontecendo o erro por exemplo

na Margem de lucro eu posso ter 10,50,100 ¬ de lucro

se eu tiver um valor de custo de 88,00 e uma margem de lucro de 100¬ que da 88,00 ai ele vai somar custo+lucro = 176,00 ai ele soma certinho...

agora se eu tiver um custo de 88,00 e uma margem de lucro de 50¬ que da 44,00 quando ele soma esta m dando um valor de 89,76 totalmente errado sendo q o correto e 132,00

esse esta sendo o problema quando adiciono uma porcentagem menor de 100¬ ele me soma errado


GOSTEI 0
Osocram

Osocram

15/07/2009

o certo não seria assim?
prmPrecoVenda := prmCustoCompra+(prmCustoCompra * (prmPercentTributar/100)); 


flw.


GOSTEI 0
Tchucky

Tchucky

15/07/2009

osocram dessa forma ele ja m traz os valores somados e quando eu vou diminuir os porcentagens ele traz totalmente errado o valor da venda


GOSTEI 0
Osocram

Osocram

15/07/2009

tira o prmPercentTributar := 100 - prmPercentTributar;
osocram dessa forma ele ja m traz os valores somados e quando eu vou diminuir os porcentagens ele traz totalmente errado o valor da venda



GOSTEI 0
Tchucky

Tchucky

15/07/2009

essa e minha estrutura de calculos oq sera q pode esta errado a variaveis sao REAL

Var
 fPercet: Real;
begin
  if (Sender is TEdit) and (Trim((Sender as TEdit).Text) <> ´´) then
  begin
    try
      fPercet := StrToFloat((Sender as TEdit).Text);
    except
      fPercet := 0;
    end;
  end
  else
   fPercet := 0;

  case (Sender as TEdit).Tag of
   0: prmTempIcmsSaida := fPercet;
   1: prmTempPis := fPercet;
   2: prmTempCofins := fPercet;
   3: prmTempContrSocial := fPercet;
   4: prmTempIR := fPercet;
   5: prmTempComissoes := fPercet;
   6: prmTempDespOperacionais := fPercet;
   7: prmTempMargemLucro := fPercet;
  end;

  prmPercentTributar      := (prmTempIcmsSaida+prmTempPis+prmTempCofins+prmTempContrSocial+prmTempIR+prmTempComissoes+prmTempDespOperacionais+prmTempMargemLucro);
  lbl_percentual_custo_compra.Caption := FloatToStr(prmPercentTributar);
  prmPercentTributar      := 100 - prmPercentTributar;
  lbl_custo_venda.Caption := FormatFloat(´#,0.00´,
  ((prmPrecoVenda * prmTempIcmsSaida) / 100) +
  ((prmPrecoVenda * prmTempPis) / 100) +
  ((prmPrecoVenda * prmTempCofins) / 100)+
  ((prmPrecoVenda * prmTempContrSocial) / 100)+
  ((prmPrecoVenda * prmTempIR) / 100)+
  ((prmPrecoVenda * prmTempComissoes) / 100)+
  ((prmPrecoVenda * prmTempDespOperacionais) / 100)+
  ((prmPrecoVenda * prmTempMargemLucro) / 100));

  if prmPercentTributar = 0 then// para evitar erros de divizão;
   prmPercentTributar := 1;
   
  prmPrecoVenda           := ((prmCustoCompra * 100) / prmPercentTributar);
  lbl_preco_venda.Caption := FormatFloat(´,0.00´,prmPrecoVenda);

  lbl_icms_saida.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempIcmsSaida) / 100);
  lbl_pis.Caption := FormatFloat(´#,0.00´,(prmPrecoVenda * prmTempPis) / 100);
  lbl_cofins.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempCofins) / 100);
  lbl_contr_social.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempContrSocial) / 100);
  lbl_imposto_renda.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempIR) / 100);
  lbl_comissao.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempComissoes) / 100);
  lbl_desp_operacionais.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempDespOperacionais) / 100);
  lbl_margem_lucro.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempMargemLucro) / 100);



GOSTEI 0
Carlos Bernardo

Carlos Bernardo

15/07/2009

Troque essa linha
prmPercentTributar := 100 - prmPercentTributar

por

prmPercentTributar := (100 - prmPercentTributar) /100
Ai vai dar certo...


GOSTEI 0
Tchucky

Tchucky

15/07/2009

rausch dessa forma ai os valores vao alem do valor real...

esse problema esta m deixando careca


GOSTEI 0
Osocram

Osocram

15/07/2009

Vou repetir novamente oq eu disse nos post anteriores... acho q vc não fez oq eu disse.
Ou não entendi o que vc disse.

e tira a linha
prmPercentTributar := 100 - prmPercentTributar; 


faça assim
prmPrecoVenda := prmCustoCompra+(prmCustoCompra * (prmPercentTributar/100)); [/code]



com o seu exemplo passado
c 100¬
prmPrcoVenda := 88 + (88*(100/100))
:= 88 + (88*1)
:= 176

agora c 50¬
prmPrcoVenda := 88 + (88*(50/100))
:= 88 + (88*0.5)
:= 88 + 44

Foi isso q eu passei nos meus 2 ultimos post... E acho que esta correto...
A não ser que eu tenha entendi errado o q vc quer.


GOSTEI 0
Carlos Bernardo

Carlos Bernardo

15/07/2009

Desculpa pela resposta anterior...

Analisando seu sistema, e simulando vi alguns erros....

Vou postar as alterações, baseados na sua forma de cálculo.


prmPercentTributar := (prmTempIcmsSaida+prmTempPis+prmTempCofins+
prmTempContrSocial+prmTempIR+prmTempComissoes+
prmTempDespOperacionais+prmTempMargemLucro);

lbl_percentual_custo_compra.Caption := FloatToStr(prmPercentTributar);
//
lbl_custo_venda.Caption := FormatFloat(´#,0.00´,
((prmCustoCompra * prmTempIcmsSaida) / 100) +
((prmCustoCompra * prmTempPis) / 100) +
((prmCustoCompra * prmTempCofins) / 100)+
((prmCustoCompra * prmTempContrSocial) / 100)+
((prmCustoCompra * prmTempIR) / 100)+
((prmCustoCompra * prmTempComissoes) / 100)+
((prmCustoCompra * prmTempDespOperacionais) / 100)+
((prmCustoCompra * prmTempMargemLucro) / 100));

//

prmPrecoVenda := prmCustoCompra+(prmCustoCompra * (prmPercentTributar/100));
lbl_preco_venda.Caption := FormatFloat(´#,0.00´,prmPrecoVenda);

lbl_icms_saida.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempIcmsSaida) / 100);
lbl_pis.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempPis) / 100);
lbl_cofins.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempCofins) / 100);
lbl_contr_social.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempContrSocial) / 100);
lbl_imposto_renda.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempIR) / 100);
lbl_comissao.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempComissoes) / 100);
lbl_desp_operacionais.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempDespOperacionais) / 100);
lbl_margem_lucro.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempMargemLucro) / 100);

Seguinte não sei se vc está querendo obter uma espécie de formação de preço... Se for... de qq forma está completamente errado... mas dessa maneira aki funcionou...

Qq coisa avisa q eu ajudo a formular o preço...


GOSTEI 0
Tchucky

Tchucky

15/07/2009

osocram fiz da forma q vc passou sim mas naum deu certo tambem oq acontece ele ja ja vem somando tudo sem eu colocar valor nem um no campo de porcentangem ele ja me retorna 176 sem eu digitar nada...


GOSTEI 0
Osocram

Osocram

15/07/2009

Mas dae ja é um erro na logica dessa sua rotina, hein...
saca so

prmPrcoVenda := 88 + (88*(50/100)) 

se vc passar zero deveria ficar assim
  prmPrcoVenda := 88 + (88*(0/100)) 
                        := 88 + (88*0) 
                        := 88 + 0 

então acho que esta falando vc inicializar alguma variavel.

osocram fiz da forma q vc passou sim mas naum deu certo tambem oq acontece ele ja ja vem somando tudo sem eu colocar valor nem um no campo de porcentangem ele ja me retorna 176 sem eu digitar nada...



GOSTEI 0
Tchucky

Tchucky

15/07/2009

eu fiz dessa forma ai tambem naum deu

testei dessa forma


prmPercentTributar      := 100 - prmPercentTributar;
prmPrecoVenda :=  (prmCustoCompra*(prmPercentTributar/100));


a diferença e q ao invez de somar ela esta diminuindo pelo valor dos impostos esse esta sendo o problema agora


GOSTEI 0
Tchucky

Tchucky

15/07/2009

pessoal consegui resolver o problema

prmPercentTributar      := 100 + prmPercentTributar;
prmPrecoVenda :=  (prmCustoCompra*(prmPercentTributar/100));


so mudei o prmPercentTributar := 100 - prmPercentTributar;

para

prmPercentTributar := 100 + prmPercentTributar;


GOSTEI 0
Carlos Bernardo

Carlos Bernardo

15/07/2009

Opa... aqui segue o código que eu gerei ... o button2 segue o seu padrão
e o button1 eu fiz alterações da forma que eu usaria.

Lembrando que


[list:3f1ed7cd1c]Incidência de impostos

Cofins (Valor Bruto - IPI - ICMS)

PIS (Valor Bruto - IPI - ICMS)

IPI (Valor acrescido no preço de custo)

Contribuição Social (Preço bruto de venda - IPI - ICMS)

IRPJ --> Lucro Real

Comissoes --> Valor Bruto de venda

Despesas --> Valor Bruto de venda

ICMS --> Incide sobre a diferença (Preço de venda - preço da nota + IPI).


Definindo as fórmulas de cálculo

PRECO DE CUSTO --> Valor definido na Nota fiscal

CUSTO REAL --> PRECO DE CUSTO + (PRECO DE CUSTO * IPI/100)

PRECO DE VENDA --> CUSTO REAL +(CUSTO REAL * LUCRO PRETENDIDO/100)

PRECO DE VENDA --> ((PRECO DE VENDA * 100)/(100 - Despesa))

PRECO DE VENDA --> ((PRECO DE VENDA * 100)/(100 - PIS))

PRECO DE VENDA --> ((PRECO DE VENDA * 100)/(100 - COFINS))

PRECO DE VENDA --> ((PRECO DE VENDA * 100)/(100 - CSSL))

PRECO DE VENDA --> ((PRECO DE VENDA * 100)/(100 - COMISSAO))

IRPJ --> (((PRECO DE VENDA - CUSTO REAL) * 100)/(100 - IRPJ))

ICMS --> (((PRECO DE VENDA - CUSTO REAL) * 100)/(100 - ICMS))

PRECO DE VENDA --> PRECO DE VENDA + IRPJ + ICMS

[/list:u:3f1ed7cd1c]





unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    lbl_percentual_custo_compra: TLabel;
    lbl_custo_venda: TLabel;
    lbl_preco_venda: TLabel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    lbl_icms_saida: TLabel;
    Label13: TLabel;
    lbl_pis: TLabel;
    Label15: TLabel;
    lbl_cofins: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    lbl_contr_social: TLabel;
    Label20: TLabel;
    Lbl_imposto_renda: TLabel;
    Label22: TLabel;
    lbl_comissao: TLabel;
    Label24: TLabel;
    lbl_desp_operacionais: TLabel;
    Label26: TLabel;
    lbl_margem_lucro: TLabel;
    Button1: TButton;
    Edit9: TEdit;
    Label12: TLabel;
    Button2: TButton;
    procedure Edit1Exit(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;


prmTempIcmsSaida,prmTempPis,prmTempCofins,prmTempContrSocial,
prmTempIR,prmTempComissoes,prmTempDespOperacionais,prmTempMargemLucro,
prmPercentTributar,prmPrecoVenda,prmCustoCompra,prmTempIPI  : real;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
CustoReal,IRPJ,ICMS,PIS,COFINS,DESPESAS,CSSL,Comissao,IPI,LUCRO : Real;
begin
  CustoReal     := prmCustoCompra  + (prmCustoCompra * prmTempIPI /100);
  prmPrecoVenda := custoReal + (CustoReal * prmTempMargemLucro /100);
  prmPrecoVenda := ((prmPrecoVenda * 100) / (100 - prmTempDespOperacionais));
  prmPrecoVenda := ((prmPrecoVenda * 100) / (100 - prmTempPis));
  prmPrecoVenda := ((prmPrecoVenda * 100) / (100 - prmTempCofins));
  prmPrecoVenda := ((prmPrecoVenda * 100) / (100 - prmTempContrSocial));
  prmPrecoVenda := ((prmPrecoVenda * 100) / (100 - prmTempComissoes));
  IRPJ          := (prmPrecoVenda - CustoReal)  * (prmTempIR /100);
  ICMS          := (prmPrecoVenda - CustoReal) * (prmTempIcmsSaida/100 );
  prmPrecoVenda := prmPrecoVenda + IRPJ + ICMS;

  Comissao      := prmPrecoVenda * prmTempComissoes / 100;
  IRPJ          := (prmPrecoVenda - CustoReal)  * (prmTempIR /100);
  ICMS          := (prmPrecoVenda - CustoReal) * (prmTempIcmsSaida/100 );
  PIS           := (prmPrecoVenda - ICMS - IRPJ) * prmTempPis /100;
  COFINS        := (prmPrecoVenda - ICMS - IRPJ) * prmTempCofins /100;
  CSSL          := (prmPrecoVenda - ICMS - IRPJ) * prmTempContrSocial /100;
  DESPESAS      := (prmPrecoVenda - ICMS - IRPJ - PIS - COFINS - CSSL) * prmTempDespOperacionais /100;
  IPI           := CustoReal - prmCustoCompra;
  LUCRO         := 100- ((CustoReal * 100) / (prmPrecoVenda - ICMS - IRPJ - PIS - COFINS - CSSL - Despesas - Comissao));

  prmPercentTributar := ((prmPrecoVenda /CustoReal) -1 ) * 100;
  lbl_percentual_custo_compra.Caption := FormatFloat(´0.00´,prmPercentTributar);

  lbl_custo_venda.Caption := FormatFloat(´#,0.00´,(CustoReal +  ICMS + IRPJ + PIS + COFINS + CSSL + Despesas + Comissao )) ;
  lbl_preco_venda.Caption := FormatFloat(´,0.00´,prmPrecoVenda);


  lbl_icms_saida.Caption := FormatFloat(´,0.00´,ICMS);
  lbl_pis.Caption := FormatFloat(´,0.00´,PIS);
  lbl_cofins.Caption := FormatFloat(´,0.00´,COFINS);
  lbl_contr_social.Caption := FormatFloat(´,0.00´,CSSL);
  lbl_imposto_renda.Caption := FormatFloat(´,0.00´,IRPJ);
  lbl_comissao.Caption := FormatFloat(´#,0.00´,comissao);
  lbl_desp_operacionais.Caption := FormatFloat(´,0.00´,despesas);
  lbl_margem_lucro.Caption := FormatFloat(´,0.00´,LUCRO);

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  prmPercentTributar      := (prmTempIcmsSaida+prmTempPis+prmTempCofins+
                               prmTempContrSocial+prmTempIR+prmTempComissoes+
                               prmTempDespOperacionais+prmTempMargemLucro);
  lbl_percentual_custo_compra.Caption := FloatToStr(prmPercentTributar);
//  prmPercentTributar      := 100 - prmPercentTributar;  //
  lbl_custo_venda.Caption := FormatFloat(´,0.00´,
  ((prmCustoCompra * prmTempIcmsSaida) / 100) +
  ((prmCustoCompra * prmTempPIS) / 100) +
  ((prmCustoCompra * prmTempCofins) / 100)+
  ((prmCustoCompra * prmTempContrSocial) / 100)+
  ((prmCustoCompra * prmTempIR) / 100)+
  ((prmCustoCompra * prmTempComissoes) / 100)+
  ((prmCustoCompra * prmTempDespOperacionais) / 100)+
  ((prmCustoCompra * prmTempMargemLucro) / 100));

{  if prmPercentTributar = 0 then// para evitar erros de divizão;
   prmPercentTributar := 1;   }

  prmPrecoVenda           := prmCustoCompra+(prmCustoCompra * (prmPercentTributar/100));
  lbl_preco_venda.Caption := FormatFloat(´#,0.00´,prmPrecoVenda);

  lbl_icms_saida.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempIcmsSaida) / 100);
  lbl_pis.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempPis) / 100);
  lbl_cofins.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempCofins) / 100);
  lbl_contr_social.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempContrSocial) / 100);
  lbl_imposto_renda.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempIR) / 100);
  lbl_comissao.Caption := FormatFloat(´#,0.00´,(prmPrecoVenda * prmTempComissoes) / 100);
  lbl_desp_operacionais.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempDespOperacionais) / 100);
  lbl_margem_lucro.Caption := FormatFloat(´,0.00´,(prmPrecoVenda * prmTempMargemLucro) / 100);

end;

procedure TForm1.Edit1Exit(Sender: TObject);
Var
 fPercet: Real;
begin
  if (Sender is TEdit) and ((Sender as TEdit).Text <> emptystr) then
  begin
    try
      fPercet := StrToFloat((Sender as TEdit).Text);
    except
      fPercet := 0;
    end;
  end
  else
   fPercet := 0;

  case (Sender as TEdit).Tag of
   0: prmTempIcmsSaida         := fPercet;
   1: prmTempPis               := fPercet;
   2: prmTempCofins            := fPercet;
   3: prmTempContrSocial       := fPercet;
   4: prmTempIR                := fPercet;
   5: prmTempComissoes         := fPercet;
   6: prmTempDespOperacionais  := fPercet;
   7: prmTempMargemLucro       := fPercet;
   8: prmTempIPI               := fPercet;
  end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  prmCustoCompra := 88;

end;

end.



GOSTEI 0
POSTAR