Advertisement
jpfassis

Config_ACbr_NFE

Jul 5th, 2019
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 11.00 KB | None | 0 0
  1. NOTA FISCAL ELETRÔNICA - COMPONENTE ACBRNFE
  2. CONFIGURAÇÕES
  3. Use {para conversão}
  4. pcnconversao, pcnconversaoNFE
  5.  
  6. configuracoes.geral.modeloDF:= moNFE;
  7. configuracoes.geral.versaoDF:= ve400;
  8. formaEmissao:=teNormal;
  9. configuracoes.arquivos.pathSchemas:=(diretório dos arquivos .XSD)
  10. configuracoes.arquivos.separarporCNPJ:=true;
  11. configuracoes.arquivos.separarporAno:=true;
  12. configuracoes.arquivos.separarporMes:=true;
  13.  
  14. webservices.visualisar:=true;
  15. webservices.UF:=’SP’;
  16. webservices.ambiente:=taHomologacao;//ambiente de testes
  17.  
  18. webservices.ajustaAguardaConsultaRet:=True;
  19. webservices.aguardaConsultaRet:=4000; {em milesegundos = 4 segundos}
  20. webservices.intervalotentativas:=1000;
  21. webservices.tentativa:=3;
  22.  
  23. //os arquivos .XSD podem ser encontrados no site da receita
  24. //ou na pasta acbr/exemplos/acbrDFE/Schemas/NFE
  25.  
  26. CONFIGURAÇÃO PARA O CERTIFICADO DIGITAL
  27.  
  28. //tipos de criptografias
  29. //Capicom = foi descontinuado no ACbrNFE
  30. //Wincrypt {nativo do próprio Windows} //aceita certificado A1 e A3
  31. //OpenSSL {Use DLL de terceiros, precisa copiar DLL junto ao EXE} //aceita só certificado A1
  32.  
  33. //Certificado A1 – Fixo – Usa o arquivo PFX instalado no micro – Validade de 1 ano
  34. //Certificado A3 – Móvel – Validade de 3 anos
  35.  
  36. Use {para criptografia}
  37. ACbrDFeSSL
  38.  
  39. SSL.SSLCryptLib:=cryWinCrypt;
  40.  
  41. //se for A3 - móvel
  42. SSL.SelecionarCertificado; //abre o gerenciador de certificados para selecionar o certificado
  43. Configuracoes.certificado.numeroserie:=’’; {para informar o número de série do certificado}
  44. Configuracoes.certificado.verificarValidade;
  45.  
  46. //se for A1 - Fixo
  47. Configuracoes.certificado.PFX:=’’; {diretório do arquivo PFX + nome do arquivo + .PFX}
  48. //não esquecer de informar a extensão
  49. Configuracoes.certificado.senha:=’’; {senha do certificado}
  50. Configuracoes.certificado.verificarValidade;
  51.  
  52. ACBRNF-E
  53.  
  54. Notasfiscais[0].Clear; {limpar dados da nota fiscal}
  55. Notasfiscais[0].Add; {adiciona uma nota fiscal}
  56.  
  57. INFORMANDO DADOS DO EMITENTE(EMISSOR)
  58.  
  59. Notasfiscais[0].NFe.Emit.xNome:=’RAZAO SOCIAL DO EMITENTE’;
  60. Notasfiscais[0].NFe.Emit.xFant:=’NOME FANTASIA DO EMITENTE’;
  61. Notasfiscais[0].NFe.Emit.CNPJCPF:=’00.000.000/0001-00’;
  62. Notasfiscais[0].NFe.Emit.IE:=’0000000000’;
  63. Notasfiscais[0].NFe.Emit.IM:=’0000000000’;
  64. Notasfiscais[0].NFe.Emit.CNAE:=9999;
  65. Notasfiscais[0].NFe.Emit.CRT:=  crtSimplesNacional; {crtRegimeNormal};
  66. Notasfiscais[0].NFe.Emit.EnderEmit.xLgr:=’RUA SETE DE SETEMBRO’;
  67. Notasfiscais[0].NFe.Emit.EnderEmit.nro:=1451;
  68. Notasfiscais[0].NFe.Emit.EnderEmit.xCpl:=’SALA B’;
  69. Notasfiscais[0].NFe.Emit.EnderEmit.xBairro:=’BAIRRO JD. DO SOFTWARE’;
  70. Notasfiscais[0].NFe.Emit.EnderEmit.cMun:=0000000;
  71. Notasfiscais[0].NFe.Emit.EnderEmit.xMun:=’CIDADE’;
  72. Notasfiscais[0].NFe.Emit.EnderEmit.UF:=’SP’;
  73. Notasfiscais[0].NFe.Emit.EnderEmit.cUF:=35;
  74. Notasfiscais[0].NFe.Emit.EnderEmit.CEP:=20490000;
  75. Notasfiscais[0].NFe.Emit.EnderEmit.xPais:=’BRASIL’;
  76. Notasfiscais[0].NFe.Emit.EnderEmit.cPais:=1058;
  77. Notasfiscais[0].NFe.Emit.EnderEmit.Fone:=(19)0000-0000’;
  78.  
  79.  
  80. ACBRNF-E
  81. INFORMANDO DADOS DO DESTINATÁRIO(CLIENTE)
  82.  
  83.  
  84. Notasfiscais[0].NFe.Dest.CNPJCPF:= ’00.000.000/0001-00’;
  85. Notasfiscais[0].NFe.Dest.xNome:= ’NOME DO CLIENTE’;
  86. Notasfiscais[0].NFe.Dest.IM:= ‘’;
  87. Notasfiscais[0].NFe.Dest.IE:= ‘0000000000’;
  88. Notasfiscais[0].NFe.Dest.Email:= ‘email_do_cliente@cliente.com.br;
  89. Notasfiscais[0].NFe.Dest.EnderDest.xLgr:= ‘RUA CARLOS GOMES’;
  90. Notasfiscais[0].NFe.Dest.EnderDest.nro:=1541;
  91. Notasfiscais[0].NFe.Dest.EnderDest.xCpl:= ‘SALA A’;
  92. Notasfiscais[0].NFe.Dest.EnderDest.xBairro:= ‘BAIRRO DO CLIENTE’;
  93. Notasfiscais[0].NFe.Dest.EnderDest.cMun:= 000000;
  94. Notasfiscais[0].NFe.Dest.EnderDest.xMun:= ‘CIDADE DO CLIENTE’;
  95. Notasfiscais[0].NFe.Dest.EnderDest.UF:= ‘SP’;
  96. Notasfiscais[0].NFe.Dest.EnderDest.cUF:= 35;
  97. Notasfiscais[0].NFe.Dest.EnderDest.CEP:= 20490000;
  98. Notasfiscais[0].NFe.Dest.EnderDest.indIEDest:= inIsneto; {inContribuinte, inNaoContribuinte}
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. ACBRNF-E
  109. INFORMANDO DADOS DO CABEÇALHO DA NOTA FISCAL (IDENTIFICAÇÃO DA NOTA FISCAL)
  110. Obs: Não incluir dados com acentos (~^)
  111.  
  112. Notasfiscais[0].NFe.Ide.cUF:= 35;
  113. Notasfiscais[0].NFe.Ide.cNF:= 1; {código da chave de acesso//dica deixar a raiz do CNPJ}
  114. Notasfiscais[0].NFe.Ide.natOp:= ‘VENDA DE MERCADORIAS’;
  115. Notasfiscais[0].NFe.Ide.modelo:= 55;
  116. Notasfiscais[0].NFe.Ide.serie:= 001;
  117. Notasfiscais[0].NFe.Ide.nNF:= 1; {número da nota fiscal}
  118. Notasfiscais[0].NFe.Ide.dEmi:= now; {data de emissão da nota fiscal}
  119. Notasfiscais[0].NFe.Ide.dSaiEnt:= now; {data de saída/entrada}
  120. Notasfiscais[0].NFe.Ide.hSaiEnt:= now; {hora de saída/entrada}
  121. Notasfiscais[0].NFe.Ide.tpNF:= tnSaida; {tipos: tnEntrada/tnSaida}
  122. Notasfiscais[0].NFe.Ide.idDest:= doInterna; {tipos: doInterna/doInterestadual/doExterior}
  123. Notasfiscais[0].NFe.Ide.cMunFG:= 54540540; {código do município do Fato Gerador}
  124. Notasfiscais[0].NFe.Ide.tpImp:= tiRetrato; {tipo de impressão tiRetrato /tiPaisagem}
  125. Notasfiscais[0].NFe.Ide.tpEmis:= teNormal; {tipo de emissão }
  126. Notasfiscais[0].NFe.Ide.tpAmb:= taHomologacao; {tipo de ambiente Homolog/Produção}
  127. Notasfiscais[0].NFe.Ide.finNFe:= fnNormal; {finalidade da emissão: fnNormal/fnDevolução... }
  128. Notasfiscais[0].NFe.Ide.indFianl:= cfSim; { Consumidor final}
  129. Notasfiscais[0].NFe.Ide.indPres:= pcNao; { indicador presença cliente pcPresencial,pcInternet }
  130. Notasfiscais[0].NFe.Ide.procEmi:= peAplicativoContribuinte; { forma do processo de emissão}
  131. Notasfiscais[0].NFe.Ide.procEmi:= ‘1.0.0’; { versão aplicativo de emissão}
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151. ACBRNF-E
  152. INFORMANDO DADOS DO PRODUTO
  153. Obs: Não incluir dados com acentos (~^)
  154.  
  155. Notasfiscais[0].NFe.Det.Clear; { limpa itens de produtos da nota fiscal}
  156. Notasfiscais[0].NFe.Det.Add; { adiciona item de prod. na nota fiscal}//comando está obsoleto
  157. Notasfiscais[0].NFe.Det.New; { adiciona item de prod. na nota fiscal}
  158.  
  159. Notasfiscais[0].NFe.Det.[0].Prod.cProd:=’001’;
  160. Notasfiscais[0].NFe.Det.[0].Prod.nItem:=1;
  161. Notasfiscais[0].NFe.Det.[0].Prod.cEAN:=’SEM GTIN’; {este campo não é obrigatório}
  162. Notasfiscais[0].NFe.Det.[0].Prod.xProd:=’NOME DO PRODUTO’;
  163. Notasfiscais[0].NFe.Det.[0].Prod.NCM:=’021031031’; {NCM DO PRODUTO}
  164. Notasfiscais[0].NFe.Det.[0].Prod.CFOP:=5102; {CFOP DA OPERAÇÃO}
  165. Notasfiscais[0].NFe.Det.[0].Prod.uCom:=’UN’; {Unidade de medida do produto}
  166. Notasfiscais[0].NFe.Det.[0].Prod.qCom:=100; {quantidade vendida do produto}
  167. Notasfiscais[0].NFe.Det.[0].Prod.vUnCom:=10; {valor unitário do produtos}
  168. Notasfiscais[0].NFe.Det.[0].Prod.vProd:=1000; {valor total = quantia x valor do produto}
  169. Notasfiscais[0].NFe.Det.[0].Prod.uTrib:=’UN’; {Unidade de medida tributada}
  170. Notasfiscais[0].NFe.Det.[0].Prod.qTrib:=1; {Quantidade tributada}
  171. Notasfiscais[0].NFe.Det.[0].Prod.vUnTrib:=10; {valor unitário tributado}
  172. Notasfiscais[0].NFe.Det.[0].Prod.cEANTrib:=’SEM GTIN’; {este campo não é obrigatório}
  173.  
  174. ACBRNF-E
  175. INFORMANDO FORMAS DE PAGAMENTO
  176.  
  177. Notasfiscais[0].NFe.pag.Clear; { limpa as formas de pagamentos da nota fiscal}
  178. Notasfiscais[0].NFe.pag.Add; {Adiciona forma de pagamento da nota fiscal}
  179.  
  180. //exemplo no dinheiro
  181. Notasfiscais[0].NFe.pag[0].indPag:=ipVista; {indicador de pagamento: ipVista/ipPrazo }
  182. Notasfiscais[0].NFe.pag[0].tPag:=fpDinheiro; {forma de pagto: ipDinheiro/ipCartaoCredito}
  183. Notasfiscais[0].NFe.pag[0].vPag:=10; {valor do pagamento}
  184.  
  185. //exemplo no Cartão Débito
  186. Notasfiscais[0].NFe.pag[0].indPag:=ipVista; {indicador de pagamento: ipVista/ipPrazo }
  187. Notasfiscais[0].NFe.pag[0].tPag:=fpCartaoDebito; {forma de pagto}
  188. Notasfiscais[0].NFe.pag[0].vPag:=10; {valor do pagamento}
  189. Notasfiscais[0].NFe.pag[0].tpIntegra:= tiIntegrado; {tiIntegrado, tinaoIntegrado, tiNaoInformado}//tipo de integração com máquina de cartão
  190. Notasfiscais[0].NFe.pag[0].tBand:=bcVisa; {bandeira do cartão: bcVisa, bcMastercard }
  191. Notasfiscais[0].NFe.pag[0].cAut:=’054035’; { código da autorização – nsu do cartão }
  192. Notasfiscais[0].NFe.pag[0].CNPJ:=’ 00.000.000/0001-00’; {CNPJ da administradora }
  193.  
  194. //exemplo no boleto bancario
  195. Notasfiscais[0].NFe.pag[0].indPag:=ipPrazo; {indicador de pagamento: ipVista/ipPrazo }
  196. Notasfiscais[0].NFe.pag[0].tPag:=fpBoletoBancario; {forma de pagto: ipDinheiro/ipCartaoCredito/ ipBoletoBancario }
  197. Notasfiscais[0].NFe.pag[0].vPag:=10; {valor do pagamento}
  198.  
  199. ACBRNF-E
  200. INFORMANDO FRETE
  201. Notasfiscais[0].NFe.Transp.modFrete:=mfSemFrete; {Tipo do frete: mfProprioDestinatario, mfContaTerceiros}
  202. // Notasfiscais[0].NFe.Transp.retTransp {impostos sobre o transporte}
  203. //Notasfiscais[0].NFe.Transp.veicTransp.placa:=’XXX-0099’ {placa do veículo do transporte}
  204. //Notasfiscais[0].NFe.Transp.veicTransp.uf:=’SP’ {UF do veículo do transporte}
  205. //Notasfiscais[0].NFe.Transp.Vol.Add {Adiciona volumes}
  206.  
  207.  
  208. ACBRNF-E
  209. INFORMANDO ICMS
  210.  
  211. //para CST = Regime Normal
  212. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.origem:=oeNacional; {origem da mercadoria}
  213. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.CST:=cst00; {código CST}
  214. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.modBC:=dbiValorOperacao; {modal. base de cálculo}
  215. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.vBC:=10; {valor da base de cálculo}
  216. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.pICMS:=18; {Alíquota de ICMS}
  217. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.vICMS:=1.8; {Valor do ICMS}
  218.  
  219. //para CSOSN = Simples Nacional
  220. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.origem:=oeNacional; {origem da mercadoria}
  221. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.CSOSN:=csosn101; {código CSOSN}
  222. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.pCredSN:=18; { Alíquota de ICMS }
  223.  
  224. //para casos com ST = incluir o campo CEST do produto
  225. Notasfiscais[0].NFe.Det[0].Prod.CEST=11212128; { código do CEST do produto }
  226.  
  227.  
  228.  
  229.  
  230. ACBRNF-E
  231. INFORMANDO FUNDO DE COMBATE A POBREZA
  232.  
  233. //FCP sem Substituição Tributária
  234. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.pFCP:=2; {Aliquota do FCP}
  235. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.vFCP:=0.20; {Valor do FCP}
  236. Notasfiscais[0].NFe.Det[0].Imposto.ICMSTot.vFCP:=0.20; {Valor total do FCP}
  237.  
  238. //FCP com Substituição Tributária
  239. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.pFCP:=0; {Aliquota do FCP}
  240. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.vFCP:=0; {Valor do FCP}
  241. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.vBCFCP:=0; {Valor Base Cálculo do FCP}
  242. Notasfiscais[0].NFe.Det[0].Imposto.ICMSTot.vFCP:=0; {Valor do FCP}
  243. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.vBCFCPST:=20; {Valor Base Cálculo do FCP ST}
  244. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.pFCPST:=2; { Aliquota do FCP ST}
  245. Notasfiscais[0].NFe.Det[0].Imposto.ICMS.vFCPST:=0.40; { Valor do FCP ST}
  246. Notasfiscais[0].NFe.Det[0].Imposto.ICMSTot.vFCPST:=0.40; {Valor total do FCPST}
  247.  
  248. //exibir as informações sobre o FCP na nota fiscal
  249. Habilitar Propriedade ExibirBandInfoAdicProduto:=true; //no componente ACBrNFeDanfe
  250. Notasfiscais[0].NFe.Det[0].InfAdProd:=’Base Calculo FCP: 10 – Valor FCP: 0,20; {informações adicionais do produto sobre Valor do FCP}
  251. Notasfiscais[0].NFe.InfAdic.InfAdFisco:=’Total Base Calculo FCP: 10 – Valor FCP: 0,20; {informações adicionais do fisco sobre Valor do FCP}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement