Usuário com melhor resposta
Não consigo Consumir Web Service da NFe 2.00

Pergunta
-
Respostas
-
Opa então EderAdz.
Bom tem um Exemplo q irá lhe ajudar bastante já q a linguagem e a C#...
Na Internet o pessoal da Empresa UNAMAKE disponibiliza o Fonte de Aplicativo Emissor de Notas Fiscais. para auxilio de quem está começando com o projeto.O Conteudo e otimo e com ele dá para vc desenvolver toda a parte do projeto no qual e relacionado a comunicação com os Web Services do governo.
Agora com relação a criar um XML para que possa ser validado e Enviado para os WS.Postei aqui um codigo de minha autoria. só que em VB.NET mais axo que não terá muita duvida para converte-lo para C#.Só uma pequena OBS. Este codigo tenta gerar a nota fiscal na versão 2.0
Ainda não usei criei mesmo para ajudar o pessoal Mas acredito que a logica que foi aplicada esteja facil de se entender.
Public Class NFEletronica Private dsNFe As New DataSet Public _TotaisIndice As String #Region "Variaveis para gerar a NF-e" 'Objetos do tipo Datarow que representão 'Novas linhas no dataset Carregado com o Schema XSD da Versão 2.00 'da Nota Fiscal Eletronica 'Com essas Datarow´s manipulo os dados Indexando e inserindo valores 'separadamente por Tabelas.Após as principais tabelas serem preenchidas 'corretamente adiono as novas linhas ao dataset e gero um XML atravês dele. ' ' ' ' Dim drNFe As DataRow = dsNFe.Tables("NFe").NewRow Dim drInfNfe As DataRow = dsNFe.Tables("InfNFe").NewRow Dim drNFref As DataRow = dsNFe.Tables("NFref").NewRow Dim dride As DataRow = dsNFe.Tables("ide").NewRow Dim dremit As DataRow = dsNFe.Tables("emit").NewRow Dim drenderEmit As DataRow = dsNFe.Tables("enderEmit").NewRow Dim drdest As DataRow = dsNFe.Tables("dest").NewRow Dim drenderDest As DataRow = dsNFe.Tables("enderDest").NewRow Dim drdet As DataRow = dsNFe.Tables("det").NewRow Dim drprod As DataRow = dsNFe.Tables("prod").NewRow Dim drmed As DataRow = dsNFe.Tables("med").NewRow Dim drarma As DataRow = dsNFe.Tables("arma").NewRow Dim drcomb As DataRow = dsNFe.Tables("comb").NewRow Dim drICMS00 As DataRow = dsNFe.Tables("ICMS00").NewRow Dim drICMS10 As DataRow = dsNFe.Tables("ICMS10").NewRow Dim drICMS20 As DataRow = dsNFe.Tables("ICMS20").NewRow Dim drICMS30 As DataRow = dsNFe.Tables("ICMS30").NewRow Dim drICMS40 As DataRow = dsNFe.Tables("ICMS40").NewRow Dim drICMS51 As DataRow = dsNFe.Tables("ICMS51").NewRow Dim drICMS60 As DataRow = dsNFe.Tables("ICMS60").NewRow Dim drICMS70 As DataRow = dsNFe.Tables("ICMS70").NewRow Dim drICMS90 As DataRow = dsNFe.Tables("ICMS90").NewRow Dim drICMSPart As DataRow = dsNFe.Tables("ICMSPart").NewRow Dim drICMSST As DataRow = dsNFe.Tables("ICMSST").NewRow Dim drICMSSN101 As DataRow = dsNFe.Tables("ICMSSN101").NewRow Dim drICMSSN102 As DataRow = dsNFe.Tables("ICMSSN102").NewRow Dim drICMSSN201 As DataRow = dsNFe.Tables("ICMSSN201").NewRow Dim drICMSSN202 As DataRow = dsNFe.Tables("ICMSSN202 ").NewRow Dim drICMSSN500 As DataRow = dsNFe.Tables("ICMSSN500").NewRow Dim drICMSSN900 As DataRow = dsNFe.Tables("ICMSSN900").NewRow Dim drrefNF As DataRow = dsNFe.Tables("refNF").NewRow Dim drrefNFP As DataRow = dsNFe.Tables("refNFP").NewRow Dim drrefECF As DataRow = dsNFe.Tables("refECF").NewRow Dim dravulsa As DataRow = dsNFe.Tables("avulsa").NewRow Dim drretirada As DataRow = dsNFe.Tables("retirada").NewRow Dim drentrega As DataRow = dsNFe.Tables("entrega").NewRow Dim drDI As DataRow = dsNFe.Tables("DI").NewRow Dim dradi As DataRow = dsNFe.Tables("adi").NewRow Dim drveicProd As DataRow = dsNFe.Tables("veicProd").NewRow Dim drCIDE As DataRow = dsNFe.Tables("CIDE").NewRow Dim drIPI As DataRow = dsNFe.Tables("IPI").NewRow Dim drIPITrib As DataRow = dsNFe.Tables("IPITrib").NewRow Dim drIPINT As DataRow = dsNFe.Tables("IPINT").NewRow Dim drII As DataRow = dsNFe.Tables("II").NewRow Dim drISSQN As DataRow = dsNFe.Tables("ISSQN").NewRow Dim drPISAliq As DataRow = dsNFe.Tables("PISAliq").NewRow Dim drPISQtde As DataRow = dsNFe.Tables("PISQtde").NewRow Dim drPISNT As DataRow = dsNFe.Tables("PISNT").NewRow Dim drPISOutr As DataRow = dsNFe.Tables("PISOutr").NewRow Dim drPISST As DataRow = dsNFe.Tables("PISST").NewRow Dim drCOFINSAliq As DataRow = dsNFe.Tables("COFINSAliq").NewRow Dim drCOFINSQtde As DataRow = dsNFe.Tables("COFINSQtde").NewRow Dim drCOFINSNT As DataRow = dsNFe.Tables("COFINSNT").NewRow Dim drCOFINSOutr As DataRow = dsNFe.Tables("COFINSOutr").NewRow Dim drCOFINSST As DataRow = dsNFe.Tables("COFINSST").NewRow Dim drICMSTot As DataRow = dsNFe.Tables("ICMSTot").NewRow Dim drISSQNtot As DataRow = dsNFe.Tables("ISSQNtot").NewRow Dim drretTrib As DataRow = dsNFe.Tables("retTrib").NewRow Dim drtransp As DataRow = dsNFe.Tables("transp").NewRow Dim drtransporta As DataRow = dsNFe.Tables("transporta").NewRow Dim drretTransp As DataRow = dsNFe.Tables("retTransp").NewRow Dim drveicTransp As DataRow = dsNFe.Tables("veicTransp").NewRow Dim drreboque As DataRow = dsNFe.Tables("reboque").NewRow Dim drvol As DataRow = dsNFe.Tables("vol").NewRow Dim drlacres As DataRow = dsNFe.Tables("lacres").NewRow Dim drfat As DataRow = dsNFe.Tables("fat").NewRow Dim drdup As DataRow = dsNFe.Tables("dup").NewRow Dim drinfAdic As DataRow = dsNFe.Tables("infAdic").NewRow Dim drobsCont As DataRow = dsNFe.Tables("obsCont").NewRow Dim drobsFisco As DataRow = dsNFe.Tables("obsFisco").NewRow Dim drprocRef As DataRow = dsNFe.Tables("procRef").NewRow Dim drexporta As DataRow = dsNFe.Tables("exporta").NewRow Dim drcompra As DataRow = dsNFe.Tables("compra").NewRow Dim drcana As DataRow = dsNFe.Tables("cana").NewRow Dim drforDia As DataRow = dsNFe.Tables("forDia").NewRow Dim drdeduc As DataRow = dsNFe.Tables("deduc").NewRow Dim drICMS As DataRow = dsNFe.Tables("ICMS").NewRow Dim drImposto As DataRow = dsNFe.Tables("imposto").NewRow #End Region Public WriteOnly Property l_SCHEMAxsd() As String 'Get ' Dim _xml As String ' _xml = dsNFe.GetXml ' _xml = Replace(_xml, "standalone=""yes""", "encoding=""UTF-8""") ' _xml = Replace(_xml, "<NewDataSet xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://www.portalfiscal.inf.br/nfe"">", "") ' _xml = Replace(_xml, "</NewDataSet>", "</NFe>") ' Return _xml 'End Get Set(ByVal value As String) If IO.File.Exists(value) = True And value.Substring(value.Length - 4) = ".xsd" Then dsNFe.ReadXmlSchema(value) Else MsgBox("Não consegui encontrar o Schema da NF-e 2.00") End If End Set End Property #Region "PRINCIPAIS FUNÇÕES PARA GERAR O XML" Public Sub Gera_Indices(ByVal Indice As Integer) With drNFe .Item("Nfe_Id") = Indice .Table.Namespace = "http://www.portalfiscal.inf.br/nfe" End With dsNFe.Tables("Nfe").Rows.Add(drNFe) With drInfNfe .Item("NFe_Id") = drNFe.Item("Nfe_Id") .Item("versao") = "2.00" End With dsNFe.Tables("infNfe").Rows.Add(drInfNfe) End Sub Public Sub NFRef(ByVal CAMPO_refNFe As String, Optional ByVal CAMPO_refCTe As String = "") With drNFref .Item("refNFe") = CAMPO_refNFe '.Item("refCTe") = CAMPO_refCTe End With dsNFe.Tables("NFref").Rows.Add(drNFref) End Sub Public Sub Gerar_IDE(ByVal CAMPO_natOp As String, ByVal CAMPO_indPag As Integer, ByVal CAMPO_mod As String, _ ByVal CAMPO_serie As String, ByVal CAMPO_nNF As Integer, ByVal CAMPO_dEmi As Date, _ ByVal CAMPO_hSaiEnt As DateTime, ByVal CAMPO_dSaiEnt As Date, ByVal CAMPO_tpNF As Integer, _ ByVal CAMPO_cMunFG As Integer, ByVal CAMPO_tpImp As Integer, ByVal CAMPO_tpEmis As Integer, _ ByVal CAMPO_tpAmb As Integer, ByVal CAMPO_finNFe As Integer, ByVal CAMPO_procEmi As Integer, _ ByVal CAMPO_verProc As String, ByVal CAMPO_dhCont As String) With dride '.Item("cUF") = CAMPO_cUF 'Codigo que deverá ser pego após Informar a UF do Emitente '.Item("cNF") = CAMPO_cNF 'Deverá ser inserido após o HASH da NF-e ser Gerado .Item("natOp") = CAMPO_natOp .Item("indPag") = CAMPO_indPag .Item("mod") = CAMPO_mod .Item("serie") = CAMPO_serie .Item("nNF") = CAMPO_nNF .Item("dEmi") = CAMPO_dEmi .Item("dSaiEnt") = CAMPO_dSaiEnt .Item("hSaiEnt") = CAMPO_hSaiEnt .Item("tpNF") = CAMPO_tpNF .Item("cMunFG") = CAMPO_cMunFG .Item("tpImp") = CAMPO_tpImp .Item("tpEmis") = CAMPO_tpEmis '.Item("cDV") = CAMPO_cDV 'Esse campo deverá ser inserido após ser gerado o Numero HASH da Nota .Item("tpAmb") = CAMPO_tpAmb .Item("finNFe") = CAMPO_finNFe .Item("procEmi") = CAMPO_procEmi .Item("verProc") = CAMPO_verProc .Item("dhCont") = CAMPO_dhCont .Item("InfNFe_Id") = drInfNfe.Item("infNFe_Id") End With End Sub Public Sub Gerar_Emitente(ByVal CAMPO_CNPJ As String, ByVal CAMPO_CPF As String, ByVal CAMPO_xNome As String, _ ByVal CAMPO_xFant As String, ByVal CAMPO_IE As String, ByVal CAMPO_IEST As String, _ ByVal CAMPO_IM As String, ByVal CAMPO_xLgr As String, ByVal CAMPO_nro As String, _ ByVal CAMPO_xCpl As String, ByVal CAMPO_xBairro As String, ByVal CAMPO_xMun As String, _ ByVal CAMPO_UF As String, ByVal CAMPO_CEP As Integer, ByVal CAMPO_xPais As String, _ ByVal CAMPO_fone As Integer, Optional ByVal CAMPO_CRT As String = "", Optional ByVal CAMPO_CNAE As String = "") With dremit .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xNome") = CAMPO_xNome .Item("xFant") = CAMPO_xFant .Item("IE") = CAMPO_IE .Item("IEST") = CAMPO_IEST .Item("IM") = CAMPO_IM .Item("CNAE") = CAMPO_CNAE .Item("CRT") = CAMPO_CRT .Item("infNFe_Id") = drInfNfe.Item("infNFe_Id") End With With drenderEmit .Item("xLgr") = CAMPO_xLgr .Item("nro") = CAMPO_nro .Item("xCpl") = CAMPO_xCpl .Item("xBairro") = CAMPO_xBairro '.Item("cMun") = 'FuncaoMunicipios(CAMPO_xMun) .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF .Item("CEP") = CAMPO_CEP .Item("cPais") = 1058 'FuncaoPais(CAMPO_xPais) .Item("xPais") = CAMPO_xPais .Item("fone") = CAMPO_fone .Item("emit_Id") = dremit.Item("emit_Id") End With 'Complementando as informações da TAG IDE dsNFe.Tables("ide").Rows(0).Item("cUF") = "MG" 'FuncaoEstado(CAMPO_UF) End Sub Public Sub Gerar_destinatario(ByVal CAMPO_CNPJ As String, ByVal CAMPO_CPF As String, ByVal CAMPO_xNome As String, _ ByVal CAMPO_xFant As String, ByVal CAMPO_IE As String, ByVal CAMPO_ISUF As String, _ ByVal CAMPO_email As String, ByVal CAMPO_xLgr As String, ByVal CAMPO_nro As String, _ ByVal CAMPO_xCpl As String, ByVal CAMPO_xBairro As String, ByVal CAMPO_xMun As String, _ ByVal CAMPO_UF As String, ByVal CAMPO_CEP As Integer, ByVal CAMPO_xPais As String, _ ByVal CAMPO_fone As Integer) With drdest .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xNome") = CAMPO_xNome .Item("IE") = CAMPO_IE .Item("ISUF") = CAMPO_ISUF .Item("email") = CAMPO_email .Item("infNFe_Id") = drInfNfe.Item("infNFe_Id") End With With drenderDest .Item("xLgr") = CAMPO_xLgr .Item("nro") = CAMPO_nro .Item("xCpl") = CAMPO_xCpl .Item("xBairro") = CAMPO_xBairro '.Item("cMun") = 'FuncaoMunicipios(CAMPO_xMun) .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF .Item("CEP") = CAMPO_CEP .Item("cPais") = 1058 'FuncaoPais(CAMPO_xPais) .Item("xPais") = CAMPO_xPais .Item("fone") = CAMPO_fone .Item("dest_Id") = drdest.Item("dest_Id") End With End Sub Public Sub Gerar_Produtos(ByVal INDICE_Prod As Integer, ByVal CAMPO_cProd As Integer, ByVal CAMPO_cEAN As String, _ ByVal CAMPO_xProd As String, ByVal CAMPO_NCM As String, ByVal CAMPO_EXTIPI As String, _ ByVal CAMPO_CFOP As String, ByVal CAMPO_uCom As String, ByVal CAMPO_qCom As Double, _ ByVal CAMPO_vUnCom As Double, ByVal CAMPO_vProd As Double, ByVal CAMPO_cEANTrib As String, _ ByVal CAMPO_uTrib As String, ByVal CAMPO_qTrib As Double, ByVal CAMPO_vUnTrib As Double, _ ByVal CAMPO_vFrete As Double, ByVal CAMPO_vSeg As Double, ByVal CAMPO_vDesc As Double, _ Optional ByVal CAMPO_vOutro As Double = 0, Optional ByVal CAMPO_indTot As String = "", _ Optional ByVal CAMPO_xPed As String = "", Optional ByVal CAMPO_nItemPed As String = "", Optional ByVal CAMPO_infAdProd As String = "") With drdet .Item("nItem") = INDICE_Prod + 1 .Item("det_Id") = INDICE_Prod .Item("infAdProd") = CAMPO_infAdProd End With With drprod .Item("cProd") = CAMPO_cProd .Item("cEAN") = CAMPO_cEAN .Item("xProd") = CAMPO_xProd .Item("NCM") = CAMPO_NCM .Item("EXTIPI") = CAMPO_EXTIPI .Item("CFOP") = CAMPO_CFOP .Item("uCom") = CAMPO_uCom .Item("qCom") = CAMPO_qCom .Item("vUnCom") = CAMPO_vUnCom .Item("vProd") = CAMPO_vProd .Item("cEANTrib") = CAMPO_cEANTrib .Item("uTrib") = CAMPO_uTrib .Item("qTrib") = CAMPO_qTrib .Item("vUnTrib") = CAMPO_vUnTrib .Item("vFrete") = CAMPO_vFrete .Item("vSeg") = CAMPO_vSeg .Item("vDesc") = CAMPO_vDesc .Item("vOutro") = CAMPO_vOutro .Item("indTot") = CAMPO_indTot .Item("xPed") = CAMPO_xPed .Item("nItemPed") = CAMPO_nItemPed .Item("det_Id") = drdet.Item("det_Id") End With With drImposto .Item("det_id") = drdet.Item("det_Id") End With dsNFe.Tables("imposto").Rows.Add(drImposto) With drICMS .Item("imposto_Id") = drImposto.Item("imposto_Id") End With dsNFe.Tables("ICMS").Rows.Add(drICMS) End Sub #End Region #Region "FUNÇÕES QUE COMPLEMENTAM A DESCRIÇÃO DO PRODUTO" Public Sub Complementar_Produto(ByVal MEDICAMENTO_nLote As String, ByVal MEDICAMENTO_qLote As Double, ByVal MEDICAMENTO_dFab As Date, ByVal MEDICAMENTO_dVal As Date, ByVal MEDICAMENTO_vPMC As Double) With drmed .Item("nLote") = MEDICAMENTO_nLote .Item("qLote") = MEDICAMENTO_qLote .Item("dFab") = MEDICAMENTO_dFab .Item("dVal") = MEDICAMENTO_dVal .Item("vPMC") = MEDICAMENTO_vPMC .Item("prod_Id") = drprod.Item("prod_Id") End With End Sub Public Sub Complementar_Produto(ByVal ARMA_tpArma As String, ByVal ARMA_nSerie As String, ByVal ARMA_nCano As String, ByVal ARMA_descr As String) With drarma .Item("tpArma") = ARMA_tpArma .Item("nSerie") = ARMA_nSerie .Item("nCano") = ARMA_nCano .Item("descr") = ARMA_descr .Item("prod_Id") = drprod.Item("prod_Id") End With End Sub Public Sub Complementar_Produto(ByVal COMBUSTIVEL_cProdANP As String, ByVal COMBUSTIVEL_CODIF As String, ByVal COMBUSTIVEL_qTemp As Double, ByVal COMBUSTIVEL_UFCons As String) With drcomb .Item("cProdANP") = COMBUSTIVEL_cProdANP .Item("CODIF") = COMBUSTIVEL_CODIF .Item("qTemp") = COMBUSTIVEL_qTemp .Item("UFCons") = COMBUSTIVEL_UFCons .Item("prod_Id") = drprod.Item("prod_Id") End With End Sub #End Region #Region "FUNÇÕES PARA GERAR OS ICMS" Public Sub Gerar_000(ByVal ICMS00_orig As Integer, ByVal ICMS00_CST As String, ByVal ICMS00_modBC As String, ByVal ICMS00_vBC As Double, ByVal ICMS00_pICMS As Double, ByVal ICMS00_vICMS As Double) With drICMS00 .Item("orig") = ICMS00_orig .Item("CST") = ICMS00_CST .Item("modBC") = ICMS00_modBC .Item("vBC") = ICMS00_vBC .Item("pICMS") = ICMS00_pICMS .Item("vICMS") = ICMS00_vICMS .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_010(ByVal ICMS10_orig As Integer, ByVal ICMS10_CST As String, ByVal ICMS10_modBC As String, _ ByVal ICMS10_vBC As Double, ByVal ICMS10_pICMS As Double, ByVal ICMS10_vICMS As Double, _ ByVal ICMS10_modBCST As String, ByVal ICMS10_pMVAST As Double, ByVal ICMS10_pRedBCST As Double, _ ByVal ICMS10_vBCST As Double, ByVal ICMS10_pICMSST As Double, ByVal ICMS10_vICMSST As Double) With drICMS10 .Item("orig") = ICMS10_orig .Item("CST") = ICMS10_CST .Item("modBC") = ICMS10_modBC .Item("vBC") = ICMS10_vBC .Item("pICMS") = ICMS10_pICMS .Item("vICMS") = ICMS10_vICMS .Item("modBCST") = ICMS10_modBCST .Item("pMVAST") = ICMS10_pMVAST .Item("pRedBCST") = ICMS10_pRedBCST .Item("vBCST") = ICMS10_vBCST .Item("pICMSST") = ICMS10_pICMSST .Item("vICMSST") = ICMS10_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_020(ByVal ICMS20_orig As Integer, ByVal ICMS20_CST As String, ByVal ICMS20_modBC As String, _ ByVal ICMS20_pRedBC As Double, ByVal ICMS20_vBC As Double, ByVal ICMS20_pICMS As Double, _ ByVal ICMS20_vICMS As Double) With drICMS20 .Item("orig") = ICMS20_orig .Item("CST") = ICMS20_CST .Item("modBC") = ICMS20_modBC .Item("pRedBC") = ICMS20_pRedBC .Item("vBC") = ICMS20_vBC .Item("pICMS") = ICMS20_pICMS .Item("vICMS") = ICMS20_vICMS .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_030(ByVal ICMS30_orig As Integer, ByVal ICMS30_CST As String, ByVal ICMS30_modBCST As String, _ ByVal ICMS30_pMVAST As Double, ByVal ICMS30_pRedBCST As Double, ByVal ICMS30_vBCST As Double, _ ByVal ICMS30_pICMSST As Double, ByVal ICMS30_vICMSST As Double) With drICMS30 .Item("orig") = ICMS30_orig .Item("CST") = ICMS30_CST .Item("modBCST") = ICMS30_modBCST .Item("pMVAST") = ICMS30_pMVAST .Item("pRedBCST") = ICMS30_pRedBCST .Item("vBCST") = ICMS30_vBCST .Item("pICMSST") = ICMS30_pICMSST .Item("vICMSST") = ICMS30_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_040(ByVal ICMS40_orig As Integer, ByVal ICMS40_CST As String, ByVal ICMS40_vICMS As Double, ByVal ICMS40_motDesICMS As String) With drICMS40 .Item("orig") = ICMS40_orig .Item("CST") = ICMS40_CST .Item("vICMS") = ICMS40_vICMS .Item("motDesICMS") = ICMS40_motDesICMS .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_051(ByVal ICMS51_orig As Integer, ByVal ICMS51_CST As String, ByVal ICMS51_modBC As String, ByVal ICMS51_pRedBC As Double, _ ByVal ICMS51_vBC As Double, ByVal ICMS51_pICMS As Double, ByVal ICMS51_vICMS As Double) With drICMS51 .Item("orig") = ICMS51_orig .Item("CST") = ICMS51_CST .Item("modBC") = ICMS51_modBC .Item("pRedBC") = ICMS51_pRedBC .Item("vBC") = ICMS51_vBC .Item("pICMS") = ICMS51_pICMS .Item("vICMS") = ICMS51_vICMS .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_060(ByVal ICMS60_orig As Integer, ByVal ICMS60_CST As String, ByVal ICMS60_vBCSTRet As Double, ByVal ICMS60_vICMSSTRet As Double) With drICMS60 .Item("orig") = ICMS60_orig .Item("CST") = ICMS60_CST .Item("vBCSTRet") = ICMS60_vBCSTRet .Item("vICMSSTRet") = ICMS60_vICMSSTRet .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_070(ByVal ICMS70_orig As Integer, ByVal ICMS70_CST As String, ByVal ICMS70_modBC As String, ByVal ICMS70_pRedBC As Double, ByVal ICMS70_vBC As Double, ByVal ICMS70_pICMS As Double, ByVal ICMS70_vICMS As Double, _ ByVal ICMS70_modBCST As String, ByVal ICMS70_pMVAST As Double, ByVal ICMS70_pRedBCST As Double, _ ByVal ICMS70_vBCST As Double, ByVal ICMS70_pICMSST As Double, ByVal ICMS70_vICMSST As Double) With drICMS70 .Item("orig") = ICMS70_orig .Item("CST") = ICMS70_CST .Item("modBC") = ICMS70_modBC .Item("pRedBC") = ICMS70_pRedBC .Item("vBC") = ICMS70_vBC .Item("pICMS") = ICMS70_pICMS .Item("vICMS") = ICMS70_vICMS .Item("modBCST") = ICMS70_modBCST .Item("pMVAST") = ICMS70_pMVAST .Item("pRedBCST") = ICMS70_pRedBCST .Item("vBCST") = ICMS70_vBCST .Item("pICMSST") = ICMS70_pICMSST .Item("vICMSST") = ICMS70_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_090(ByVal ICMS90_orig As Integer, ByVal ICMS90_CST As String, ByVal ICMS90_modBC As String, _ ByVal ICMS90_vBC As Double, ByVal ICMS90_pRedBC As Double, ByVal ICMS90_pICMS As Double, _ ByVal ICMS90_vICMS As Double, ByVal ICMS90_modBCST As String, ByVal ICMS90_pMVAST As Double, _ ByVal ICMS90_pRedBCST As Double, ByVal ICMS90_vBCST As Double, ByVal ICMS90_pICMSST As Double, _ ByVal ICMS90_vICMSST As Double) With drICMS90 .Item("orig") = ICMS90_orig .Item("CST") = ICMS90_CST .Item("modBC") = ICMS90_modBC .Item("vBC") = ICMS90_vBC .Item("pRedBC") = ICMS90_pRedBC .Item("pICMS") = ICMS90_pICMS .Item("vICMS") = ICMS90_vICMS .Item("modBCST") = ICMS90_modBCST .Item("pMVAST") = ICMS90_pMVAST .Item("pRedBCST") = ICMS90_pRedBCST .Item("vBCST") = ICMS90_vBCST .Item("pICMSST") = ICMS90_pICMSST .Item("vICMSST") = ICMS90_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSPart(ByVal ICMSPart_orig As Integer, ByVal ICMSPart_CST As String, ByVal ICMSPart_modBC As String, _ ByVal ICMSPart_vBC As Double, ByVal ICMSPart_pRedBC As Double, ByVal ICMSPart_pICMS As Double, _ ByVal ICMSPart_vICMS As Double, ByVal ICMSPart_modBCST As String, ByVal ICMSPart_pMVAST As Double, _ ByVal ICMSPart_pRedBCST As Double, ByVal ICMSPart_vBCST As Double, ByVal ICMSPart_pICMSST As Double, ByVal ICMSPart_vICMSST As Double, _ ByVal ICMSPart_pBCOp As Double, ByVal ICMSPart_UFST As String) With drICMSPart .Item("orig") = ICMSPart_orig .Item("CST") = ICMSPart_CST .Item("modBC") = ICMSPart_modBC .Item("vBC") = ICMSPart_vBC .Item("pRedBC") = ICMSPart_pRedBC .Item("pICMS") = ICMSPart_pICMS .Item("vICMS") = ICMSPart_vICMS .Item("modBCST") = ICMSPart_modBCST .Item("pMVAST") = ICMSPart_pMVAST .Item("pRedBCST") = ICMSPart_pRedBCST .Item("vBCST") = ICMSPart_vBCST .Item("pICMSST") = ICMSPart_pICMSST .Item("vICMSST") = ICMSPart_vICMSST .Item("pBCOp") = ICMSPart_pBCOp .Item("UFST") = ICMSPart_UFST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSST(ByVal ICMSST_orig As Integer, ByVal ICMSST_CST As String, ByVal ICMSST_vBCSTRet As Double, ByVal ICMSST_vICMSSTRet As Double, ByVal ICMSST_vBCSTDest As Double, ByVal ICMSST_vICMSSTDest As Double) With drICMSST .Item("orig") = ICMSST_orig .Item("CST") = ICMSST_CST .Item("vBCSTRet") = ICMSST_vBCSTRet .Item("vICMSSTRet") = ICMSST_vICMSSTRet .Item("vBCSTDest") = ICMSST_vBCSTDest .Item("vICMSSTDest") = ICMSST_vICMSSTDest .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN101(ByVal ICMSSN101_orig As Integer, ByVal ICMSSN101_CSOSN As String, ByVal ICMSSN101_pCredSN As Double, ByVal ICMSSN101_vCredICMSSN As Double) With drICMSSN101 .Item("orig") = ICMSSN101_orig .Item("CSOSN") = ICMSSN101_CSOSN .Item("pCredSN") = ICMSSN101_pCredSN .Item("vCredICMSSN") = ICMSSN101_vCredICMSSN .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN102(ByVal ICMSSN102_orig As Integer, ByVal ICMSSN102_CSOSN As String) With drICMSSN102 .Item("orig") = ICMSSN102_orig .Item("CSOSN") = ICMSSN102_CSOSN .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN201(ByVal ICMSSN201_orig As Integer, ByVal ICMSSN201_CSOSN As String, ByVal ICMSSN201_modBCST As String, _ ByVal ICMSSN201_pMVAST As Double, ByVal ICMSSN201_pRedBCST As Double, ByVal ICMSSN201_vBCST As Double, _ ByVal ICMSSN201_pICMSST As Double, ByVal ICMSSN201_vICMSST As Double, ByVal ICMSSN201_pCredSN As Double, _ ByVal ICMSSN201_vCredICMSSN As Double) With drICMSSN201 .Item("orig") = ICMSSN201_orig .Item("CSOSN") = ICMSSN201_CSOSN .Item("modBCST") = ICMSSN201_modBCST .Item("pMVAST") = ICMSSN201_pMVAST .Item("pRedBCST") = ICMSSN201_pRedBCST .Item("vBCST") = ICMSSN201_vBCST .Item("pICMSST") = ICMSSN201_pICMSST .Item("vICMSST") = ICMSSN201_vICMSST .Item("pCredSN") = ICMSSN201_pCredSN .Item("vCredICMSSN") = ICMSSN201_vCredICMSSN .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN202(ByVal CMSSN202_orig As Integer, ByVal CMSSN202_CSOSN As String, ByVal CMSSN202_modBCST As String, ByVal CMSSN202_pMVAST As Double, _ ByVal CMSSN202_pRedBCST As Double, ByVal CMSSN202_vBCST As Double, ByVal CMSSN202_pICMSST As Double, ByVal CMSSN202_vICMSST As Double) With drICMSSN202 .Item("orig") = CMSSN202_orig .Item("CSOSN") = CMSSN202_CSOSN .Item("modBCST") = CMSSN202_modBCST .Item("pMVAST") = CMSSN202_pMVAST .Item("pRedBCST") = CMSSN202_pRedBCST .Item("vBCST") = CMSSN202_vBCST .Item("pICMSST") = CMSSN202_pICMSST .Item("vICMSST") = CMSSN202_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN500(ByVal ICMSSN500_orig As Integer, ByVal ICMSSN500_CSOSN As String, ByVal ICMSSN500_vBCSTRet As Double, ByVal ICMSSN500_vICMSSTRet As Double) With drICMSSN500 .Item("orig") = ICMSSN500_orig .Item("CSOSN") = ICMSSN500_CSOSN .Item("vBCSTRet") = ICMSSN500_vBCSTRet .Item("vICMSSTRet") = ICMSSN500_vICMSSTRet .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN900(ByVal ICMSSN900_orig As Integer, ByVal ICMSSN900_CSOSN As String, ByVal ICMSSN900_modBC As String, ByVal ICMSSN900_vBC As Double, ByVal ICMSSN900_pRedBC As Double, _ ByVal ICMSSN900_pICMS As Double, ByVal ICMSSN900_vICMS As Double, ByVal ICMSSN900_modBCST As String, ByVal ICMSSN900_pMVAST As Double, ByVal ICMSSN900_pRedBCST As Double, _ ByVal ICMSSN900_vBCST As Double, ByVal ICMSSN900_pICMSST As Double, ByVal ICMSSN900_vICMSST As Double, ByVal ICMSSN900_pCredSN As Double, ByVal ICMSSN900_vCredICMSSN As Double) With drICMSSN900 .Item("orig") = ICMSSN900_orig .Item("CSOSN") = ICMSSN900_CSOSN .Item("modBC") = ICMSSN900_modBC .Item("vBC") = ICMSSN900_vBC .Item("pRedBC") = ICMSSN900_pRedBC .Item("pICMS") = ICMSSN900_pICMS .Item("vICMS") = ICMSSN900_vICMS .Item("modBCST") = ICMSSN900_modBCST .Item("pMVAST") = ICMSSN900_pMVAST .Item("pRedBCST") = ICMSSN900_pRedBCST .Item("vBCST") = ICMSSN900_vBCST .Item("pICMSST") = ICMSSN900_pICMSST .Item("vICMSST") = ICMSSN900_vICMSST .Item("pCredSN") = ICMSSN900_pCredSN .Item("vCredICMSSN") = ICMSSN900_vCredICMSSN .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub #End Region #Region "CAMPO SOBRE IPI " Public Sub IPI(ByVal CAMPO_clEnq, ByVal CAMPO_CNPJProd, ByVal CAMPO_cSelo, ByVal CAMPO_qSelo, ByVal CAMPO_cEnq) With drIPI .Item("clEnq") = CAMPO_clEnq .Item("CNPJProd") = CAMPO_CNPJProd .Item("cSelo") = CAMPO_cSelo .Item("qSelo") = CAMPO_qSelo .Item("cEnq") = CAMPO_cEnq End With End Sub Public Sub IPITrib(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pIPI, ByVal CAMPO_qUnid, ByVal CAMPO_vUnid, ByVal CAMPO_vIPI) With drIPITrib .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pIPI") = CAMPO_pIPI .Item("qUnid") = CAMPO_qUnid .Item("vUnid") = CAMPO_vUnid .Item("vIPI") = CAMPO_vIPI End With End Sub Public Sub IPINT(ByVal CAMPO_CST) With drIPINT .Item("CST") = CAMPO_CST End With End Sub Public Sub II(ByVal CAMPO_vBC, ByVal CAMPO_vDespAdu, ByVal CAMPO_vII, ByVal CAMPO_vIOF) With drII .Item("vBC") = CAMPO_vBC .Item("vDespAdu") = CAMPO_vDespAdu .Item("vII") = CAMPO_vII .Item("vIOF") = CAMPO_vIOF End With End Sub Public Sub ISSQN(ByVal CAMPO_vBC, ByVal CAMPO_vAliq, ByVal CAMPO_vISSQN, ByVal CAMPO_cMunFG, ByVal CAMPO_cListServ, ByVal CAMPO_cSitTrib) With drISSQN .Item("vBC") = CAMPO_vBC .Item("vAliq") = CAMPO_vAliq .Item("vISSQN") = CAMPO_vISSQN .Item("cMunFG") = CAMPO_cMunFG .Item("cListServ") = CAMPO_cListServ .Item("cSitTrib") = CAMPO_cSitTrib End With End Sub #End Region #Region "ALIQUOTA DO PIS" Public Sub PISAliq(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pPIS, ByVal CAMPO_vPIS) With drPISAliq .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pPIS") = CAMPO_pPIS .Item("vPIS") = CAMPO_vPIS End With End Sub Public Sub PISQtde(ByVal CAMPO_CST, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vPIS) With drPISQtde .Item("CST") = CAMPO_CST .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vPIS") = CAMPO_vPIS End With End Sub Public Sub PISNT(ByVal CAMPO_CST) With drPISNT .Item("CST") = CAMPO_CST End With End Sub Public Sub PISOutr(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pPIS, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vPIS) Dim drPISOutr As DataRow = dsNFe.Tables("PISOutr").NewRow With drPISOutr .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pPIS") = CAMPO_pPIS .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vPIS") = CAMPO_vPIS End With End Sub Public Sub PISST(ByVal CAMPO_vBC, ByVal CAMPO_pPIS, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vPIS) With drPISST .Item("vBC") = CAMPO_vBC .Item("pPIS") = CAMPO_pPIS .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vPIS") = CAMPO_vPIS End With End Sub #End Region #Region "ALIQUOTA COFINS" Public Sub COFINSAliq(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pCOFINS, ByVal CAMPO_vCOFINS) With drCOFINSAliq .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pCOFINS") = CAMPO_pCOFINS .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub Public Sub COFINSQtde(ByVal CAMPO_CST, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vCOFINS) With drCOFINSQtde .Item("CST") = CAMPO_CST .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub Public Sub COFINSNT(ByVal CAMPO_CST) With drCOFINSNT .Item("CST") = CAMPO_CST End With End Sub Public Sub COFINSOutr(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pCOFINS, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vCOFINS) With drCOFINSOutr .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pCOFINS") = CAMPO_pCOFINS .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub Public Sub COFINSST(ByVal CAMPO_vBC, ByVal CAMPO_pCOFINS, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vCOFINS) With drCOFINSST .Item("vBC") = CAMPO_vBC .Item("pCOFINS") = CAMPO_pCOFINS .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub #End Region #Region "TOTALIZADORES" Public Sub ICMSTot(ByVal CAMPO_vBC, ByVal CAMPO_vICMS, ByVal CAMPO_vBCST, ByVal CAMPO_vST, ByVal CAMPO_vProd, ByVal CAMPO_vFrete, ByVal CAMPO_vSeg, ByVal CAMPO_vDesc, ByVal CAMPO_vII, ByVal CAMPO_vIPI, ByVal CAMPO_vPIS, ByVal CAMPO_vCOFINS, ByVal CAMPO_vOutro, ByVal CAMPO_vNF) With drICMSTot .Item("vBC") = CAMPO_vBC .Item("vICMS") = CAMPO_vICMS .Item("vBCST") = CAMPO_vBCST .Item("vST") = CAMPO_vST .Item("vProd") = CAMPO_vProd .Item("vFrete") = CAMPO_vFrete .Item("vSeg") = CAMPO_vSeg .Item("vDesc") = CAMPO_vDesc .Item("vII") = CAMPO_vII .Item("vIPI") = CAMPO_vIPI .Item("vPIS") = CAMPO_vPIS .Item("vCOFINS") = CAMPO_vCOFINS .Item("vOutro") = CAMPO_vOutro .Item("vNF") = CAMPO_vNF End With End Sub Public Sub ISSQNtot(ByVal CAMPO_vServ, ByVal CAMPO_vBC, ByVal CAMPO_vPIS, ByVal CAMPO_vCOFINS) With drISSQNtot .Item("vServ") = CAMPO_vServ .Item("vBC") = CAMPO_vBC .Item("vISS") = CAMPO_vBC .Item("vPIS") = CAMPO_vPIS .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub Public Sub retTrib(ByVal CAMPO_vRetPIS, ByVal CAMPO_vRetCOFINS, ByVal CAMPO_vRetCSLL, ByVal CAMPO_vBCIRRF, ByVal CAMPO_vIRRF, ByVal CAMPO_vBCRetPrev, ByVal CAMPO_vRetPrev) With drretTrib .Item("vRetPIS") = CAMPO_vRetPIS .Item("vRetCOFINS") = CAMPO_vRetCOFINS .Item("vRetCSLL") = CAMPO_vRetCSLL .Item("vBCIRRF") = CAMPO_vBCIRRF .Item("vIRRF") = CAMPO_vIRRF .Item("vBCRetPrev") = CAMPO_vBCRetPrev .Item("vRetPrev") = CAMPO_vRetPrev End With End Sub #End Region #Region "DADOS REFERENTES A TRANSPORTADORA" Public Sub transp(ByVal CAMPO_modFrete, ByVal CAMPO_vagao, ByVal CAMPO_balsa) With drtransp .Item("modFrete") = CAMPO_modFrete .Item("vagao") = CAMPO_vagao .Item("balsa") = CAMPO_balsa End With End Sub Public Sub Transporta(ByVal CAMPO_CNPJ, ByVal CAMPO_CPF, ByVal CAMPO_xNome, ByVal CAMPO_IE, ByVal CAMPO_xEnder, ByVal CAMPO_xMun, ByVal CAMPO_UF) With drtransporta .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xNome") = CAMPO_xNome .Item("IE") = CAMPO_IE .Item("xEnder") = CAMPO_xEnder .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF End With End Sub Public Sub retTransp(ByVal CAMPO_vServ, ByVal CAMPO_vBCRet, ByVal CAMPO_pICMSRet, ByVal CAMPO_vICMSRet, ByVal CAMPO_CFOP, ByVal CAMPO_cMunFG) With drretTransp .Item("vServ") = CAMPO_vServ .Item("vBCRet") = CAMPO_vBCRet .Item("pICMSRet") = CAMPO_pICMSRet .Item("vICMSRet") = CAMPO_vICMSRet .Item("CFOP") = CAMPO_CFOP .Item("cMunFG") = CAMPO_cMunFG End With End Sub Public Sub veicTransp(ByVal CAMPO_placa, ByVal CAMPO_UF, ByVal CAMPO_RNTC) With drveicTransp .Item("placa") = CAMPO_placa .Item("UF") = CAMPO_UF .Item("RNTC") = CAMPO_RNTC End With End Sub Public Sub reboque(ByVal CAMPO_placa, ByVal CAMPO_UF, ByVal CAMPO_RNTC) With drreboque .Item("placa") = CAMPO_placa .Item("UF") = CAMPO_UF .Item("RNTC") = CAMPO_RNTC End With End Sub Public Sub Vol(ByVal CAMPO_qVol, ByVal CAMPO_esp, ByVal CAMPO_marca, ByVal CAMPO_nVol, ByVal CAMPO_pesoL, ByVal CAMPO_pesoB) With drvol .Item("qVol") = CAMPO_qVol .Item("esp") = CAMPO_esp .Item("marca") = CAMPO_marca .Item("nVol") = CAMPO_nVol .Item("pesoL") = CAMPO_pesoL .Item("pesoB") = CAMPO_pesoB End With End Sub Public Sub lacres(ByVal CAMPO_nLacre) With drlacres .Item("nLacre") = CAMPO_nLacre End With End Sub #End Region #Region "DEMAIS FUNÇÕES PARA NF-e" Public Sub VeicProd(ByVal CAMPO_tpOp, ByVal CAMPO_chassi, ByVal CAMPO_cCor, ByVal CAMPO_xCor, ByVal CAMPO_pot, ByVal CAMPO_cilin, ByVal CAMPO_pesoL, ByVal CAMPO_pesoB, ByVal CAMPO_nSerie, _ ByVal CAMPO_tpComb, ByVal CAMPO_nMotor, ByVal CAMPO_CMT, ByVal CAMPO_dist, ByVal CAMPO_anoMod, ByVal CAMPO_anoFab, ByVal CAMPO_tpPint, ByVal CAMPO_tpVeic, ByVal CAMPO_espVeic, ByVal CAMPO_VIN, _ ByVal CAMPO_condVeic, ByVal CAMPO_cMod, ByVal CAMPO_cCorDENATRAN, ByVal CAMPO_lota, ByVal CAMPO_tpRest) With drveicProd .Item("tpOp") = CAMPO_tpOp .Item("chassi") = CAMPO_chassi .Item("cCor") = CAMPO_cCor .Item("xCor") = CAMPO_xCor .Item("pot") = CAMPO_pot .Item("cilin") = CAMPO_cilin .Item("pesoL") = CAMPO_pesoL .Item("pesoB") = CAMPO_pesoB .Item("nSerie") = CAMPO_nSerie .Item("tpComb") = CAMPO_tpComb .Item("nMotor") = CAMPO_nMotor .Item("CMT") = CAMPO_CMT .Item("dist") = CAMPO_dist .Item("anoMod") = CAMPO_anoMod .Item("anoFab") = CAMPO_anoFab .Item("tpPint") = CAMPO_tpPint .Item("tpVeic") = CAMPO_tpVeic .Item("espVeic") = CAMPO_espVeic .Item("VIN") = CAMPO_VIN .Item("condVeic") = CAMPO_condVeic .Item("cMod") = CAMPO_cMod .Item("cCorDENATRAN") = CAMPO_cCorDENATRAN .Item("lota") = CAMPO_lota .Item("tpRest") = CAMPO_tpRest End With End Sub Public Sub fat(ByVal CAMPO_nFat, ByVal CAMPO_vOrig, ByVal CAMPO_vDesc, ByVal CAMPO_vLiq) With drfat .Item("nFat") = CAMPO_nFat .Item("vOrig") = CAMPO_vOrig .Item("vDesc") = CAMPO_vDesc .Item("vLiq") = CAMPO_vLiq End With End Sub Public Sub dup(ByVal CAMPO_nDup, ByVal CAMPO_dVenc, ByVal CAMPO_vDup) With drdup .Item("nDup") = CAMPO_nDup .Item("dVenc") = CAMPO_dVenc .Item("vDup") = CAMPO_vDup End With End Sub Public Sub infAdic(ByVal CAMPO_infAdFisco, ByVal CAMPO_infCpl) With drinfAdic .Item("infAdFisco") = CAMPO_infAdFisco .Item("infCpl") = CAMPO_infCpl End With End Sub Public Sub obsCont(ByVal CAMPO_xTexto) With drobsCont .Item("xTexto") = CAMPO_xTexto End With End Sub Public Sub obsFisco(ByVal CAMPO_xTexto) With drobsFisco .Item("xTexto") = CAMPO_xTexto End With End Sub Public Sub procRef(ByVal CAMPO_nProc, ByVal CAMPO_indProc) With drprocRef .Item("nProc") = CAMPO_nProc .Item("indProc") = CAMPO_indProc End With End Sub Public Sub exporta(ByVal CAMPO_UFEmbarq, ByVal CAMPO_xLocEmbarq) With drexporta .Item("UFEmbarq") = CAMPO_UFEmbarq .Item("xLocEmbarq") = CAMPO_xLocEmbarq End With End Sub Public Sub compra(ByVal CAMPO_xNEmp, ByVal CAMPO_xPed, ByVal CAMPO_xCont) With drcompra .Item("xNEmp") = CAMPO_xNEmp .Item("xPed") = CAMPO_xPed .Item("xCont") = CAMPO_xCont End With End Sub Public Sub cana(ByVal CAMPO_safra, ByVal CAMPO_ref, ByVal CAMPO_qTotMes, ByVal CAMPO_qTotAnt, ByVal CAMPO_qTotGer, ByVal CAMPO_vFor, ByVal CAMPO_vTodDed, ByVal CAMPO_vLiqFor) With drcana .Item("safra") = CAMPO_safra .Item("ref") = CAMPO_ref .Item("qTotMes") = CAMPO_qTotMes .Item("qTotAnt") = CAMPO_qTotAnt .Item("qTotGer") = CAMPO_qTotGer .Item("vFor") = CAMPO_vFor .Item("vTodDed") = CAMPO_vTodDed .Item("vLiqFor") = CAMPO_vLiqFor End With End Sub Public Sub forDia(ByVal CAMPO_qtde) With drforDia .Item("qtde") = CAMPO_qtde End With End Sub Public Sub deduc(ByVal CAMPO_xDed, ByVal CAMPO_vDed) With drdeduc .Item("xDed") = CAMPO_xDed .Item("vDed") = CAMPO_vDed End With End Sub Public Sub Informacoes_NFe(ByVal CAMPO_cUF As String, ByVal CAMPO_AAMM As String, ByVal CAMPO_CNPJ As String, ByVal CAMPO_mod As String, ByVal CAMPO_serie As String, ByVal CAMPO_nNF As Integer) With drrefNF .Item("cUF") = CAMPO_cUF .Item("AAMM") = CAMPO_AAMM .Item("CNPJ") = CAMPO_CNPJ .Item("mod") = CAMPO_mod .Item("serie") = CAMPO_serie .Item("nNF") = CAMPO_nNF End With End Sub Public Sub Referencia_ProdutorRural(ByVal CAMPO_cUF As String, ByVal CAMPO_AAMM As String, ByVal CAMPO_CNPJ As String, ByVal CAMPO_CPF As String, ByVal CAMPO_IE As String, ByVal CAMPO_mod As String, ByVal CAMPO_serie As String, ByVal CAMPO_nNF As Integer) With drrefNFP .Item("cUF") = CAMPO_cUF .Item("AAMM") = CAMPO_AAMM .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("IE") = CAMPO_IE .Item("mod") = CAMPO_mod .Item("serie") = CAMPO_serie .Item("nNF") = CAMPO_nNF End With End Sub Public Sub Informacoes_CupomFiscal(ByVal CAMPO_mod As String, ByVal CAMPO_nECF As Integer, ByVal CAMPO_nCOO As Integer) With drrefECF .Item("mod") = CAMPO_mod .Item("nECF") = CAMPO_nECF .Item("nCOO") = CAMPO_nCOO End With End Sub Public Sub Avulsa(ByVal CAMPO_CNPJ, ByVal CAMPO_xOrgao, ByVal CAMPO_matr, ByVal CAMPO_xAgente, ByVal CAMPO_fone, ByVal CAMPO_UF, ByVal CAMPO_nDAR, ByVal CAMPO_dEmi, ByVal CAMPO_vDAR, ByVal CAMPO_repEmi, ByVal CAMPO_dPag) With dravulsa .Item("CNPJ") = CAMPO_CNPJ .Item("xOrgao") = CAMPO_xOrgao .Item("matr") = CAMPO_matr .Item("xAgente") = CAMPO_xAgente .Item("fone") = CAMPO_fone .Item("UF") = CAMPO_UF .Item("nDAR") = CAMPO_nDAR .Item("dEmi") = CAMPO_dEmi .Item("vDAR") = CAMPO_vDAR .Item("repEmi") = CAMPO_repEmi .Item("dPag") = CAMPO_dPag End With End Sub Public Sub retirada(ByVal CAMPO_CNPJ, ByVal CAMPO_CPF, ByVal CAMPO_xLgr, ByVal CAMPO_nro, ByVal CAMPO_xCpl, ByVal CAMPO_xBairro, ByVal CAMPO_xMun, ByVal CAMPO_UF) With drretirada .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xLgr") = CAMPO_xLgr .Item("nro") = CAMPO_nro .Item("xCpl") = CAMPO_xCpl .Item("xBairro") = CAMPO_xBairro '.Item("cMun") = 'FuncaoMunicipios(CAMPO_xMun) .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF End With End Sub Public Sub entrega(ByVal CAMPO_CNPJ, ByVal CAMPO_CPF, ByVal CAMPO_xLgr, ByVal CAMPO_nro, ByVal CAMPO_xCpl, ByVal CAMPO_xBairro, ByVal CAMPO_xMun, ByVal CAMPO_UF) With drentrega .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xLgr") = CAMPO_xLgr .Item("nro") = CAMPO_nro .Item("xCpl") = CAMPO_xCpl .Item("xBairro") = CAMPO_xBairro '.Item("cMun") = 'FuncaoMunicipios(CAMPO_xMun) .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF End With End Sub Public Sub DI(ByVal CAMPO_nDI, ByVal CAMPO_dDI, ByVal CAMPO_xLocDesemb, ByVal CAMPO_UFDesemb, ByVal CAMPO_dDesemb, ByVal CAMPO_cExportador) With drDI .Item("nDI") = CAMPO_nDI .Item("dDI") = CAMPO_dDI .Item("xLocDesemb") = CAMPO_xLocDesemb .Item("UFDesemb") = CAMPO_UFDesemb .Item("dDesemb") = CAMPO_dDesemb .Item("cExportador") = CAMPO_cExportador End With End Sub Public Sub adi(ByVal CAMPO_nAdicao, ByVal CAMPO_nSeqAdic, ByVal CAMPO_cFabricante, ByVal CAMPO_vDescDI) With dradi .Item("nAdicao") = CAMPO_nAdicao .Item("nSeqAdic") = CAMPO_nSeqAdic .Item("cFabricante") = CAMPO_cFabricante .Item("vDescDI") = CAMPO_vDescDI End With End Sub Public Sub CIDE(ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vCIDE) With drCIDE .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vCIDE") = CAMPO_vCIDE End With End Sub #End Region End Class
- Marcado como Resposta Levi DomingosModerator domingo, 14 de novembro de 2010 22:27
-
Era justamente isso que eu iria responder. Basta usar o driver ou o OS Windows XP que esse problema do PIN para de ocorrer.
Thnx !- Marcado como Resposta Levi DomingosModerator domingo, 14 de novembro de 2010 22:28
Todas as Respostas
-
Olá...
Também estou com esse problema
O meu arquivo não está validando, quando executo a validação surge a seguinte mensagem de erro:"O valor do atributo 'nItem' é inválido de acordo com seu tipo de dados." Porem eu tenho um arquivo da versão 1.10 onde o valor do nItem é o mesmo: "<det nItem="001">", você tem o arquivo validado?
-
Bom Valdeir
seguinte pelo que pude notar vc não consegue validar o seu xml por pq vc está gerando o campo Det nItem como string e na verdade ele do tipo Integer não sei ao certo como vc está gerando seu arquivo xml mais tenta gerar ele para que fique deste jeito assim "<det nItem="1">" -
Olá Tiger
Já tentei colocar assim, porem o erro continua.
Alguma ideia?
E também estou com outro problema, resolvi deixar de validar e tentei enviar o arquivo assim mesmo, mas está causando uma exception nessa linha
Dim oServ As New NfeRecepcao2.NfeRecepcao2Soap12Client
"Não foi possível localizar o elemento de ponto de extremidade padrão que referencia o contrato 'NfeRecepcao2.NfeRecepcao2Soap12' na seção de configuração do ServiceModel cliente. Isso pode ter ocorrido devido à falta de um arquivo de configuração para o seu aplicativo ou porque nenhum elemento de ponto de extremidade correspondendo a este contrato pôde ser encontrado no elemento cliente."
Eu preciso passar algum parametro no "New NfeRecepcao2.NfeRecepcao2Soap12Client(Parametros?)"
Obrigado pela atenção
-
Olá tbem estou com alguns problemas para consumir os Web Services da NF-e 2.0...
estou a procura de algum exemplo.
se quiser me enviar um xml de sua nota para mim ver o erro... mande no meu e-Mail. -
Olá Tiger
Eu resolvi o meu problema de validação, alterei o framework para 2.0 agora meu código ficou assim:
Dim
Envio As New hNfeRecepcao2.NfeRecepcao2
Dim eXml As New XmlDocument
eXml.Load(mCaminho &
"\" & NumeroLote & "-env-lot.xml")
Envio.ClientCertificates.Add(Certificado)
Envio.nfeCabecMsgValue =
New hNfeRecepcao2.nfeCabecMsg
Envio.nfeCabecMsgValue.cUF = 35
Envio.nfeCabecMsgValue.versaoDados =
"2.00"
Retorno = Envio.nfeRecepcaoLote2(eXml.DocumentElement)
Não sei se é assim, estou usando o DocumentElement como parametro no lugar de XMLNode, pesquisando aqui no forum um colega me indicou usar assim. Porem não estou conseguindo consultar a minha nota nem pelo meu sistema nem pelo site da SEFAZ de São Paulo.
Dim
Ret As New hNfeConsulta2.NfeConsulta2
Dim xmlConsulta As New Xml.XmlDocument
Ret.ClientCertificates.Add(Certificado)
Ret.nfeCabecMsgValue =
New hNfeConsulta2.nfeCabecMsg
Ret.nfeCabecMsgValue.cUF = 35
Ret.nfeCabecMsgValue.versaoDados =
"2.00"
xmlConsulta.LoadXml(
"<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "UTF-8" & Chr(34) & " ?><conSitNFe xmlns=" & Chr(34) & "http://www.portalfiscal.inf.br/nfe" & Chr(34) & " versao=" & Chr(34) & "2.00" & Chr(34) & "><tpAmb>2</tpAmb><xServ>CONSULTAR</xServ><chNFe>" & ChaveAcesso & "</chNFe></conSitNFe>")
ConsultaNFe = Ret.nfeConsultaNF2(xmlConsulta.DocumentElement)
O retorno da consulta vem sempre o mesmo, 999: Erro não catalogado, não sei mais oq fazer... meu prazo está esgotando eu ligo no suporte e ninguem resolve, pede pra mandar um email que não vem resposta
Você passou por isso tambem?
Obrigado pela atenção
-
Você ainda querem ajuda pra resolver estes problemas? Ou já se viraram com uma outra solução?
Respondam ai...
UPDATE: To perguntando pq eu consegui fazer tudo funcionar e posso ajudar quem estiver com problemas, mas já vou avisando que minha arquitetura está seguindo uma serie de boas praticas, por isso nao tive praticamente nenhum problema na geração das minhas notas.
[]s
H1J4CK3R
Thnx ! -
-
Você ainda querem ajuda pra resolver estes problemas? Ou já se viraram com uma outra solução?
Respondam ai...
UPDATE: To perguntando pq eu consegui fazer tudo funcionar e posso ajudar quem estiver com problemas, mas já vou avisando que minha arquitetura está seguindo uma serie de boas praticas, por isso nao tive praticamente nenhum problema na geração das minhas notas.
[]s
H1J4CK3R
Thnx !A minha solução foi voltar pra versão 1.10, mas eu tenho que desenvolver na versão 2.00 até o final do ano, se possível eu gostaria de uma ajuda sim
Valeu pela anteção
-
Valdeir o prazo é so ate setembro ...
conversei com o pessoal da Sefaz GO e me disseram que o WS ConsultaStatusServico é sincrono.ai fiz algumas modificações e meu codigo contunua dando erro:
public object Consumir() { try { // Criando cabecalho nfeCabecMsg oCabecalho = new nfeCabecMsg(); oCabecalho.cUF = "52"; oCabecalho.versaoDados = "2.00"; NfeStatusServico2 ws = new NfeStatusServico2(); ws.Url = "https://homolog.sefaz.go.gov.br/nfe/services/v2/NfeStatusServico?wsdl"; ws.ClientCertificates.Add(CertificadoDigitalDaFilial); ws.nfeCabecMsgValue = oCabecalho; string xmlStatus = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + "<consStatServ versao=\"1.07\" xmlns=\"http://www.portalfiscal.inf.br/nfe\">" + "<tpAmb>2</tpAmb>" + "<cUF>52</cUF>" + "<xServ>STATUS</xServ>" + "</consStatServ>"; var oStatusServico = new nfeStatusServico(); oStatusServico.nfeDadosMsg = xmlStatus; var resposta = ws.nfeStatusServicoNF2(oStatusServico); return null; } catch (SoapException we) { throw we; } catch (Exception be) { // GERANDO EXCEÇÃO AQUI... throw new BusinessException("Consumir", be.Message, this.GetType().FullName, true); } }
be.Message: O cliente encontrou o tipo de conteúdo de resposta de '', mas esperava 'application/soap+xml'.
Falha na solicitação com resposta vazia.
be.StackTrace:
em System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
em System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
em NFe.Business.NfeStatusServico.NfeStatusServico2.nfeStatusServicoNF2(nfeStatusServico nfeStatusServico) na C:\Nectar\Projetos\NotaFiscalEletronica\Nectar.NFe.Business\Web References\NfeStatusServico\Reference.cs:linha 92
em NFe.Business.Facade.WebServicosNfe.WebServicoStatusServico.Consumir(String uf) na C:\Nectar\Projetos\NotaFiscalEletronica\Nectar.NFe.Business\Facade\WebServicosNfe\WebServicoStatusServico.cs:linha 48Se alguem ja passou por esta situação e puder colaborar.
-
Desculpa me intrometer aqui, mas como vi que é sobre NFe gostaria que alguém pudesse me ajudar.
Qual seria a melhor maneira de montar o xml de uma NFe ?
Concatenar campos ou existe uma forma mais simples ?
Eu já tenho tudo salvo no banco agora não sei como que monto o XML.
Obrigado a todos.
Boa sorte! -
EderAdz
nesse forum existe uma equipe de desenvolvimento empenhada para desenvolver essa parte do xml e de comunicação com os WS´s
http://www.vbmania.com.br/pages/index.php?varModulo=Forum&varMethod=abrir&varID=337965&varPagina=6
tbem aki no forum da microsoft tem muito conteudo sobre a NF-e.Só não consegui axar os link´s
Bom com relação a melhor maneira de montar o XML.
isso depende de qual a plataforma que vc deseja desenvolver seu aplicativo de Nota fiscal.
Na minha opnião axei muito facil desenvolver usando a plataforma .Net e a Linguagem Visual Basic
Se quiser posto alguns meio para vc desenvolver o XML... -
EderAdz
nesse forum existe uma equipe de desenvolvimento empenhada para desenvolver essa parte do xml e de comunicação com os WS´s
http://www.vbmania.com.br/pages/index.php?varModulo=Forum&varMethod=abrir&varID=337965&varPagina=6
tbem aki no forum da microsoft tem muito conteudo sobre a NF-e.Só não consegui axar os link´s
Bom com relação a melhor maneira de montar o XML.
isso depende de qual a plataforma que vc deseja desenvolver seu aplicativo de Nota fiscal.
Na minha opnião axei muito facil desenvolver usando a plataforma .Net e a Linguagem Visual Basic
Se quiser posto alguns meio para vc desenvolver o XML...
Ola Tiger,Rapaz muito obrigado pela atenção,
Então eu estou tentando pelo .NET mas na linguagem C#, e é em Windows Form, poxa e qualquer ajuda que você puder me dar seria muito bem vinda rapaz, to apanhando bastante com isso. Se quiser de repente passo até meu email e podemos trocar ideias.
Fico muito grato mesmo.
-
-
Opa então EderAdz.
Bom tem um Exemplo q irá lhe ajudar bastante já q a linguagem e a C#...
Na Internet o pessoal da Empresa UNAMAKE disponibiliza o Fonte de Aplicativo Emissor de Notas Fiscais. para auxilio de quem está começando com o projeto.O Conteudo e otimo e com ele dá para vc desenvolver toda a parte do projeto no qual e relacionado a comunicação com os Web Services do governo.
Agora com relação a criar um XML para que possa ser validado e Enviado para os WS.Postei aqui um codigo de minha autoria. só que em VB.NET mais axo que não terá muita duvida para converte-lo para C#.Só uma pequena OBS. Este codigo tenta gerar a nota fiscal na versão 2.0
Ainda não usei criei mesmo para ajudar o pessoal Mas acredito que a logica que foi aplicada esteja facil de se entender.
Public Class NFEletronica Private dsNFe As New DataSet Public _TotaisIndice As String #Region "Variaveis para gerar a NF-e" 'Objetos do tipo Datarow que representão 'Novas linhas no dataset Carregado com o Schema XSD da Versão 2.00 'da Nota Fiscal Eletronica 'Com essas Datarow´s manipulo os dados Indexando e inserindo valores 'separadamente por Tabelas.Após as principais tabelas serem preenchidas 'corretamente adiono as novas linhas ao dataset e gero um XML atravês dele. ' ' ' ' Dim drNFe As DataRow = dsNFe.Tables("NFe").NewRow Dim drInfNfe As DataRow = dsNFe.Tables("InfNFe").NewRow Dim drNFref As DataRow = dsNFe.Tables("NFref").NewRow Dim dride As DataRow = dsNFe.Tables("ide").NewRow Dim dremit As DataRow = dsNFe.Tables("emit").NewRow Dim drenderEmit As DataRow = dsNFe.Tables("enderEmit").NewRow Dim drdest As DataRow = dsNFe.Tables("dest").NewRow Dim drenderDest As DataRow = dsNFe.Tables("enderDest").NewRow Dim drdet As DataRow = dsNFe.Tables("det").NewRow Dim drprod As DataRow = dsNFe.Tables("prod").NewRow Dim drmed As DataRow = dsNFe.Tables("med").NewRow Dim drarma As DataRow = dsNFe.Tables("arma").NewRow Dim drcomb As DataRow = dsNFe.Tables("comb").NewRow Dim drICMS00 As DataRow = dsNFe.Tables("ICMS00").NewRow Dim drICMS10 As DataRow = dsNFe.Tables("ICMS10").NewRow Dim drICMS20 As DataRow = dsNFe.Tables("ICMS20").NewRow Dim drICMS30 As DataRow = dsNFe.Tables("ICMS30").NewRow Dim drICMS40 As DataRow = dsNFe.Tables("ICMS40").NewRow Dim drICMS51 As DataRow = dsNFe.Tables("ICMS51").NewRow Dim drICMS60 As DataRow = dsNFe.Tables("ICMS60").NewRow Dim drICMS70 As DataRow = dsNFe.Tables("ICMS70").NewRow Dim drICMS90 As DataRow = dsNFe.Tables("ICMS90").NewRow Dim drICMSPart As DataRow = dsNFe.Tables("ICMSPart").NewRow Dim drICMSST As DataRow = dsNFe.Tables("ICMSST").NewRow Dim drICMSSN101 As DataRow = dsNFe.Tables("ICMSSN101").NewRow Dim drICMSSN102 As DataRow = dsNFe.Tables("ICMSSN102").NewRow Dim drICMSSN201 As DataRow = dsNFe.Tables("ICMSSN201").NewRow Dim drICMSSN202 As DataRow = dsNFe.Tables("ICMSSN202 ").NewRow Dim drICMSSN500 As DataRow = dsNFe.Tables("ICMSSN500").NewRow Dim drICMSSN900 As DataRow = dsNFe.Tables("ICMSSN900").NewRow Dim drrefNF As DataRow = dsNFe.Tables("refNF").NewRow Dim drrefNFP As DataRow = dsNFe.Tables("refNFP").NewRow Dim drrefECF As DataRow = dsNFe.Tables("refECF").NewRow Dim dravulsa As DataRow = dsNFe.Tables("avulsa").NewRow Dim drretirada As DataRow = dsNFe.Tables("retirada").NewRow Dim drentrega As DataRow = dsNFe.Tables("entrega").NewRow Dim drDI As DataRow = dsNFe.Tables("DI").NewRow Dim dradi As DataRow = dsNFe.Tables("adi").NewRow Dim drveicProd As DataRow = dsNFe.Tables("veicProd").NewRow Dim drCIDE As DataRow = dsNFe.Tables("CIDE").NewRow Dim drIPI As DataRow = dsNFe.Tables("IPI").NewRow Dim drIPITrib As DataRow = dsNFe.Tables("IPITrib").NewRow Dim drIPINT As DataRow = dsNFe.Tables("IPINT").NewRow Dim drII As DataRow = dsNFe.Tables("II").NewRow Dim drISSQN As DataRow = dsNFe.Tables("ISSQN").NewRow Dim drPISAliq As DataRow = dsNFe.Tables("PISAliq").NewRow Dim drPISQtde As DataRow = dsNFe.Tables("PISQtde").NewRow Dim drPISNT As DataRow = dsNFe.Tables("PISNT").NewRow Dim drPISOutr As DataRow = dsNFe.Tables("PISOutr").NewRow Dim drPISST As DataRow = dsNFe.Tables("PISST").NewRow Dim drCOFINSAliq As DataRow = dsNFe.Tables("COFINSAliq").NewRow Dim drCOFINSQtde As DataRow = dsNFe.Tables("COFINSQtde").NewRow Dim drCOFINSNT As DataRow = dsNFe.Tables("COFINSNT").NewRow Dim drCOFINSOutr As DataRow = dsNFe.Tables("COFINSOutr").NewRow Dim drCOFINSST As DataRow = dsNFe.Tables("COFINSST").NewRow Dim drICMSTot As DataRow = dsNFe.Tables("ICMSTot").NewRow Dim drISSQNtot As DataRow = dsNFe.Tables("ISSQNtot").NewRow Dim drretTrib As DataRow = dsNFe.Tables("retTrib").NewRow Dim drtransp As DataRow = dsNFe.Tables("transp").NewRow Dim drtransporta As DataRow = dsNFe.Tables("transporta").NewRow Dim drretTransp As DataRow = dsNFe.Tables("retTransp").NewRow Dim drveicTransp As DataRow = dsNFe.Tables("veicTransp").NewRow Dim drreboque As DataRow = dsNFe.Tables("reboque").NewRow Dim drvol As DataRow = dsNFe.Tables("vol").NewRow Dim drlacres As DataRow = dsNFe.Tables("lacres").NewRow Dim drfat As DataRow = dsNFe.Tables("fat").NewRow Dim drdup As DataRow = dsNFe.Tables("dup").NewRow Dim drinfAdic As DataRow = dsNFe.Tables("infAdic").NewRow Dim drobsCont As DataRow = dsNFe.Tables("obsCont").NewRow Dim drobsFisco As DataRow = dsNFe.Tables("obsFisco").NewRow Dim drprocRef As DataRow = dsNFe.Tables("procRef").NewRow Dim drexporta As DataRow = dsNFe.Tables("exporta").NewRow Dim drcompra As DataRow = dsNFe.Tables("compra").NewRow Dim drcana As DataRow = dsNFe.Tables("cana").NewRow Dim drforDia As DataRow = dsNFe.Tables("forDia").NewRow Dim drdeduc As DataRow = dsNFe.Tables("deduc").NewRow Dim drICMS As DataRow = dsNFe.Tables("ICMS").NewRow Dim drImposto As DataRow = dsNFe.Tables("imposto").NewRow #End Region Public WriteOnly Property l_SCHEMAxsd() As String 'Get ' Dim _xml As String ' _xml = dsNFe.GetXml ' _xml = Replace(_xml, "standalone=""yes""", "encoding=""UTF-8""") ' _xml = Replace(_xml, "<NewDataSet xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://www.portalfiscal.inf.br/nfe"">", "") ' _xml = Replace(_xml, "</NewDataSet>", "</NFe>") ' Return _xml 'End Get Set(ByVal value As String) If IO.File.Exists(value) = True And value.Substring(value.Length - 4) = ".xsd" Then dsNFe.ReadXmlSchema(value) Else MsgBox("Não consegui encontrar o Schema da NF-e 2.00") End If End Set End Property #Region "PRINCIPAIS FUNÇÕES PARA GERAR O XML" Public Sub Gera_Indices(ByVal Indice As Integer) With drNFe .Item("Nfe_Id") = Indice .Table.Namespace = "http://www.portalfiscal.inf.br/nfe" End With dsNFe.Tables("Nfe").Rows.Add(drNFe) With drInfNfe .Item("NFe_Id") = drNFe.Item("Nfe_Id") .Item("versao") = "2.00" End With dsNFe.Tables("infNfe").Rows.Add(drInfNfe) End Sub Public Sub NFRef(ByVal CAMPO_refNFe As String, Optional ByVal CAMPO_refCTe As String = "") With drNFref .Item("refNFe") = CAMPO_refNFe '.Item("refCTe") = CAMPO_refCTe End With dsNFe.Tables("NFref").Rows.Add(drNFref) End Sub Public Sub Gerar_IDE(ByVal CAMPO_natOp As String, ByVal CAMPO_indPag As Integer, ByVal CAMPO_mod As String, _ ByVal CAMPO_serie As String, ByVal CAMPO_nNF As Integer, ByVal CAMPO_dEmi As Date, _ ByVal CAMPO_hSaiEnt As DateTime, ByVal CAMPO_dSaiEnt As Date, ByVal CAMPO_tpNF As Integer, _ ByVal CAMPO_cMunFG As Integer, ByVal CAMPO_tpImp As Integer, ByVal CAMPO_tpEmis As Integer, _ ByVal CAMPO_tpAmb As Integer, ByVal CAMPO_finNFe As Integer, ByVal CAMPO_procEmi As Integer, _ ByVal CAMPO_verProc As String, ByVal CAMPO_dhCont As String) With dride '.Item("cUF") = CAMPO_cUF 'Codigo que deverá ser pego após Informar a UF do Emitente '.Item("cNF") = CAMPO_cNF 'Deverá ser inserido após o HASH da NF-e ser Gerado .Item("natOp") = CAMPO_natOp .Item("indPag") = CAMPO_indPag .Item("mod") = CAMPO_mod .Item("serie") = CAMPO_serie .Item("nNF") = CAMPO_nNF .Item("dEmi") = CAMPO_dEmi .Item("dSaiEnt") = CAMPO_dSaiEnt .Item("hSaiEnt") = CAMPO_hSaiEnt .Item("tpNF") = CAMPO_tpNF .Item("cMunFG") = CAMPO_cMunFG .Item("tpImp") = CAMPO_tpImp .Item("tpEmis") = CAMPO_tpEmis '.Item("cDV") = CAMPO_cDV 'Esse campo deverá ser inserido após ser gerado o Numero HASH da Nota .Item("tpAmb") = CAMPO_tpAmb .Item("finNFe") = CAMPO_finNFe .Item("procEmi") = CAMPO_procEmi .Item("verProc") = CAMPO_verProc .Item("dhCont") = CAMPO_dhCont .Item("InfNFe_Id") = drInfNfe.Item("infNFe_Id") End With End Sub Public Sub Gerar_Emitente(ByVal CAMPO_CNPJ As String, ByVal CAMPO_CPF As String, ByVal CAMPO_xNome As String, _ ByVal CAMPO_xFant As String, ByVal CAMPO_IE As String, ByVal CAMPO_IEST As String, _ ByVal CAMPO_IM As String, ByVal CAMPO_xLgr As String, ByVal CAMPO_nro As String, _ ByVal CAMPO_xCpl As String, ByVal CAMPO_xBairro As String, ByVal CAMPO_xMun As String, _ ByVal CAMPO_UF As String, ByVal CAMPO_CEP As Integer, ByVal CAMPO_xPais As String, _ ByVal CAMPO_fone As Integer, Optional ByVal CAMPO_CRT As String = "", Optional ByVal CAMPO_CNAE As String = "") With dremit .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xNome") = CAMPO_xNome .Item("xFant") = CAMPO_xFant .Item("IE") = CAMPO_IE .Item("IEST") = CAMPO_IEST .Item("IM") = CAMPO_IM .Item("CNAE") = CAMPO_CNAE .Item("CRT") = CAMPO_CRT .Item("infNFe_Id") = drInfNfe.Item("infNFe_Id") End With With drenderEmit .Item("xLgr") = CAMPO_xLgr .Item("nro") = CAMPO_nro .Item("xCpl") = CAMPO_xCpl .Item("xBairro") = CAMPO_xBairro '.Item("cMun") = 'FuncaoMunicipios(CAMPO_xMun) .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF .Item("CEP") = CAMPO_CEP .Item("cPais") = 1058 'FuncaoPais(CAMPO_xPais) .Item("xPais") = CAMPO_xPais .Item("fone") = CAMPO_fone .Item("emit_Id") = dremit.Item("emit_Id") End With 'Complementando as informações da TAG IDE dsNFe.Tables("ide").Rows(0).Item("cUF") = "MG" 'FuncaoEstado(CAMPO_UF) End Sub Public Sub Gerar_destinatario(ByVal CAMPO_CNPJ As String, ByVal CAMPO_CPF As String, ByVal CAMPO_xNome As String, _ ByVal CAMPO_xFant As String, ByVal CAMPO_IE As String, ByVal CAMPO_ISUF As String, _ ByVal CAMPO_email As String, ByVal CAMPO_xLgr As String, ByVal CAMPO_nro As String, _ ByVal CAMPO_xCpl As String, ByVal CAMPO_xBairro As String, ByVal CAMPO_xMun As String, _ ByVal CAMPO_UF As String, ByVal CAMPO_CEP As Integer, ByVal CAMPO_xPais As String, _ ByVal CAMPO_fone As Integer) With drdest .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xNome") = CAMPO_xNome .Item("IE") = CAMPO_IE .Item("ISUF") = CAMPO_ISUF .Item("email") = CAMPO_email .Item("infNFe_Id") = drInfNfe.Item("infNFe_Id") End With With drenderDest .Item("xLgr") = CAMPO_xLgr .Item("nro") = CAMPO_nro .Item("xCpl") = CAMPO_xCpl .Item("xBairro") = CAMPO_xBairro '.Item("cMun") = 'FuncaoMunicipios(CAMPO_xMun) .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF .Item("CEP") = CAMPO_CEP .Item("cPais") = 1058 'FuncaoPais(CAMPO_xPais) .Item("xPais") = CAMPO_xPais .Item("fone") = CAMPO_fone .Item("dest_Id") = drdest.Item("dest_Id") End With End Sub Public Sub Gerar_Produtos(ByVal INDICE_Prod As Integer, ByVal CAMPO_cProd As Integer, ByVal CAMPO_cEAN As String, _ ByVal CAMPO_xProd As String, ByVal CAMPO_NCM As String, ByVal CAMPO_EXTIPI As String, _ ByVal CAMPO_CFOP As String, ByVal CAMPO_uCom As String, ByVal CAMPO_qCom As Double, _ ByVal CAMPO_vUnCom As Double, ByVal CAMPO_vProd As Double, ByVal CAMPO_cEANTrib As String, _ ByVal CAMPO_uTrib As String, ByVal CAMPO_qTrib As Double, ByVal CAMPO_vUnTrib As Double, _ ByVal CAMPO_vFrete As Double, ByVal CAMPO_vSeg As Double, ByVal CAMPO_vDesc As Double, _ Optional ByVal CAMPO_vOutro As Double = 0, Optional ByVal CAMPO_indTot As String = "", _ Optional ByVal CAMPO_xPed As String = "", Optional ByVal CAMPO_nItemPed As String = "", Optional ByVal CAMPO_infAdProd As String = "") With drdet .Item("nItem") = INDICE_Prod + 1 .Item("det_Id") = INDICE_Prod .Item("infAdProd") = CAMPO_infAdProd End With With drprod .Item("cProd") = CAMPO_cProd .Item("cEAN") = CAMPO_cEAN .Item("xProd") = CAMPO_xProd .Item("NCM") = CAMPO_NCM .Item("EXTIPI") = CAMPO_EXTIPI .Item("CFOP") = CAMPO_CFOP .Item("uCom") = CAMPO_uCom .Item("qCom") = CAMPO_qCom .Item("vUnCom") = CAMPO_vUnCom .Item("vProd") = CAMPO_vProd .Item("cEANTrib") = CAMPO_cEANTrib .Item("uTrib") = CAMPO_uTrib .Item("qTrib") = CAMPO_qTrib .Item("vUnTrib") = CAMPO_vUnTrib .Item("vFrete") = CAMPO_vFrete .Item("vSeg") = CAMPO_vSeg .Item("vDesc") = CAMPO_vDesc .Item("vOutro") = CAMPO_vOutro .Item("indTot") = CAMPO_indTot .Item("xPed") = CAMPO_xPed .Item("nItemPed") = CAMPO_nItemPed .Item("det_Id") = drdet.Item("det_Id") End With With drImposto .Item("det_id") = drdet.Item("det_Id") End With dsNFe.Tables("imposto").Rows.Add(drImposto) With drICMS .Item("imposto_Id") = drImposto.Item("imposto_Id") End With dsNFe.Tables("ICMS").Rows.Add(drICMS) End Sub #End Region #Region "FUNÇÕES QUE COMPLEMENTAM A DESCRIÇÃO DO PRODUTO" Public Sub Complementar_Produto(ByVal MEDICAMENTO_nLote As String, ByVal MEDICAMENTO_qLote As Double, ByVal MEDICAMENTO_dFab As Date, ByVal MEDICAMENTO_dVal As Date, ByVal MEDICAMENTO_vPMC As Double) With drmed .Item("nLote") = MEDICAMENTO_nLote .Item("qLote") = MEDICAMENTO_qLote .Item("dFab") = MEDICAMENTO_dFab .Item("dVal") = MEDICAMENTO_dVal .Item("vPMC") = MEDICAMENTO_vPMC .Item("prod_Id") = drprod.Item("prod_Id") End With End Sub Public Sub Complementar_Produto(ByVal ARMA_tpArma As String, ByVal ARMA_nSerie As String, ByVal ARMA_nCano As String, ByVal ARMA_descr As String) With drarma .Item("tpArma") = ARMA_tpArma .Item("nSerie") = ARMA_nSerie .Item("nCano") = ARMA_nCano .Item("descr") = ARMA_descr .Item("prod_Id") = drprod.Item("prod_Id") End With End Sub Public Sub Complementar_Produto(ByVal COMBUSTIVEL_cProdANP As String, ByVal COMBUSTIVEL_CODIF As String, ByVal COMBUSTIVEL_qTemp As Double, ByVal COMBUSTIVEL_UFCons As String) With drcomb .Item("cProdANP") = COMBUSTIVEL_cProdANP .Item("CODIF") = COMBUSTIVEL_CODIF .Item("qTemp") = COMBUSTIVEL_qTemp .Item("UFCons") = COMBUSTIVEL_UFCons .Item("prod_Id") = drprod.Item("prod_Id") End With End Sub #End Region #Region "FUNÇÕES PARA GERAR OS ICMS" Public Sub Gerar_000(ByVal ICMS00_orig As Integer, ByVal ICMS00_CST As String, ByVal ICMS00_modBC As String, ByVal ICMS00_vBC As Double, ByVal ICMS00_pICMS As Double, ByVal ICMS00_vICMS As Double) With drICMS00 .Item("orig") = ICMS00_orig .Item("CST") = ICMS00_CST .Item("modBC") = ICMS00_modBC .Item("vBC") = ICMS00_vBC .Item("pICMS") = ICMS00_pICMS .Item("vICMS") = ICMS00_vICMS .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_010(ByVal ICMS10_orig As Integer, ByVal ICMS10_CST As String, ByVal ICMS10_modBC As String, _ ByVal ICMS10_vBC As Double, ByVal ICMS10_pICMS As Double, ByVal ICMS10_vICMS As Double, _ ByVal ICMS10_modBCST As String, ByVal ICMS10_pMVAST As Double, ByVal ICMS10_pRedBCST As Double, _ ByVal ICMS10_vBCST As Double, ByVal ICMS10_pICMSST As Double, ByVal ICMS10_vICMSST As Double) With drICMS10 .Item("orig") = ICMS10_orig .Item("CST") = ICMS10_CST .Item("modBC") = ICMS10_modBC .Item("vBC") = ICMS10_vBC .Item("pICMS") = ICMS10_pICMS .Item("vICMS") = ICMS10_vICMS .Item("modBCST") = ICMS10_modBCST .Item("pMVAST") = ICMS10_pMVAST .Item("pRedBCST") = ICMS10_pRedBCST .Item("vBCST") = ICMS10_vBCST .Item("pICMSST") = ICMS10_pICMSST .Item("vICMSST") = ICMS10_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_020(ByVal ICMS20_orig As Integer, ByVal ICMS20_CST As String, ByVal ICMS20_modBC As String, _ ByVal ICMS20_pRedBC As Double, ByVal ICMS20_vBC As Double, ByVal ICMS20_pICMS As Double, _ ByVal ICMS20_vICMS As Double) With drICMS20 .Item("orig") = ICMS20_orig .Item("CST") = ICMS20_CST .Item("modBC") = ICMS20_modBC .Item("pRedBC") = ICMS20_pRedBC .Item("vBC") = ICMS20_vBC .Item("pICMS") = ICMS20_pICMS .Item("vICMS") = ICMS20_vICMS .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_030(ByVal ICMS30_orig As Integer, ByVal ICMS30_CST As String, ByVal ICMS30_modBCST As String, _ ByVal ICMS30_pMVAST As Double, ByVal ICMS30_pRedBCST As Double, ByVal ICMS30_vBCST As Double, _ ByVal ICMS30_pICMSST As Double, ByVal ICMS30_vICMSST As Double) With drICMS30 .Item("orig") = ICMS30_orig .Item("CST") = ICMS30_CST .Item("modBCST") = ICMS30_modBCST .Item("pMVAST") = ICMS30_pMVAST .Item("pRedBCST") = ICMS30_pRedBCST .Item("vBCST") = ICMS30_vBCST .Item("pICMSST") = ICMS30_pICMSST .Item("vICMSST") = ICMS30_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_040(ByVal ICMS40_orig As Integer, ByVal ICMS40_CST As String, ByVal ICMS40_vICMS As Double, ByVal ICMS40_motDesICMS As String) With drICMS40 .Item("orig") = ICMS40_orig .Item("CST") = ICMS40_CST .Item("vICMS") = ICMS40_vICMS .Item("motDesICMS") = ICMS40_motDesICMS .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_051(ByVal ICMS51_orig As Integer, ByVal ICMS51_CST As String, ByVal ICMS51_modBC As String, ByVal ICMS51_pRedBC As Double, _ ByVal ICMS51_vBC As Double, ByVal ICMS51_pICMS As Double, ByVal ICMS51_vICMS As Double) With drICMS51 .Item("orig") = ICMS51_orig .Item("CST") = ICMS51_CST .Item("modBC") = ICMS51_modBC .Item("pRedBC") = ICMS51_pRedBC .Item("vBC") = ICMS51_vBC .Item("pICMS") = ICMS51_pICMS .Item("vICMS") = ICMS51_vICMS .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_060(ByVal ICMS60_orig As Integer, ByVal ICMS60_CST As String, ByVal ICMS60_vBCSTRet As Double, ByVal ICMS60_vICMSSTRet As Double) With drICMS60 .Item("orig") = ICMS60_orig .Item("CST") = ICMS60_CST .Item("vBCSTRet") = ICMS60_vBCSTRet .Item("vICMSSTRet") = ICMS60_vICMSSTRet .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_070(ByVal ICMS70_orig As Integer, ByVal ICMS70_CST As String, ByVal ICMS70_modBC As String, ByVal ICMS70_pRedBC As Double, ByVal ICMS70_vBC As Double, ByVal ICMS70_pICMS As Double, ByVal ICMS70_vICMS As Double, _ ByVal ICMS70_modBCST As String, ByVal ICMS70_pMVAST As Double, ByVal ICMS70_pRedBCST As Double, _ ByVal ICMS70_vBCST As Double, ByVal ICMS70_pICMSST As Double, ByVal ICMS70_vICMSST As Double) With drICMS70 .Item("orig") = ICMS70_orig .Item("CST") = ICMS70_CST .Item("modBC") = ICMS70_modBC .Item("pRedBC") = ICMS70_pRedBC .Item("vBC") = ICMS70_vBC .Item("pICMS") = ICMS70_pICMS .Item("vICMS") = ICMS70_vICMS .Item("modBCST") = ICMS70_modBCST .Item("pMVAST") = ICMS70_pMVAST .Item("pRedBCST") = ICMS70_pRedBCST .Item("vBCST") = ICMS70_vBCST .Item("pICMSST") = ICMS70_pICMSST .Item("vICMSST") = ICMS70_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_090(ByVal ICMS90_orig As Integer, ByVal ICMS90_CST As String, ByVal ICMS90_modBC As String, _ ByVal ICMS90_vBC As Double, ByVal ICMS90_pRedBC As Double, ByVal ICMS90_pICMS As Double, _ ByVal ICMS90_vICMS As Double, ByVal ICMS90_modBCST As String, ByVal ICMS90_pMVAST As Double, _ ByVal ICMS90_pRedBCST As Double, ByVal ICMS90_vBCST As Double, ByVal ICMS90_pICMSST As Double, _ ByVal ICMS90_vICMSST As Double) With drICMS90 .Item("orig") = ICMS90_orig .Item("CST") = ICMS90_CST .Item("modBC") = ICMS90_modBC .Item("vBC") = ICMS90_vBC .Item("pRedBC") = ICMS90_pRedBC .Item("pICMS") = ICMS90_pICMS .Item("vICMS") = ICMS90_vICMS .Item("modBCST") = ICMS90_modBCST .Item("pMVAST") = ICMS90_pMVAST .Item("pRedBCST") = ICMS90_pRedBCST .Item("vBCST") = ICMS90_vBCST .Item("pICMSST") = ICMS90_pICMSST .Item("vICMSST") = ICMS90_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSPart(ByVal ICMSPart_orig As Integer, ByVal ICMSPart_CST As String, ByVal ICMSPart_modBC As String, _ ByVal ICMSPart_vBC As Double, ByVal ICMSPart_pRedBC As Double, ByVal ICMSPart_pICMS As Double, _ ByVal ICMSPart_vICMS As Double, ByVal ICMSPart_modBCST As String, ByVal ICMSPart_pMVAST As Double, _ ByVal ICMSPart_pRedBCST As Double, ByVal ICMSPart_vBCST As Double, ByVal ICMSPart_pICMSST As Double, ByVal ICMSPart_vICMSST As Double, _ ByVal ICMSPart_pBCOp As Double, ByVal ICMSPart_UFST As String) With drICMSPart .Item("orig") = ICMSPart_orig .Item("CST") = ICMSPart_CST .Item("modBC") = ICMSPart_modBC .Item("vBC") = ICMSPart_vBC .Item("pRedBC") = ICMSPart_pRedBC .Item("pICMS") = ICMSPart_pICMS .Item("vICMS") = ICMSPart_vICMS .Item("modBCST") = ICMSPart_modBCST .Item("pMVAST") = ICMSPart_pMVAST .Item("pRedBCST") = ICMSPart_pRedBCST .Item("vBCST") = ICMSPart_vBCST .Item("pICMSST") = ICMSPart_pICMSST .Item("vICMSST") = ICMSPart_vICMSST .Item("pBCOp") = ICMSPart_pBCOp .Item("UFST") = ICMSPart_UFST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSST(ByVal ICMSST_orig As Integer, ByVal ICMSST_CST As String, ByVal ICMSST_vBCSTRet As Double, ByVal ICMSST_vICMSSTRet As Double, ByVal ICMSST_vBCSTDest As Double, ByVal ICMSST_vICMSSTDest As Double) With drICMSST .Item("orig") = ICMSST_orig .Item("CST") = ICMSST_CST .Item("vBCSTRet") = ICMSST_vBCSTRet .Item("vICMSSTRet") = ICMSST_vICMSSTRet .Item("vBCSTDest") = ICMSST_vBCSTDest .Item("vICMSSTDest") = ICMSST_vICMSSTDest .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN101(ByVal ICMSSN101_orig As Integer, ByVal ICMSSN101_CSOSN As String, ByVal ICMSSN101_pCredSN As Double, ByVal ICMSSN101_vCredICMSSN As Double) With drICMSSN101 .Item("orig") = ICMSSN101_orig .Item("CSOSN") = ICMSSN101_CSOSN .Item("pCredSN") = ICMSSN101_pCredSN .Item("vCredICMSSN") = ICMSSN101_vCredICMSSN .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN102(ByVal ICMSSN102_orig As Integer, ByVal ICMSSN102_CSOSN As String) With drICMSSN102 .Item("orig") = ICMSSN102_orig .Item("CSOSN") = ICMSSN102_CSOSN .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN201(ByVal ICMSSN201_orig As Integer, ByVal ICMSSN201_CSOSN As String, ByVal ICMSSN201_modBCST As String, _ ByVal ICMSSN201_pMVAST As Double, ByVal ICMSSN201_pRedBCST As Double, ByVal ICMSSN201_vBCST As Double, _ ByVal ICMSSN201_pICMSST As Double, ByVal ICMSSN201_vICMSST As Double, ByVal ICMSSN201_pCredSN As Double, _ ByVal ICMSSN201_vCredICMSSN As Double) With drICMSSN201 .Item("orig") = ICMSSN201_orig .Item("CSOSN") = ICMSSN201_CSOSN .Item("modBCST") = ICMSSN201_modBCST .Item("pMVAST") = ICMSSN201_pMVAST .Item("pRedBCST") = ICMSSN201_pRedBCST .Item("vBCST") = ICMSSN201_vBCST .Item("pICMSST") = ICMSSN201_pICMSST .Item("vICMSST") = ICMSSN201_vICMSST .Item("pCredSN") = ICMSSN201_pCredSN .Item("vCredICMSSN") = ICMSSN201_vCredICMSSN .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN202(ByVal CMSSN202_orig As Integer, ByVal CMSSN202_CSOSN As String, ByVal CMSSN202_modBCST As String, ByVal CMSSN202_pMVAST As Double, _ ByVal CMSSN202_pRedBCST As Double, ByVal CMSSN202_vBCST As Double, ByVal CMSSN202_pICMSST As Double, ByVal CMSSN202_vICMSST As Double) With drICMSSN202 .Item("orig") = CMSSN202_orig .Item("CSOSN") = CMSSN202_CSOSN .Item("modBCST") = CMSSN202_modBCST .Item("pMVAST") = CMSSN202_pMVAST .Item("pRedBCST") = CMSSN202_pRedBCST .Item("vBCST") = CMSSN202_vBCST .Item("pICMSST") = CMSSN202_pICMSST .Item("vICMSST") = CMSSN202_vICMSST .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN500(ByVal ICMSSN500_orig As Integer, ByVal ICMSSN500_CSOSN As String, ByVal ICMSSN500_vBCSTRet As Double, ByVal ICMSSN500_vICMSSTRet As Double) With drICMSSN500 .Item("orig") = ICMSSN500_orig .Item("CSOSN") = ICMSSN500_CSOSN .Item("vBCSTRet") = ICMSSN500_vBCSTRet .Item("vICMSSTRet") = ICMSSN500_vICMSSTRet .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub Public Sub Gerar_ICMSSN900(ByVal ICMSSN900_orig As Integer, ByVal ICMSSN900_CSOSN As String, ByVal ICMSSN900_modBC As String, ByVal ICMSSN900_vBC As Double, ByVal ICMSSN900_pRedBC As Double, _ ByVal ICMSSN900_pICMS As Double, ByVal ICMSSN900_vICMS As Double, ByVal ICMSSN900_modBCST As String, ByVal ICMSSN900_pMVAST As Double, ByVal ICMSSN900_pRedBCST As Double, _ ByVal ICMSSN900_vBCST As Double, ByVal ICMSSN900_pICMSST As Double, ByVal ICMSSN900_vICMSST As Double, ByVal ICMSSN900_pCredSN As Double, ByVal ICMSSN900_vCredICMSSN As Double) With drICMSSN900 .Item("orig") = ICMSSN900_orig .Item("CSOSN") = ICMSSN900_CSOSN .Item("modBC") = ICMSSN900_modBC .Item("vBC") = ICMSSN900_vBC .Item("pRedBC") = ICMSSN900_pRedBC .Item("pICMS") = ICMSSN900_pICMS .Item("vICMS") = ICMSSN900_vICMS .Item("modBCST") = ICMSSN900_modBCST .Item("pMVAST") = ICMSSN900_pMVAST .Item("pRedBCST") = ICMSSN900_pRedBCST .Item("vBCST") = ICMSSN900_vBCST .Item("pICMSST") = ICMSSN900_pICMSST .Item("vICMSST") = ICMSSN900_vICMSST .Item("pCredSN") = ICMSSN900_pCredSN .Item("vCredICMSSN") = ICMSSN900_vCredICMSSN .Item("ICMS_id") = drICMS.Item("ICMS_Id") End With End Sub #End Region #Region "CAMPO SOBRE IPI " Public Sub IPI(ByVal CAMPO_clEnq, ByVal CAMPO_CNPJProd, ByVal CAMPO_cSelo, ByVal CAMPO_qSelo, ByVal CAMPO_cEnq) With drIPI .Item("clEnq") = CAMPO_clEnq .Item("CNPJProd") = CAMPO_CNPJProd .Item("cSelo") = CAMPO_cSelo .Item("qSelo") = CAMPO_qSelo .Item("cEnq") = CAMPO_cEnq End With End Sub Public Sub IPITrib(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pIPI, ByVal CAMPO_qUnid, ByVal CAMPO_vUnid, ByVal CAMPO_vIPI) With drIPITrib .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pIPI") = CAMPO_pIPI .Item("qUnid") = CAMPO_qUnid .Item("vUnid") = CAMPO_vUnid .Item("vIPI") = CAMPO_vIPI End With End Sub Public Sub IPINT(ByVal CAMPO_CST) With drIPINT .Item("CST") = CAMPO_CST End With End Sub Public Sub II(ByVal CAMPO_vBC, ByVal CAMPO_vDespAdu, ByVal CAMPO_vII, ByVal CAMPO_vIOF) With drII .Item("vBC") = CAMPO_vBC .Item("vDespAdu") = CAMPO_vDespAdu .Item("vII") = CAMPO_vII .Item("vIOF") = CAMPO_vIOF End With End Sub Public Sub ISSQN(ByVal CAMPO_vBC, ByVal CAMPO_vAliq, ByVal CAMPO_vISSQN, ByVal CAMPO_cMunFG, ByVal CAMPO_cListServ, ByVal CAMPO_cSitTrib) With drISSQN .Item("vBC") = CAMPO_vBC .Item("vAliq") = CAMPO_vAliq .Item("vISSQN") = CAMPO_vISSQN .Item("cMunFG") = CAMPO_cMunFG .Item("cListServ") = CAMPO_cListServ .Item("cSitTrib") = CAMPO_cSitTrib End With End Sub #End Region #Region "ALIQUOTA DO PIS" Public Sub PISAliq(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pPIS, ByVal CAMPO_vPIS) With drPISAliq .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pPIS") = CAMPO_pPIS .Item("vPIS") = CAMPO_vPIS End With End Sub Public Sub PISQtde(ByVal CAMPO_CST, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vPIS) With drPISQtde .Item("CST") = CAMPO_CST .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vPIS") = CAMPO_vPIS End With End Sub Public Sub PISNT(ByVal CAMPO_CST) With drPISNT .Item("CST") = CAMPO_CST End With End Sub Public Sub PISOutr(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pPIS, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vPIS) Dim drPISOutr As DataRow = dsNFe.Tables("PISOutr").NewRow With drPISOutr .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pPIS") = CAMPO_pPIS .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vPIS") = CAMPO_vPIS End With End Sub Public Sub PISST(ByVal CAMPO_vBC, ByVal CAMPO_pPIS, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vPIS) With drPISST .Item("vBC") = CAMPO_vBC .Item("pPIS") = CAMPO_pPIS .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vPIS") = CAMPO_vPIS End With End Sub #End Region #Region "ALIQUOTA COFINS" Public Sub COFINSAliq(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pCOFINS, ByVal CAMPO_vCOFINS) With drCOFINSAliq .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pCOFINS") = CAMPO_pCOFINS .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub Public Sub COFINSQtde(ByVal CAMPO_CST, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vCOFINS) With drCOFINSQtde .Item("CST") = CAMPO_CST .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub Public Sub COFINSNT(ByVal CAMPO_CST) With drCOFINSNT .Item("CST") = CAMPO_CST End With End Sub Public Sub COFINSOutr(ByVal CAMPO_CST, ByVal CAMPO_vBC, ByVal CAMPO_pCOFINS, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vCOFINS) With drCOFINSOutr .Item("CST") = CAMPO_CST .Item("vBC") = CAMPO_vBC .Item("pCOFINS") = CAMPO_pCOFINS .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub Public Sub COFINSST(ByVal CAMPO_vBC, ByVal CAMPO_pCOFINS, ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vCOFINS) With drCOFINSST .Item("vBC") = CAMPO_vBC .Item("pCOFINS") = CAMPO_pCOFINS .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub #End Region #Region "TOTALIZADORES" Public Sub ICMSTot(ByVal CAMPO_vBC, ByVal CAMPO_vICMS, ByVal CAMPO_vBCST, ByVal CAMPO_vST, ByVal CAMPO_vProd, ByVal CAMPO_vFrete, ByVal CAMPO_vSeg, ByVal CAMPO_vDesc, ByVal CAMPO_vII, ByVal CAMPO_vIPI, ByVal CAMPO_vPIS, ByVal CAMPO_vCOFINS, ByVal CAMPO_vOutro, ByVal CAMPO_vNF) With drICMSTot .Item("vBC") = CAMPO_vBC .Item("vICMS") = CAMPO_vICMS .Item("vBCST") = CAMPO_vBCST .Item("vST") = CAMPO_vST .Item("vProd") = CAMPO_vProd .Item("vFrete") = CAMPO_vFrete .Item("vSeg") = CAMPO_vSeg .Item("vDesc") = CAMPO_vDesc .Item("vII") = CAMPO_vII .Item("vIPI") = CAMPO_vIPI .Item("vPIS") = CAMPO_vPIS .Item("vCOFINS") = CAMPO_vCOFINS .Item("vOutro") = CAMPO_vOutro .Item("vNF") = CAMPO_vNF End With End Sub Public Sub ISSQNtot(ByVal CAMPO_vServ, ByVal CAMPO_vBC, ByVal CAMPO_vPIS, ByVal CAMPO_vCOFINS) With drISSQNtot .Item("vServ") = CAMPO_vServ .Item("vBC") = CAMPO_vBC .Item("vISS") = CAMPO_vBC .Item("vPIS") = CAMPO_vPIS .Item("vCOFINS") = CAMPO_vCOFINS End With End Sub Public Sub retTrib(ByVal CAMPO_vRetPIS, ByVal CAMPO_vRetCOFINS, ByVal CAMPO_vRetCSLL, ByVal CAMPO_vBCIRRF, ByVal CAMPO_vIRRF, ByVal CAMPO_vBCRetPrev, ByVal CAMPO_vRetPrev) With drretTrib .Item("vRetPIS") = CAMPO_vRetPIS .Item("vRetCOFINS") = CAMPO_vRetCOFINS .Item("vRetCSLL") = CAMPO_vRetCSLL .Item("vBCIRRF") = CAMPO_vBCIRRF .Item("vIRRF") = CAMPO_vIRRF .Item("vBCRetPrev") = CAMPO_vBCRetPrev .Item("vRetPrev") = CAMPO_vRetPrev End With End Sub #End Region #Region "DADOS REFERENTES A TRANSPORTADORA" Public Sub transp(ByVal CAMPO_modFrete, ByVal CAMPO_vagao, ByVal CAMPO_balsa) With drtransp .Item("modFrete") = CAMPO_modFrete .Item("vagao") = CAMPO_vagao .Item("balsa") = CAMPO_balsa End With End Sub Public Sub Transporta(ByVal CAMPO_CNPJ, ByVal CAMPO_CPF, ByVal CAMPO_xNome, ByVal CAMPO_IE, ByVal CAMPO_xEnder, ByVal CAMPO_xMun, ByVal CAMPO_UF) With drtransporta .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xNome") = CAMPO_xNome .Item("IE") = CAMPO_IE .Item("xEnder") = CAMPO_xEnder .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF End With End Sub Public Sub retTransp(ByVal CAMPO_vServ, ByVal CAMPO_vBCRet, ByVal CAMPO_pICMSRet, ByVal CAMPO_vICMSRet, ByVal CAMPO_CFOP, ByVal CAMPO_cMunFG) With drretTransp .Item("vServ") = CAMPO_vServ .Item("vBCRet") = CAMPO_vBCRet .Item("pICMSRet") = CAMPO_pICMSRet .Item("vICMSRet") = CAMPO_vICMSRet .Item("CFOP") = CAMPO_CFOP .Item("cMunFG") = CAMPO_cMunFG End With End Sub Public Sub veicTransp(ByVal CAMPO_placa, ByVal CAMPO_UF, ByVal CAMPO_RNTC) With drveicTransp .Item("placa") = CAMPO_placa .Item("UF") = CAMPO_UF .Item("RNTC") = CAMPO_RNTC End With End Sub Public Sub reboque(ByVal CAMPO_placa, ByVal CAMPO_UF, ByVal CAMPO_RNTC) With drreboque .Item("placa") = CAMPO_placa .Item("UF") = CAMPO_UF .Item("RNTC") = CAMPO_RNTC End With End Sub Public Sub Vol(ByVal CAMPO_qVol, ByVal CAMPO_esp, ByVal CAMPO_marca, ByVal CAMPO_nVol, ByVal CAMPO_pesoL, ByVal CAMPO_pesoB) With drvol .Item("qVol") = CAMPO_qVol .Item("esp") = CAMPO_esp .Item("marca") = CAMPO_marca .Item("nVol") = CAMPO_nVol .Item("pesoL") = CAMPO_pesoL .Item("pesoB") = CAMPO_pesoB End With End Sub Public Sub lacres(ByVal CAMPO_nLacre) With drlacres .Item("nLacre") = CAMPO_nLacre End With End Sub #End Region #Region "DEMAIS FUNÇÕES PARA NF-e" Public Sub VeicProd(ByVal CAMPO_tpOp, ByVal CAMPO_chassi, ByVal CAMPO_cCor, ByVal CAMPO_xCor, ByVal CAMPO_pot, ByVal CAMPO_cilin, ByVal CAMPO_pesoL, ByVal CAMPO_pesoB, ByVal CAMPO_nSerie, _ ByVal CAMPO_tpComb, ByVal CAMPO_nMotor, ByVal CAMPO_CMT, ByVal CAMPO_dist, ByVal CAMPO_anoMod, ByVal CAMPO_anoFab, ByVal CAMPO_tpPint, ByVal CAMPO_tpVeic, ByVal CAMPO_espVeic, ByVal CAMPO_VIN, _ ByVal CAMPO_condVeic, ByVal CAMPO_cMod, ByVal CAMPO_cCorDENATRAN, ByVal CAMPO_lota, ByVal CAMPO_tpRest) With drveicProd .Item("tpOp") = CAMPO_tpOp .Item("chassi") = CAMPO_chassi .Item("cCor") = CAMPO_cCor .Item("xCor") = CAMPO_xCor .Item("pot") = CAMPO_pot .Item("cilin") = CAMPO_cilin .Item("pesoL") = CAMPO_pesoL .Item("pesoB") = CAMPO_pesoB .Item("nSerie") = CAMPO_nSerie .Item("tpComb") = CAMPO_tpComb .Item("nMotor") = CAMPO_nMotor .Item("CMT") = CAMPO_CMT .Item("dist") = CAMPO_dist .Item("anoMod") = CAMPO_anoMod .Item("anoFab") = CAMPO_anoFab .Item("tpPint") = CAMPO_tpPint .Item("tpVeic") = CAMPO_tpVeic .Item("espVeic") = CAMPO_espVeic .Item("VIN") = CAMPO_VIN .Item("condVeic") = CAMPO_condVeic .Item("cMod") = CAMPO_cMod .Item("cCorDENATRAN") = CAMPO_cCorDENATRAN .Item("lota") = CAMPO_lota .Item("tpRest") = CAMPO_tpRest End With End Sub Public Sub fat(ByVal CAMPO_nFat, ByVal CAMPO_vOrig, ByVal CAMPO_vDesc, ByVal CAMPO_vLiq) With drfat .Item("nFat") = CAMPO_nFat .Item("vOrig") = CAMPO_vOrig .Item("vDesc") = CAMPO_vDesc .Item("vLiq") = CAMPO_vLiq End With End Sub Public Sub dup(ByVal CAMPO_nDup, ByVal CAMPO_dVenc, ByVal CAMPO_vDup) With drdup .Item("nDup") = CAMPO_nDup .Item("dVenc") = CAMPO_dVenc .Item("vDup") = CAMPO_vDup End With End Sub Public Sub infAdic(ByVal CAMPO_infAdFisco, ByVal CAMPO_infCpl) With drinfAdic .Item("infAdFisco") = CAMPO_infAdFisco .Item("infCpl") = CAMPO_infCpl End With End Sub Public Sub obsCont(ByVal CAMPO_xTexto) With drobsCont .Item("xTexto") = CAMPO_xTexto End With End Sub Public Sub obsFisco(ByVal CAMPO_xTexto) With drobsFisco .Item("xTexto") = CAMPO_xTexto End With End Sub Public Sub procRef(ByVal CAMPO_nProc, ByVal CAMPO_indProc) With drprocRef .Item("nProc") = CAMPO_nProc .Item("indProc") = CAMPO_indProc End With End Sub Public Sub exporta(ByVal CAMPO_UFEmbarq, ByVal CAMPO_xLocEmbarq) With drexporta .Item("UFEmbarq") = CAMPO_UFEmbarq .Item("xLocEmbarq") = CAMPO_xLocEmbarq End With End Sub Public Sub compra(ByVal CAMPO_xNEmp, ByVal CAMPO_xPed, ByVal CAMPO_xCont) With drcompra .Item("xNEmp") = CAMPO_xNEmp .Item("xPed") = CAMPO_xPed .Item("xCont") = CAMPO_xCont End With End Sub Public Sub cana(ByVal CAMPO_safra, ByVal CAMPO_ref, ByVal CAMPO_qTotMes, ByVal CAMPO_qTotAnt, ByVal CAMPO_qTotGer, ByVal CAMPO_vFor, ByVal CAMPO_vTodDed, ByVal CAMPO_vLiqFor) With drcana .Item("safra") = CAMPO_safra .Item("ref") = CAMPO_ref .Item("qTotMes") = CAMPO_qTotMes .Item("qTotAnt") = CAMPO_qTotAnt .Item("qTotGer") = CAMPO_qTotGer .Item("vFor") = CAMPO_vFor .Item("vTodDed") = CAMPO_vTodDed .Item("vLiqFor") = CAMPO_vLiqFor End With End Sub Public Sub forDia(ByVal CAMPO_qtde) With drforDia .Item("qtde") = CAMPO_qtde End With End Sub Public Sub deduc(ByVal CAMPO_xDed, ByVal CAMPO_vDed) With drdeduc .Item("xDed") = CAMPO_xDed .Item("vDed") = CAMPO_vDed End With End Sub Public Sub Informacoes_NFe(ByVal CAMPO_cUF As String, ByVal CAMPO_AAMM As String, ByVal CAMPO_CNPJ As String, ByVal CAMPO_mod As String, ByVal CAMPO_serie As String, ByVal CAMPO_nNF As Integer) With drrefNF .Item("cUF") = CAMPO_cUF .Item("AAMM") = CAMPO_AAMM .Item("CNPJ") = CAMPO_CNPJ .Item("mod") = CAMPO_mod .Item("serie") = CAMPO_serie .Item("nNF") = CAMPO_nNF End With End Sub Public Sub Referencia_ProdutorRural(ByVal CAMPO_cUF As String, ByVal CAMPO_AAMM As String, ByVal CAMPO_CNPJ As String, ByVal CAMPO_CPF As String, ByVal CAMPO_IE As String, ByVal CAMPO_mod As String, ByVal CAMPO_serie As String, ByVal CAMPO_nNF As Integer) With drrefNFP .Item("cUF") = CAMPO_cUF .Item("AAMM") = CAMPO_AAMM .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("IE") = CAMPO_IE .Item("mod") = CAMPO_mod .Item("serie") = CAMPO_serie .Item("nNF") = CAMPO_nNF End With End Sub Public Sub Informacoes_CupomFiscal(ByVal CAMPO_mod As String, ByVal CAMPO_nECF As Integer, ByVal CAMPO_nCOO As Integer) With drrefECF .Item("mod") = CAMPO_mod .Item("nECF") = CAMPO_nECF .Item("nCOO") = CAMPO_nCOO End With End Sub Public Sub Avulsa(ByVal CAMPO_CNPJ, ByVal CAMPO_xOrgao, ByVal CAMPO_matr, ByVal CAMPO_xAgente, ByVal CAMPO_fone, ByVal CAMPO_UF, ByVal CAMPO_nDAR, ByVal CAMPO_dEmi, ByVal CAMPO_vDAR, ByVal CAMPO_repEmi, ByVal CAMPO_dPag) With dravulsa .Item("CNPJ") = CAMPO_CNPJ .Item("xOrgao") = CAMPO_xOrgao .Item("matr") = CAMPO_matr .Item("xAgente") = CAMPO_xAgente .Item("fone") = CAMPO_fone .Item("UF") = CAMPO_UF .Item("nDAR") = CAMPO_nDAR .Item("dEmi") = CAMPO_dEmi .Item("vDAR") = CAMPO_vDAR .Item("repEmi") = CAMPO_repEmi .Item("dPag") = CAMPO_dPag End With End Sub Public Sub retirada(ByVal CAMPO_CNPJ, ByVal CAMPO_CPF, ByVal CAMPO_xLgr, ByVal CAMPO_nro, ByVal CAMPO_xCpl, ByVal CAMPO_xBairro, ByVal CAMPO_xMun, ByVal CAMPO_UF) With drretirada .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xLgr") = CAMPO_xLgr .Item("nro") = CAMPO_nro .Item("xCpl") = CAMPO_xCpl .Item("xBairro") = CAMPO_xBairro '.Item("cMun") = 'FuncaoMunicipios(CAMPO_xMun) .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF End With End Sub Public Sub entrega(ByVal CAMPO_CNPJ, ByVal CAMPO_CPF, ByVal CAMPO_xLgr, ByVal CAMPO_nro, ByVal CAMPO_xCpl, ByVal CAMPO_xBairro, ByVal CAMPO_xMun, ByVal CAMPO_UF) With drentrega .Item("CNPJ") = CAMPO_CNPJ .Item("CPF") = CAMPO_CPF .Item("xLgr") = CAMPO_xLgr .Item("nro") = CAMPO_nro .Item("xCpl") = CAMPO_xCpl .Item("xBairro") = CAMPO_xBairro '.Item("cMun") = 'FuncaoMunicipios(CAMPO_xMun) .Item("xMun") = CAMPO_xMun .Item("UF") = CAMPO_UF End With End Sub Public Sub DI(ByVal CAMPO_nDI, ByVal CAMPO_dDI, ByVal CAMPO_xLocDesemb, ByVal CAMPO_UFDesemb, ByVal CAMPO_dDesemb, ByVal CAMPO_cExportador) With drDI .Item("nDI") = CAMPO_nDI .Item("dDI") = CAMPO_dDI .Item("xLocDesemb") = CAMPO_xLocDesemb .Item("UFDesemb") = CAMPO_UFDesemb .Item("dDesemb") = CAMPO_dDesemb .Item("cExportador") = CAMPO_cExportador End With End Sub Public Sub adi(ByVal CAMPO_nAdicao, ByVal CAMPO_nSeqAdic, ByVal CAMPO_cFabricante, ByVal CAMPO_vDescDI) With dradi .Item("nAdicao") = CAMPO_nAdicao .Item("nSeqAdic") = CAMPO_nSeqAdic .Item("cFabricante") = CAMPO_cFabricante .Item("vDescDI") = CAMPO_vDescDI End With End Sub Public Sub CIDE(ByVal CAMPO_qBCProd, ByVal CAMPO_vAliqProd, ByVal CAMPO_vCIDE) With drCIDE .Item("qBCProd") = CAMPO_qBCProd .Item("vAliqProd") = CAMPO_vAliqProd .Item("vCIDE") = CAMPO_vCIDE End With End Sub #End Region End Class
- Marcado como Resposta Levi DomingosModerator domingo, 14 de novembro de 2010 22:27
-
-
-
Olá Tiger e toda galera,
estou com problemas para consumir o webservice da receita, meu primeiro desafio é o NfeConsulta2, alguém teria um exemplo pra me passar? Estou com grandes dificuldades para consumí-lo usando o certificado digital.
Agradeço desde já.
-
-
-
Leonel,
estou usando C# (framework 2.0). Dei uma verificada no código/url que você passou, mas não consegui seguir toda a lógica por faltar muita coisa (métodos, atributos...), se tiver como disponibilizar o código completo (as classes envolvidas), pode ser apenas o que acessa um web service.
Não estou conseguindo referenciar o ws no projeto, por pedir certificado digital.
Obrigado.
-
Fala ai Romulo,
fiz um exemplo para demonstrar as funcionalidades
Link para download: http://www.leonel.in/post/Implementando-Consulta-NFe-v200-em-WindosForms-VS2008.aspx
Abraços Bom dia!
-
Olá pessoal.
Estou fazendo testes com os Web Services da NFe 2.00 e não estou conseguindo consumi-los em meu aplicativo.
alguem poderia me ajudar com algum exemplo?
http://social.msdn.microsoft.com/Forums/pt-BR/vsvbasicpt/thread/95d28536-daae-40c4-a5a6-0eb9729bfad4
Just Be Humble Malange! -
Oi pessoal,
Voces que estão desenvolvendo algo pra NFe, algum de voces ja tiveram o problema dele ficar pedindo o PIN do certificado digital para tentar enviar o arquivo?
Pois aparatemente ta tudo certo mas ele não para de ficar me pedindo o PIN da nfe! Segue abaixo o codigo que eu to usando, se tiver algum me avisem pls!!!
Private Function enviarNFe(ByVal NFeXML As String) As String Dim arquivo As String = "c:\temp\" Dim arquivoRT As String = arquivo + "RET_" + _chaveDeAcesso + ".xml" Dim arq As New XmlDocument Dim resposta As XmlNode arq.Load(NFeXML) Dim certificado As New Certificado Dim cert As New X509Certificate2 Dim key As PublicKey cert = certificado.BuscaNome("") _wsEnviar.ClientCertificates.Add(cert) key = cert.PublicKey resposta = _wsEnviar.nfeRecepcaoLote2(arq)
é exatamente nessa ultima linha que ele não para de ficar pedindo o pin!!! -
Oi pessoal,
Voces que estão desenvolvendo algo pra NFe, algum de voces ja tiveram o problema dele ficar pedindo o PIN do certificado digital para tentar enviar o arquivo?
Pois aparatemente ta tudo certo mas ele não para de ficar me pedindo o PIN da nfe! Segue abaixo o codigo que eu to usando, se tiver algum me avisem pls!!!
Private Function enviarNFe(ByVal NFeXML As String) As String Dim arquivo As String = "c:\temp\" Dim arquivoRT As String = arquivo + "RET_" + _chaveDeAcesso + ".xml" Dim arq As New XmlDocument Dim resposta As XmlNode arq.Load(NFeXML) Dim certificado As New Certificado Dim cert As New X509Certificate2 Dim key As PublicKey cert = certificado.BuscaNome("") _wsEnviar.ClientCertificates.Add(cert) key = cert.PublicKey resposta = _wsEnviar.nfeRecepcaoLote2(arq)
é exatamente nessa ultima linha que ele não para de ficar pedindo o pin!!!
Como meu certificado digital é do serasa experian, o software deles do cartão inteligente para windows 7 ta dando esse problema! é só instalar o do win xp!!! -
Bom dia Jenny,
Tente fazer a busca do certificado desta forma, viu código abaixo:
Caso precise da assinatura use este post: http://www.leonel.in/post/Metodo-de-Assinatura-do-XML-da-NF-e.aspx
public X509Certificate2 BuscaCertificado(string numeroSerial) { try { X509Certificate2 certificado = null; X509Store store = new X509Store(StoreName.My , StoreLocation.LocalMachine); store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly); foreach (X509Certificate2 item in store.Certificates) { if (item.SerialNumber.ToUpper().Equals(numeroSerial.LimparEspacos().ToUpper())) certificado = item; } if (certificado == null) throw new Exception(String.Format("Certificado digital nº {0} não encontrado.\nÉ necessário fazer a instalação do mesmo.", numeroSerial.LimparEspacos().ToUpper())); return certificado; } catch (Exception de) { throw new BusinessException("BuscaCertificado", de.Message, this.GetType().FullName, true); } }
-
Era justamente isso que eu iria responder. Basta usar o driver ou o OS Windows XP que esse problema do PIN para de ocorrer.
Thnx !- Marcado como Resposta Levi DomingosModerator domingo, 14 de novembro de 2010 22:28
-
Opa então EderAdz.
Bom tem um Exemplo q irá lhe ajudar bastante já q a linguagem e a C#...
Na Internet o pessoal da Empresa UNAMAKE disponibiliza o Fonte de Aplicativo Emissor de Notas Fiscais. para auxilio de quem está começando com o projeto.O Conteudo e otimo e com ele dá para vc desenvolver toda a parte do projeto no qual e relacionado a comunicação com os Web Services do governo.
Agora com relação a criar um XML para que possa ser validado e Enviado para os WS.Postei aqui um codigo de minha autoria. só que em VB.NET mais axo que não terá muita duvida para converte-lo para C#.Só uma pequena OBS. Este codigo tenta gerar a nota fiscal na versão 2.0
Ainda não usei criei mesmo para ajudar o pessoal Mas acredito que a logica que foi aplicada esteja facil de se entender.
Public Class NFEletronica Private dsNFe As New DataSet Public _TotaisIndice As String #Region "Variaveis para gerar a NF-e" 'Objetos do tipo Datarow que representão 'Novas linhas no dataset Carregado com o Schema XSD da Versão 2.00 'da Nota Fiscal Eletronica 'Com essas Datarow´s manipulo os dados Indexando e inserindo valores 'separadamente por Tabelas.Após as principais tabelas serem preenchidas 'corretamente adiono as novas linhas ao dataset e gero um XML atravês dele. ' ' ' ' Dim drNFe As DataRow = dsNFe.Tables("NFe").NewRow Dim drInfNfe As DataRow = dsNFe.Tables("InfNFe").NewRow Dim drNFref As DataRow = dsNFe.Tables("NFref").NewRow Dim dride As DataRow = dsNFe.Tables("ide").NewRow Dim dremit As DataRow = dsNFe.Tables("emit").NewRow Dim drICMS90 As DataRow = dsNFe.Tables("ICMS90").NewRow Dim drICMSPart As DataRow = dsNFe.Tables("ICMSPart").NewRow Dim drICMSST As DataRow = dsNFe.Tables("ICMSST").NewRow Dim drICMSSN101 As DataRow = dsNFe.Tables("ICMSSN101").NewRow Dim drICMSSN102 As DataRow = dsNFe.Tables("ICMSSN102").NewRow Dim drICMSSN201 As DataRow = dsNFe.Tables("ICMSSN201").NewRow
...
... etc
End Sub #End Region End Class
Pessoal, serio mesmo que vocês estão usando este tipo de implementação pra gerar e enviar uma NFe?
Nossa senhora! Desculpem-me mas esse codigo ta horrivel!
Eu abordei uma outra linha de pensamento, e outra "tecnica" de programação usando C# que ficou extremamente limpa, organizada e o principal AUTOMATICA! Se amanha aparece um campo novo na NFe eu acrescento ele em 2 min na minha codificação sem problemas.
Quanto menos vocês puderem usar DataTable melhor. Quem quiser que siga o conselho.
[]s
H1J4CK3R
Thnx ! -
-
E ae Tiger Woods, beleza cara?
Então, um pouco atrasada minha resposta, mas tudo bem.
O que eu fiz e que facilitou demais a minha vida foi implementar um XmlSerializer.
Você cria suas classes todas com base no XML da Nfe, instância essa classe criada, preenche todas as propriedades dela e manda serializar. O programa te devolve o XML pronto, 100% formatado e preenchido. Fica maravilhoso.
:)
Thnx !