Ir para conteúdo
  • Cadastre-se

  • Este tópico foi criado há 136 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

  • Consultores
Postado

teu ambiente pode estar sendo configurado depois que adicionou a nfe ou nfce ao componente e com isso o tpamb não muda

sendo assim ele vai ver a config com um tpamb e no xml outro

essa é uma das possibilidades

 

Consultora ACBr Pro

Juliomar Marchetti

Ajude o Projeto ACBr crescer - Seja Pro

discord: juliomar
telegram: juliomar
e-mail: [email protected]
http://www.juliomarmarchetti.com.br

 

MVP_NewLogo_100x100_Transparent-02.png
Projeto ACBr - A maior comunidade Open Source de Automação Comercial do Brasil


Participe de nosso canal no Discord e fique ainda mais próximo da Comunidade !!

Postado (editado)

olhei bem o código, o sistema está configurando, acrescentando os produtos, calculando os impostos, inclui informação de rodapé no inf, depois assina, valida e envia e continua dando o mesmo erro.

estou usando o ambiente de homologação.

Editado por Sigelman Araujo
Postado
procedure TfmNFce.btnCriarEnviarNFCeClick(Sender: TObject);
var
 vAux, vNumLote, vSincrono, Erros : String;
 Sincrono : boolean;
 agora: Tdate;
begin
  agora:= Now;
  vAux      := inttostr(PontoDeVenda.EssaVenda.cupom);
  vSincrono := '1';
  vNumLote  := copy( datetostr(agora),1,2);
  vNumLote  := SomenteNumeros(vNumLote);

  if Trim(vNumLote) = '' then
   begin
     MessageDlg('Número do Lote inválido.',mtError,[mbok],0);
     exit;
   end;

  if (Trim(vSincrono) <> '1') and
     (Trim(vSincrono) <> '0') then
   begin
     MessageDlg('Valor Inválido.',mtError,[mbok],0);
     exit;
   end;

  if (Trim(vSincrono) = '1') then
    Sincrono := True
  else
    Sincrono := False;


  ACBrNFe1.NotasFiscais.Clear;

//
  GerarNFe(vAux);

  ACBrNFe1.Enviar(vNumLote,True,Sincrono);

  if not Sincrono then
  begin
    MemoResp.Lines.Text := ACBrNFe1.WebServices.Retorno.RetWS;
    memoRespWS.Lines.Text := ACBrNFe1.WebServices.Retorno.RetornoWS;
    LoadXML(ACBrNFe1.WebServices.Retorno.RetWS, WBResposta);

    MemoDados.Lines.Add('');
    MemoDados.Lines.Add('Envio NFCe');
    MemoDados.Lines.Add('tpAmb: '+ ACBrDFe.Conversao.TipoAmbienteToStr(ACBrNFe1.WebServices.Retorno.TpAmb));
    MemoDados.Lines.Add('verAplic: '+ ACBrNFe1.WebServices.Retorno.verAplic);
    MemoDados.Lines.Add('cStat: '+ IntToStr(ACBrNFe1.WebServices.Retorno.cStat));
    MemoDados.Lines.Add('cUF: '+ IntToStr(ACBrNFe1.WebServices.Retorno.cUF));
    MemoDados.Lines.Add('xMotivo: '+ ACBrNFe1.WebServices.Retorno.xMotivo);
    MemoDados.Lines.Add('cMsg: '+ IntToStr(ACBrNFe1.WebServices.Retorno.cMsg));
    MemoDados.Lines.Add('xMsg: '+ ACBrNFe1.WebServices.Retorno.xMsg);
    MemoDados.Lines.Add('Recibo: '+ ACBrNFe1.WebServices.Retorno.Recibo);
    MemoDados.Lines.Add('Protocolo: '+ ACBrNFe1.WebServices.Retorno.Protocolo);
  end
  else
  begin
    MemoResp.Lines.Text := ACBrNFe1.WebServices.Enviar.RetWS;
    memoRespWS.Lines.Text := ACBrNFe1.WebServices.Enviar.RetornoWS;
    LoadXML(ACBrNFe1.WebServices.Enviar.RetWS, WBResposta);

    MemoDados.Lines.Add('');
    MemoDados.Lines.Add('Envio NFCe');
    MemoDados.Lines.Add('tpAmb: '+ ACBrDFe.Conversao.TipoAmbienteToStr(ACBrNFe1.WebServices.Enviar.TpAmb));
    MemoDados.Lines.Add('verAplic: '+ ACBrNFe1.WebServices.Enviar.verAplic);
    MemoDados.Lines.Add('cStat: '+ IntToStr(ACBrNFe1.WebServices.Enviar.cStat));
    MemoDados.Lines.Add('cUF: '+ IntToStr(ACBrNFe1.WebServices.Enviar.cUF));
    MemoDados.Lines.Add('xMotivo: '+ ACBrNFe1.WebServices.Enviar.xMotivo);
    //MemoDados.Lines.Add('cMsg: '+ IntToStr(ACBrNFe1.WebServices.Enviar.cMsg));
    //MemoDados.Lines.Add('xMsg: '+ ACBrNFe1.WebServices.Enviar.xMsg);
    MemoDados.Lines.Add('Recibo: '+ ACBrNFe1.WebServices.Enviar.Recibo);
    //MemoDados.Lines.Add('Protocolo: '+ ACBrNFe1.WebServices.Enviar.Protocolo);
  end;

  ACBrNFe1.NotasFiscais.Clear;
end;


 

procedure TfmNFce.GerarNFe(NumNFe : String);
Var
   i : integer;
   percentItem,
   descontItem : double;
   LojaCupom: String;
   totIBSCBS: Double;
   totTributo: Double;
   wDataEmissao: Tdate;
   vTotBCIBSCBS : Double;
   vTotIBS      : Double;
   vTotCBS      : Double;
   vTotIBSUF,vTotIBSMun: Double;
begin
  totIBSCBS:=0;
  totTributo:=0;
  wDataEmissao:= Now;
  //
  with ACBrNFe1.NotasFiscais.Add.NFe do
   begin

     //Ide.cNF       := StrToInt(NumNFe); //Caso não seja preenchido será gerado um número aleatório pelo componente
     Ide.cNF       := ACBrDFeUtil.GerarCodigoDFe(StrToInt(NumNFe));
     Ide.natOp     := 'VENDA';
     Ide.indPag    := ipVista;
     Ide.modelo    := 65;
     Ide.serie     := 1;
     Ide.nNF       := StrToInt(NumNFe);
     Ide.dEmi      := wDataEmissao;
     Ide.dSaiEnt   := wDataEmissao;
     Ide.hSaiEnt   := wDataEmissao;
     Ide.tpNF      := ACBrDFe.Conversao.tnSaida;
     Ide.tpEmis    := ACBrDFe.Conversao.teNormal;
     Ide.cUF       := UFtoCUFLocal(edtEmitUF.Text);
     Ide.cMunFG    := StrToInt(edtEmitCodCidade.Text);
     Ide.finNFe    := fnNormal;
     Ide.tpImp     := ACBrDFe.Conversao.tiNFCe;
     Ide.indFinal  := cfConsumidorFinal;
     Ide.indPres   := pcPresencial;
     Ide.verProc   := '3.0.0.0'; //Versão do seu sistema
     Ide.cMunFGIBS := StrToInt(edtEmitCodCidade.Text);

     //Ide.tpNFDebito := tdNenhum;
     //Ide.tpNFCredito := tcNenhum;

     //Ide.gCompraGov.tpEnteGov := tcgEstados;
     //Ide.gCompraGov.pRedutor := 5;
     //Ide.gCompraGov.tpOperGov := togFornecimento;

     if (PontoDeVenda.ambiente = 'HOMOLOGACAO') then
        Ide.tpAmb     := ACBrDFe.Conversao.taHomologacao  
     else
        Ide.tpAmb     := ACBrDFe.Conversao.taProducao;

   
     LojaCupom:=pontoDeVenda.findUsuario(PontoDeVenda.Caixa.Codigo);

     if Length(LojaCupom) > 0 then       // alterado em 14/10/2025
       PontoDeVenda.findEmpresa( LojaCupom )
     else
       PontoDeVenda.findEmpresa( PontoDeVenda.LojaPadrao );


     Emit.CNPJCPF           := PontoDeVenda.Empresa.cpfCnpj;
     Emit.IE                := PontoDeVenda.Empresa.inscricao;
     Emit.xNome             := PontoDeVenda.Empresa.nome;
     Emit.xFant             := PontoDeVenda.Empresa.fantasia;
     Emit.EnderEmit.fone    := PontoDeVenda.Empresa.fone;
     Emit.EnderEmit.CEP     := StrToInt(PontoDeVenda.Empresa.cep);
     Emit.EnderEmit.xLgr    := PontoDeVenda.Empresa.endereco;
     Emit.EnderEmit.nro     := PontoDeVenda.Empresa.numero;
     Emit.EnderEmit.xCpl    := '';
     Emit.EnderEmit.xBairro := PontoDeVenda.Empresa.bairro;
     Emit.EnderEmit.cMun    := StrToInt('2800308');
     Emit.EnderEmit.xMun    := PontoDeVenda.Empresa.cidade;
     Emit.EnderEmit.UF      := PontoDeVenda.Empresa.estado;
     Emit.enderEmit.cPais   := 1058;
     Emit.enderEmit.xPais   := 'BRASIL';
     Emit.IEST              := '';
     Emit.IM                := ''; // Preencher no caso de existir serviços na nota
     Emit.CNAE              := ''; // Verifique na cidade do emissor da NFe se é permitido
     Emit.CRT               := crtRegimeNormal;// (1-crtSimplesNacional, 2-crtSimplesExcessoReceita, 3-crtRegimeNormal)

     if  ( ((PontoDeVenda.Cliente.Cgccpf <> '00000000000000') and
           (PontoDeVenda.Cliente.Cgccpf <> '00000000000') ) or
            PontoDeVenda.CpfNota  ) then
         begin

              PontoDeVenda.findCliente( PontoDeVenda.Cliente.Cgccpf );

              if ( CheckCpf( PontoDeVenda.Cliente.Cgccpf ) or CheckCgc( PontoDeVenda.Cliente.Cgccpf ))
                then
                  begin

                    Dest.CNPJCPF           := PontoDeVenda.Cliente.Cgccpf;
                    Dest.xNome             := PontoDeVenda.Cliente.Nomcli;

                    // cpf na nota
                    if PontoDeVenda.CpfNota then
                    begin
                      Dest.CNPJCPF                := PontoDeVenda.NroCpfNota;
                      Dest.xNome                  := 'consumidor final';
                      PontoDeVenda.CpfNota        := false;
                    end;


                    if ( ( length(PontoDeVenda.Cliente.Cgccpf) = 11 ) or
                      ( strtointdef(PontoDeVenda.Cliente.Inscricao,0) = 0 ) )
                    then
                        Dest.indIEDest         := ACBrDFe.Conversao.inNaoContribuinte
                    else
                      begin
                          Ide.indFinal           := cfConsumidorFinal;
                          Dest.indIEDest         := ACBrDFe.Conversao.inNaoContribuinte;
                          Dest.EnderDest.Fone    := PontoDeVenda.Cliente.Fone;
                          Dest.EnderDest.CEP     := Strtoint(PontoDeVenda.Cliente.cep);
                          Dest.EnderDest.xLgr    := PontoDeVenda.Cliente.Endereco;
                          Dest.EnderDest.nro     := PontoDeVenda.Cliente.Numero;
                          Dest.EnderDest.xCpl    := '';
                          Dest.EnderDest.xBairro := PontoDeVenda.Cliente.Bairro;
                          Dest.EnderDest.cMun    := strtoint(PontoDeVenda.Cliente.Codmunicipio);  // fazer
                          Dest.EnderDest.xMun    := PontoDeVenda.Cliente.Cidade;  // fazer
                          Dest.EnderDest.UF      := PontoDeVenda.Cliente.Estado;
                          Dest.EnderDest.cPais   := 1058;
                          Dest.EnderDest.xPais   := 'BRASIL';
                          Dest.IE                := '';

                          if ( UpperCase(PontoDeVenda.Cliente.Inscricao) = 'ISENTO' ) then
                             begin
                               Dest.indIEDest := ACBrDFe.Conversao.inIsento;
                               Dest.IE        := '';
                             end;

                      end;

                  end;
            end;


/////////////// inicio tempalx

      //i := 1;


      //Adicionando Produtos

      vTotBCIBSCBS := 0;
      vTotIBS      := 0;
      vTotCBS      := 0;
      vTotIBSUF    := 0; // Faltava inicializar
      vTotIBSMun   := 0; // Faltava inicializar

      for  i := 1 to PontoDeVenda.NroItens do
          if ( PontoDeVenda.Cupom[i].Produto <> '')  then
             with Det.New do
             begin
               Prod.nItem     := i; // Número sequencial, para cada item deve ser incrementado
               Prod.cProd     := PontoDeVenda.Cupom[i].Produto;
               Prod.cEAN      := PontoDeVenda.Cupom[i].Cbarra;
               // EM 08/07/18 - RAIMUNDO
               if AllTrim(PontoDeVenda.Cupom[i].Cbarra) = '' then
                  Prod.cEAN := 'SEM GTIN';

               if (i=1) and ( PontoDeVenda.ambiente = 'HOMOLOGACAO') then
                  Prod.xProd := 'NOTA FISCAL EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL'
               else
                  Prod.xProd     := PontoDeVenda.Cupom[i].Nome;

               Prod.NCM       := PontoDeVenda.Cupom[i].ncm;
               Prod.EXTIPI    := '001';

               if (PontoDeVenda.Cupom[i].Tributacao = 10) or
                  (PontoDeVenda.Cupom[i].Tributacao = 60) or
                  (PontoDeVenda.Cupom[i].Tributacao = 5 ) then
                      Prod.CFOP      := '5405'   // CFOP incidente neste Item da NF
               else
                      Prod.CFOP      := PontoDeVenda.Operacao;   // CFOP incidente neste Item da NF

               Prod.uCom      := PontoDeVenda.Cupom[i].Unidade;
               Prod.qCom      := PontoDeVenda.Cupom[i].Quantidade;  // Quantidade Comercializada do Item
               Prod.vUnCom    := PontoDeVenda.Cupom[i].Preco;  // Valor Comercializado do Item
               Prod.vProd     := PontoDeVenda.Cupom[i].Vltotitem; // Valor Total Bruto do Item
               Prod.cEANTrib  := PontoDeVenda.Cupom[i].Cbarra;

               // EM 08/07/18 - RAIMUNDO
               if AllTrim(PontoDeVenda.Cupom[i].Cbarra) = '' then
                  Prod.cEANTrib := 'SEM GTIN';

               Prod.uTrib     := PontoDeVenda.Cupom[i].Unidade;
               Prod.qTrib     := PontoDeVenda.Cupom[i].Quantidade;  // Quantidade Tributável do Item
               Prod.vUnTrib   := PontoDeVenda.Cupom[i].preco;
               Prod.vDesc     := PontoDeVenda.Cupom[i].Desconto;

               if (strtointdef(PontoDeVenda.Cupom[i].Cest,0) <> 0) then
                  Prod.CEST := PontoDeVenda.Cupom[i].Cest;

               Prod.vOutro    := 0;
               Prod.vFrete    := 0;
               Prod.vSeg      := 0;

               infAdProd      := '';

               with Imposto do
               begin
                  // lei da transparencia nos impostos
                  //vTotTrib := PontoDeVenda.Vlicm;
                  //vTotTrib := RoundTo( PontoDeVenda.Cupom[i].Vlicms,-2);

                  with ICMS do
                   begin

                       ICMS.orig    := ACBrDFe.Conversao.oeNacional;
                       ICMS.modBC   := dbiValorOperacao;
                       ICMS.vBC     := 0;
                       ICMS.pICMS   := 0;
                       ICMS.vICMS   := 0;
                       ICMS.modBCST := dbisMargemValorAgregado;
                       ICMS.pMVAST  := 0;
                       ICMS.pRedBCST:= 0;
                       ICMS.vBCST   := 0;
                       ICMS.pICMSST := 0;
                       ICMS.vICMSST := 0;
                       ICMS.pRedBC  := 0;

                       // partilha do ICMS e fundo de probreza
                       with ICMSUFDest do
                       begin
                          vBCUFDest      := 0.00;
                          pFCPUFDest     := 0.00;
                          pICMSUFDest    := 0.00;
                          pICMSInter     := 0.00;
                          pICMSInterPart := 0.00;
                          vFCPUFDest     := 0.00;
                          vICMSUFDest    := 0.00;
                          vICMSUFRemet   := 0.00;
                       end;

                      // tributado
                      if ( ( PontoDeVenda.Cupom[i].Tributacao = 0  ) or
                           ( PontoDeVenda.Cupom[i].Tributacao = 1  ) ) or
                           ( PontoDeVenda.Cupom[i].Picms <> 0  ) then
                         begin
                            ICMS.CST        := ACBrDfe.Conversao.StrToCSTICMS('00'); //devo verificar
                            ICMS.vBC   := Roundto(PontoDeVenda.Cupom[i].Baseicms, -2); // Valor da Base de Cálculo do ICMS
                            ICMS.pICMS := PontoDeVenda.Cupom[i].Picms; // Alíquota do ICMS em Percentual
                            ICMS.vICMS := RoundTo( PontoDeVenda.Cupom[i].Vlicms,-2); // Valor do ICMS em Reais
                         end;

                     // substituto

                     if ( PontoDeVenda.Cupom[i].Tributacao = 10 ) or
                          ( PontoDeVenda.Cupom[i].Tributacao = 60 ) or
                          ( PontoDeVenda.Cupom[i].Tributacao = 5 ) then
                         begin

                            if ( ( PontoDeVenda.Cupom[i].Tributacao = 60 ) or
                                 ( PontoDeVenda.Cupom[i].Tributacao = 10 )  or  // EM 14/11/16 NA COMERCIAL
                                 ( PontoDeVenda.Cupom[i].Tributacao = 5 )  or
                                 ( PontoDeVenda.Cupom[i].Tributacao = 500 ) )  then
                               begin
                                 CST          := cst60;
                                 ICMS.vBCST   := 0;
                                 ICMS.vICMSST := 0;
                               end;

                            if ( ( ( PontoDeVenda.empWork = 'CASADAELETR'  ) or (PontoDeVenda.empWork = 'VISUAL')  ) and
                               ( ( PontoDeVenda.Operacao ='6202' ) or ( PontoDeVenda.Operacao ='6411' ) ) and
                                   (PontoDeVenda.Cupom[i].Tributacao <> 0 ) )
                                 then
                                     begin
                                     end
                                 else
                                     // coloquei essa condição aqui em 11/09 devido a nota com icms e subst no mesmo produto
                                     if ( PontoDeVenda.Cupom[i].Picms =  0 ) then
                                        begin
                                          ICMS.pRedBC  := 0;
                                          ICMS.vBC     := 0;
                                          ICMS.pICMS   := 0;
                                          ICMS.vICMS   := 0;
                                        end;

                            if ( ((PontoDeVenda.operacao   <> '5102')   and
                                  (PontoDeVenda.operacao   <> '6102')   and
                                  (PontoDeVenda.operacao   <> '5913')   and
                                  (PontoDeVenda.operacao   <> '1913')   and
                                  (PontoDeVenda.operacao   <> '7102')   and
                                  (PontoDeVenda.operacao   <> '5202')   and
                                  (PontoDeVenda.operacao   <> '1411')   and
                                  (PontoDeVenda.operacao   <> '1202') ) )
                                then
                                  begin
                                  end
                                else
                                    begin
                                      ICMS.pRedBCST := 0;
                                      ICMS.vBCST    := 0;
                                      ICMS.pICMSST  := 0;
                                      ICMS.modBCST  := modBCST;;
                                      ICMS.vICMSST  := 0;
                                      ICMS.modBCST  := dbisMargemValorAgregado;
                                    end;

                         end;

                          // inicio

                          // isenta ou não tributada
                          if ( PontoDeVenda.Cupom[i].Tributacao = 40 ) or
                             ( PontoDeVenda.Cupom[i].Tributacao = 41 ) or
                             ( PontoDeVenda.Cupom[i].Tributacao = 50 ) then
                            begin
                              ICMS.orig  := ACBrDFe.Conversao.oeNacional;//oeNacional;

                              if (PontoDeVenda.Operacao = '3102' ) then
                                 ICMS.orig := ACBrDFe.Conversao.oeEstrangeiraImportacaoDireta;

                              if ( PontoDeVenda.Cupom[i].Tributacao = 40 ) or
                                 ( PontoDeVenda.Cupom[i].Tributacao = 41 ) then
                                    CST := cst40
                              else
                                if ( PontoDeVenda.Cupom[i].Tributacao = 50 ) then
                                   CST := cst50;

                              ICMS.modBC := dbiValorOperacao;
                            end;


                   end;

                   with PIS do
                     begin

                       //CST           := pis99;
                       CST        := ACBrDfe.Conversao.pis08;
                       PIS.vBC       := 0;
                       PIS.pPIS      := 0;
                       PIS.vPIS      := 0;
                       PIS.qBCProd   := 0;
                       PIS.vAliqProd := 0;
                       PIS.vPIS      := 0;
                       if ( PontoDeVenda.Cupom[i].Pis <> 0 ) then
                           begin
                             CST           := pis01;
                             PIS.vBC       := roundto(PontoDeVenda.Cupom[i].Quantidade * PontoDeVenda.Cupom[i].Preco,-2);
                             PIS.pPIS      := roundto(PontoDeVenda.Cupom[i].pis,-2);
                             PIS.vPIS      := roundto(PontoDeVenda.Cupom[i].VlPis,-2);
                             PIS.qBCProd   := roundto(PontoDeVenda.Cupom[i].Quantidade * PontoDeVenda.Cupom[i].preco,-2);
                             PIS.vAliqProd := roundto(PontoDeVenda.Cupom[i].Pis,-2);
                            end;

                     end;

                   with PISST do
                     begin
                       vBc       := 0;
                       pPis      := 0;
                       qBCProd   := 0;
                       vAliqProd := 0;
                       vPIS      := 0;
                     end;

                   with COFINS do
                     begin

                       CST            := cof99;
                       CST            := ACBrDfe.Conversao.cof08;
                       COFINS.vBC     := 0;
                       COFINS.pCOFINS := 0;
                       COFINS.vCOFINS := 0;

                       COFINS.qBCProd   := 0;
                       COFINS.vAliqProd := 0;

                        if ( PontoDeVenda.Cupom[i].Cofins <> 0 ) then
                         begin
                            CST              := cof01;
                            COFINS.vBC       := roundto(PontoDeVenda.Cupom[i].Quantidade * PontoDeVenda.Cupom[i].preco,-2);
                            COFINS.pCOFINS   := roundto(PontoDeVenda.Cupom[i].Cofins,-2);
                            COFINS.vCOFINS   := roundto(PontoDeVenda.Cupom[i].VlCofins,-2);
                            COFINS.qBCProd   := roundto(PontoDeVenda.Cupom[i].Quantidade * PontoDeVenda.Cupom[i].preco,-2);
                            COFINS.vAliqProd := roundto(PontoDeVenda.Cupom[i].Cofins,-2);
                         end;

                     end;

                   with COFINSST do
                     begin
                       vBC       := 0;
                       pCOFINS   := 0;
                       qBCProd   := 0;
                       vAliqProd := 0;
                       vCOFINS   := 0;
                     end;

                  // aqui IBSCBS
                  with IBSCBS do
                  begin
                     gIBSCBS.vBC     := 0;
                     gIBSCBS.vIBS := 00.00;
                     gIBSCBS.gCBS.pCBS := 0;
                     gIBSCBS.gCBS.vCBS := 00.00;
                     // Situação tributária do IBS
                          CST := cst000;  // Exemplo: Tributado integralmente

                          cClassTrib := '510102'; // Classificação tributária do bem/serviço  verificar as classificações

                          // Base de cálculo
                          gIBSCBS.vBC   := PontoDeVenda.Cupom[i].Vltotitem; // Valor da Base de Cálculo do ICMS
                          // Estadual
                          gIBSCBS.gIBSUF.pIBSUF := 0.1;
                          gIBSCBS.gIBSUF.vIBSUF := SimpleRoundTo(gIBSCBS.vBC * gIBSCBS.gIBSUF.pIBSUF / 100, -2); //gIBSCBS.vBC  * gIBSCBS.gIBSUF.pIBSUF / 100;
                          vTotIBSUF:=vTotIBSUF+gIBSCBS.gIBSUF.vIBSUF;

                          // municipal
                          gIBSCBS.gIBSMun.pIBSMun := 0.1;
                          gIBSCBS.gIBSMun.vIBSMun := SimpleRoundTo(gIBSCBS.vBC * gIBSCBS.gIBSMun.pIBSMun / 100, -2);
                          vTotIBSMun:=vTotIBSMun+gIBSCBS.gIBSMun.vIBSMun;

                          gIBSCBS.vIBS := gIBSCBS.gIBSUF.vIBSUF +  gIBSCBS.gIBSMun.vIBSMun;

                          // Federal
                          gIBSCBS.gCBS.pCBS := 0.9;
                          gIBSCBS.gCBS.vCBS := SimpleRoundTo(gIBSCBS.vBC * gIBSCBS.gCBS.pCBS / 100, -2); //gIBSCBS.vBC  * gIBSCBS.gCBS.pCBS / 100 ;

                          totIBSCBS:=totIBSCBS + gIBSCBS.vIBS + gIBSCBS.gCBS.vCBS; //gIBSCBS.vBC;

                          vTotBCIBSCBS := vTotBCIBSCBS + gIBSCBS.vBC;
                          vTotIBS      := vTotIBS      + gIBSCBS.vIBS;
                          vTotCBS      := vTotCBS      + gIBSCBS.gCBS.vCBS;

                  end;

                   vTotTrib:= IBSCBS.gIBSCBS.gIBSUF.vIBSUF + IBSCBS.gIBSCBS.gCBS.vCBS;
                   totTributo:=totTributo+vTotTrib;

             end;

         end ;
               Total.ICMSTot.vTotTrib := totTributo;
               Total.ICMSTot.vBC      := PontoDeVenda.Baseicm;
               Total.ICMSTot.vICMS    := PontoDeVenda.Vlicm;
              // casos de rejeicao por diferencas de centavos
               if (PontoDeVenda.NovoVlrIcms <> 0) then
                  Total.ICMSTot.vICMS    := PontoDeVenda.NovoVlrIcms;

              Total.ICMSTot.vBCST    := 0;
              Total.ICMSTot.vST      := 0;
              Total.ICMSTot.vProd    := PontoDeVenda.VlProdutos;
              Total.ICMSTot.vFrete   := 0;
              Total.ICMSTot.vSeg     := 0;
              Total.ICMSTot.vDesc    := PontoDeVenda.Desconto;
              Total.ICMSTot.vII      := 0;
              Total.ICMSTot.vIPI     := 0;
              Total.ICMSTot.vPIS     := 0;
              Total.ICMSTot.vCOFINS  := 0;
              Total.ICMSTot.vOutro   := 0;
              Total.ICMSTot.vNF      := PontoDeVenda.vlCupom;
              //
              Total.ISSQNtot.vServ   := 0;
              Total.ISSQNTot.vBC     := 0;
              Total.ISSQNTot.vISS    := 0;
              Total.ISSQNTot.vPIS    := 0;
              Total.ISSQNTot.vCOFINS := 0;

              // partilha do icms e fundo de pobreza
              Total.ICMSTot.vFCPUFDest   := 0.00;
              Total.ICMSTot.vICMSUFDest  := 0.00;
              Total.ICMSTot.vICMSUFRemet := 0.00;

              Total.retTrib.vRetPIS    := 0;
              Total.retTrib.vRetCOFINS := 0;
              Total.retTrib.vRetCSLL   := 0;
              Total.retTrib.vBCIRRF    := 0;
              Total.retTrib.vIRRF      := 0;
              Total.retTrib.vBCRetPrev := 0;
              Total.retTrib.vRetPrev   := 0;

              Transp.modFrete := mfSemFrete; // NFC-e não pode ter FRETE
              //
              // Reforma Tributária
              Total.IBSCBSTot.vBCIBSCBS := SimpleRoundTo(vTotBCIBSCBS, -2);
              Total.IBSCBSTot.gIBS.vIBS  := SimpleRoundTo(vTotIBS, -2);
              Total.IBSCBSTot.gIBS.gIBSUFTot.vIBSUF := SimpleRoundTo(vTotIBSUF,-2);
              Total.IBSCBSTot.gIBS.gIBSMunTot.vIBSMun := SimpleRoundTo(vTotIBSMun,-2);
              Total.IBSCBSTot.gCBS.vCBS := SimpleRoundTo(vTotCBS,-2);
              Total.vNFTot:=PontoDeVenda.vlCupom;


      //with pag.Add do //PAGAMENTOS apenas para NFC-e
      with pag.New do
       begin
         if ( PontoDeVenda.empWork = 'COMERCIAL') then
           begin

             case strtointdef( copy(PontoDeVenda.EssaVenda.TipoPagto,1,3),0 ) of
               001,200:      tPag := fpDinheiro;
               201:          tPag := fpCheque;
               205..209,213: begin
                               if (PontoDeVenda.EssaVenda.CondPagto = '999') then
                                  tPag := fpCartaoDebito
                               else
                                  tPag := fpCartaoCredito;


                                  tpIntegra := tiPagIntegrado;
                                  CNPJ := '00301452000103';
                                  tBand := bcOutros;
                                  cAut := fmCaixa.NSU;
                                  //CNPJReceb := PontoDeVenda.Empresa.cpfCnpj;
                                  //idTermPag := fmCaixa.CAIXA;
                             end;
               214,215:      tPag := fpPagamentoInstantaneo;
               216:          tPag := fpDepositoBancario;
               217:          tPag := fpTransfBancario;
               else
                begin
                  tPag := fpOutro;
                  xpag:=FormaPagamentoToDescricao(tpag,'');
                end;
             end;


             vPag := PontoDeVenda.vlCupom;

           end
         else
            begin

              if ( copy(PontoDeVenda.EssaVenda.TipoPagto,1,3) = '001') then
                begin
                   tPag := fpDinheiro;
//                   ACBrNFeDANFEFR1.vTroco := PontoDeVenda.entrada - PontoDeVenda.vlCupom;
                end

              else
                tPag := fpCartaoCredito;

              vPag := PontoDeVenda.vlCupom;;

            end;

       end;


      ACBrNFe1.DANFE.vTribEst := PontoDeVenda.Vlicm;
      InfAdic.infCpl                          := 'Vendedor: ' + inttostr(PontoDeVenda.EssaVenda.vendedor)  +
                                                 ' Cx: ' + PontoDeVenda.Caixa.Apelido +
                                                 chr(13) + chr(10) +
                                                 '____________________________________________________' +
                                                 chr(13) + chr(10) +
                                                 chr(13) + chr(10) +
                                                 // 24/09/2019 impressão dos tributos no rodapé da nota
                                                 'Trib. Totais Incid. Lei 12.741/2012 Fonte: IBPT' +
                                                 chr(13) + chr(10) +
                                                 'Tot. aprox. trib. federais     R$ 0,00' +
                                                 chr(13) + chr(10) +
                                                 'Tot. aprox. trib. estaduais    R$ '+FormatFloat('###,##0.#0',Total.ICMSTot.vICMS)+
                                                 chr(13) + chr(10) +
                                                 'Tot. aprox. trib. municipais   R$ 0,00' +
                                                 chr(13) + chr(10) +
                                                 chr(13) + chr(10) +
                                                 'Obrigado pela preferencia, aguardamos pelo seu retorno !!!' +
                                                 chr(13) + chr(10) +
                                                 chr(13) + chr(10) +
                                                'Copyright www.templax.com.br';


      InfAdic.infAdFisco :=  '';

     ACBrNFe1.NotasFiscais.GerarNFe;     // Analisar isso posteriormente

  end;

end;

 

estão aí as duas rotinas que fazem gerar as notas fiscais, porém a sefaz de sergipe retorna o erro de hash

  • Consultores
Postado

Anexe quando for postar trechos longos de código. o tópico fica organizado e fácil de entender

 

Vamos começar por algo que ambos tem acesso por completo

pega o exemplo . preenche os dados de uso e com um produto e manda gerar com certificado e manda pra testar

 

Consultora ACBr Pro

Juliomar Marchetti

Ajude o Projeto ACBr crescer - Seja Pro

discord: juliomar
telegram: juliomar
e-mail: [email protected]
http://www.juliomarmarchetti.com.br

 

MVP_NewLogo_100x100_Transparent-02.png
Projeto ACBr - A maior comunidade Open Source de Automação Comercial do Brasil


Participe de nosso canal no Discord e fique ainda mais próximo da Comunidade !!

  • Solution
Postado

meu caro colega, usei o exemplo e depois de muitos testes, consegui colocar para funcionar com o exemplo trocando a versão do QR-Code, antes estava veqr200, alterei para veqr300 e funcionou.

  • Curtir 1
  • Este tópico foi criado há 136 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.
Visitante
Este tópico está agora fechado para novas respostas
×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.

The popup will be closed in 10 segundos...