Ir para conteúdo
  • Cadastre-se

buildinformatica

Membros Pro
  • Total de ítens

    3
  • Registro em

  • Última visita

Posts postados por buildinformatica

  1. Bom já trabalho a um bom tempo com a biblioteca FLEXDOCS, agora estou mudando aos poucos para o ACBr, começando pela CCe.

    Não esta bem claro pra mim quais arquivos/pastas devo anexar para o perfeito funcionamento ...

    Segue a rotina, que fiz as mudanças.

    image.thumb.png.29cd8330f7553f8497a6c09dd615edf1.png

    procedure TDM.ConfigurarNFe(const ACNPJ: string; vDATA: TDate);
    var
      PathApp: String;
      PathDocumentos: String;
    begin
      PathApp := ExtractFilePath(ParamStr(0));
      PathDocumentos := IncludeTrailingPathDelimiter(PathApp + 'NFE'+Format('%2.2d',[vFILIAL])+'\'+FormatDateTime('YYYYMM',vDATA) );
      (* Caso não exista a PASTA, então crie ela *)
      if not DirectoryExists( PathDocumentos ) then CreateDir( PathDocumentos );
      // diretorios
      ACbrNFe1.Configuracoes.Arquivos.PathSchemas := PathApp + 'Schemas\NFe';
      ACbrNFe1.Configuracoes.Arquivos.PathNFe     := PathDocumentos + 'nfe\';
      ACbrNFe1.Configuracoes.Arquivos.PathEvento  := PathDocumentos + 'eventos\';
      ACbrNFe1.Configuracoes.Arquivos.PathInu     := PathDocumentos + 'inutilizacao\';
      ACbrNFe1.Configuracoes.Arquivos.PathSalvar  := PathDocumentos + 'salvar\';
      // diretorio de padfs
      ACbrNFe1.DANFE.PathPDF := PathDocumentos + 'pdf';
      // arquivos baixados
      ACbrNFe1.Configuracoes.Arquivos.DownloadDFe.PathDownload := PathDocumentos + 'download\';
      (* Caso não exista os diretórios, então crie-os *)
      if not DirectoryExists(IncludeTrailingPathDelimiter(PathDocumentos)) then
         CreateDir(IncludeTrailingPathDelimiter(PathDocumentos));
      if not DirectoryExists(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathSchemas)) then
         CreateDir(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathSchemas));
      if not DirectoryExists(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathNFe)) then
         CreateDir(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathNFe));
      if not DirectoryExists(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathEvento)) then
         CreateDir(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathEvento));
      if not DirectoryExists(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathInu)) then
         CreateDir(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathInu));
      if not DirectoryExists(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathSalvar)) then
         CreateDir(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.PathSalvar));
      if not DirectoryExists(IncludeTrailingPathDelimiter(ACbrNFe1.DANFE.PathPDF)) then
         CreateDir(IncludeTrailingPathDelimiter(ACbrNFe1.DANFE.PathPDF));
      if not DirectoryExists(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.DownloadDFe.PathDownload)) then
         CreateDir(IncludeTrailingPathDelimiter(ACbrNFe1.Configuracoes.Arquivos.DownloadDFe.PathDownload));

      // acesso e certificado
      Empresa.Get( ACNPJ );

      if Trim(Empresa.CNPJ) = '' then
        raise EDatabaseError.CreateFmt('CNPJ "%s" não cadastrado!', [ACNPJ]);

      if Empresa.AMBIENTE= 'H' then
        ACBrNFe1.Configuracoes.WebServices.Ambiente := taHomologacao
      else
        ACBrNFe1.Configuracoes.WebServices.Ambiente := taProducao;


      ACBrNFe1.Configuracoes.Certificados.ArquivoPFX  := '';
      ACBrNFe1.Configuracoes.Certificados.NumeroSerie := '';
      ACBrNFe1.Configuracoes.Geral.SSLLib:=libNone;
      ACBrNFe1.SSL.Clear;

      case Empresa.SSL_LIB of
        0:
          begin
            ACBrNFe1.Configuracoes.Geral.SSLLib := libWinCrypt;

            if FileExists(Empresa.CERTIFICADO) then
              ACBrNFe1.Configuracoes.Certificados.ArquivoPFX := Empresa.CERTIFICADO
            else
              ACBrNFe1.Configuracoes.Certificados.NumeroSerie := Empresa.CERTIFICADO;
          end;

        1:
          begin
            ACBrNFe1.Configuracoes.Geral.SSLLib := libOpenSSL;

            if FileExists(Empresa.CERTIFICADO) then
              ACBrNFe1.Configuracoes.Certificados.ArquivoPFX := Empresa.CERTIFICADO
            else
              ACBrNFe1.Configuracoes.Certificados.NumeroSerie := Empresa.CERTIFICADO;
          end;

        2:
          begin
            if Pos('.pfx', Empresa.CERTIFICADO) > 0 then
              raise EDatabaseError.Create('Capicom não suporta carregamento de certificado por arquivo!');

            ACBrNFe1.Configuracoes.Geral.SSLLib := libCapicom;
            ACBrNFe1.Configuracoes.Certificados.NumeroSerie := Empresa.CERTIFICADO;
          end;
      end;

      ACBrNFe1.Configuracoes.Certificados.Senha  := Empresa.CERTIFICADO_SENHA;
      ACBrNFe1.Configuracoes.Geral.SSLXmlSignLib := xsLibXml2;

      ACBrNFe1.Configuracoes.Geral.SSLLib        := libWinCrypt;
      ACBrNFe1.Configuracoes.Geral.SSLCryptLib   := cryWinCrypt;
      ACBrNFe1.Configuracoes.Geral.SSLHttpLib    := httpWinINet;
      ACBrNFe1.Configuracoes.Geral.SSLXmlSignLib := xsMsXml;

      ACBrNFe1.Configuracoes.WebServices.SSLType    := LT_all;
      ACBrNFe1.Configuracoes.WebServices.UF         := Empresa.UF;
      ACBrNFe1.Configuracoes.WebServices.Tentativas := 10;
      ACBrNFe1.Configuracoes.WebServices.TimeOut    := 50000;
    end;
     

×
×
  • 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...