josehilton Posted March 20, 2015 Report Share Posted March 20, 2015 Bom dia a TodosPessoal eu nao conseguir entender o calculo do Hashqrcode, e gostaria da ajuda de voces para resolver essa questaose auguem estiver esse exemplo e poder me ajudar fico muito gratochNFe=29150264904295001932550030000499631466480727nVersao=100&tpAmb=1&cDest=13464482000182&dhEmi=20202020202020202020&vNF=1293.50&vICMS=0.00&digVal=357030536D7A4C74346B7A68414D71505A4F7855316544772B38633D&cIdToken=000001chNFe=29150264904295001932550030000499631466480727&nVersao=100&tpAmb=1&cDest=13464482000182&dhEmi=20202020202020202020&vNF=1293.50&vICMS=0.00&digVal=357030536D7A4C74346B7A68414D71505A4F7855316544772B38633D&cIdToken=000001cHasharcode := ????????????????????Sem maisJose HiltonJosehiltonribeiro2014@gmail.com Ronaldbuch 1 Quote Link to comment Share on other sites More sharing options...
PauloPJ Posted March 21, 2015 Report Share Posted March 21, 2015 Ola colega sei como é dificil ajuda mas ai vai a rotina que fiz para gerar o QRCODE Da NFCe + uma funcao para pegar o valor do XML #INCLUDE "Fivewin.ch" #include "hbclass.ch" #include "postgres.ch" #include "hbxml.ch" #include "fileio.ch" *********************************************************************** FUNC GERAHASHQRCODE(cfile) // arquivo xml da nota *********************************************************************** LOCAL arrayProd:=ARRAY_XML(cfile,"nfeProc") LOCAL cChNFe:="" LOCAL ctpAmb:="" LOCAL cdhEmi:="" LOCAL cdigVal:="" LOCAL CvICMS:="" LOCAL CVNF:="" LOCAL LINHA LOCAL CHASHQRCODE W_NFE_CODIGO_CSN := "" W_NFE_CODIGO_ITOKEN := "000001" for ni=1 to len(arrayprod) if len(arrayprod[ni])<>0 if UPPER(arrayprod[ni,1])="CHNFE" cChNFe:=arrayprod[ni,2] end if UPPER(arrayprod[ni,1])="TPAMB" ctpAmb:=arrayprod[ni,2] end if UPPER(arrayprod[ni,1])="DHEMI" cdhEmi:=arrayprod[ni,2] end if UPPER(arrayprod[ni,1])="DIGVAL" cdigval:=arrayprod[ni,2] end if UPPER(arrayprod[ni,1])="VICMS" CVICMS:=arrayprod[ni,2] end if UPPER(arrayprod[ni,1])="VNF" CVNF:=arrayprod[ni,2] end end next linha := 'chNFe=' + cCHNFE+; '&nVersao=' + '100' +; '&tpAmb=' + ctpamb+; //'&cDest=' + '' + '&dhEmi=' + Lower(str2hex(cdhemi))+; '&vNF=' + alltrim(CVNF)+; '&vICMS=' + alltrim(CVICMS)+; '&digVal='+ Lower(str2hex(cdigval))+; '&cIdToken=' + '000001' ChashQRCODE:=CRIA_HASHCODE(LINHA,W_NFE_CODIGO_CSN) ARQUIVOQRCODE:="TEMP\"+ALLTRIM(CCHNFE)+".BMP" // imagem qrcode gerada geraQRcode(chashQRCODE,ARQUIVOQRCODE) RETURN(ARQUIVOQRCODE) *------------------------------------------------------------- func geraQRcode(cCode,cFile) // gera qrcode de um determinado valor e grava no arquivo mencionado *------------------------------------------------------------- local qrDLL default cCode:="" default cFile:="" #define DC_CALL_STD 0x0020 oQRDLL:=LoadLibrary(W_CAMINHO_SYS+"DLL32\QRCodelib.Dll" ) nResp:=DllCall(oQRDLL,DC_CALL_STD,"FastQRCode",cCode,cFile) FreeLibrary(qrDLL) return nil *------------------------------------------------------------------ FUNC ARRAY_XML(cfile,cVariavel) //pega o conteudo de uma tag do xml e retorna um array[tag,valor] *------------------------------------------------------------------ local aRRayret:={} local hfile local oMnuXml if !file(cfile) return({}) end hfile := fopen(cfile) oMnuXml := TXmlDocument():New( hFile ) oXmlNode := oMnuXml:FindFirst(cVariavel) if oXmlNode=nil fclose(hfile) return({}) end oXmlIter := TXmlIterator():New( oXmlNode ) ntam:=1 if oXmlNode != nil while oXmlNode != nil while .T. oTagActual = oXmlIter:Next() If oTagActual = nil exit end aadd(arrayret,{oTagActual:cName,oTagActual:cData}) End oXmlNode := oMnuXml:FindNext(cVariavel) if oXmlNode=nil exit end oXmlIter := TXmlIterator():New( oXmlNode ) oTagActual = oXmlIter:Next() if oTagActual =nil exit end END END fclose(hfile) return(ARRAYRET) Quote Link to comment Share on other sites More sharing options...
josehilton Posted March 23, 2015 Author Report Share Posted March 23, 2015 Valeu Muito obrigado Quote Link to comment Share on other sites More sharing options...
josehilton Posted May 4, 2015 Author Report Share Posted May 4, 2015 Caro igpjinfoEstou fazendo alguns teste e nao estou obtendo exito o hashcodigo nao esta retornando correto veja ? hb_sha1("chNFe=43120910585504000174650010000000541123456781&nVersao=100&tpAmb=2&dhEmi=323031322d30392d32375431363a32303a33342d30333a3030&vNF=1000.00&vICMS=180.00&digVal=37327151612b623074616f514f3966414a7766646c5875715176383d &cIdToken=0000011058550420130001") deveria me retornar 3FACB55248244D98C658FC8A826413BCEF10A4AE mais esta me retornando assim 2bfefc89ddebf732ec53238482e1c8ece9f25b36 Gradeco antecipadamento pela sua ajuda Grato Hilton Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 4, 2015 Report Share Posted May 4, 2015 http://fivewin.com.br/index.php?/topic/21274-qr-code-resolvido/ http://forums.fivetechsupport.com/viewtopic.php?f=3&t=27772 http://www.pctoledo.com.br/forum/viewtopic.php?f=4&t=9223 Quote Link to comment Share on other sites More sharing options...
josehilton Posted May 6, 2015 Author Report Share Posted May 6, 2015 Meu agradecimento a todos que colaborou e meu projetos da nfc-e gracas a deus e a ajuda de todos ja esta funcionando Hilton DATAHORAEX := Lower(Str2Hex( nfe_emissao )) cdigval := Lower(Str2Hex(nfe_digval)) cQrcode := "chNFe="+alltrim(nfe_chave) cQrcode +="&nVersao=100" cQrcode +="&tpAmb="+alltrim(nfe_tipoambiente) cQrcode +="&dhEmi="+DATAHORAEX cQrcode +="&vNF="+alltrim(nfe_t_valornota) cQrCode +="&vICMS="+alltrim(nfe_t_valoricms) CqRcODE += '&digVal=' +cdigval CqRCODE += ' &cIdToken=' +'000001' //chNFe=29150513464482000182650010000000071000000077&nVersao=100&tpAmb=2&dhEmi=323031352d30352d30355431323a34393a31322d30333a3030&vNF=800.00&vICMS=0.00&digVal=393547787a314552464a7338652b6b5357592f54367a7a773438733d &cIdToken=000001 cCripto := hb_sha1(cQrcode) Memo1Text := "http://hnfe.sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx?" Memo1Text += cQrcode Memo1Text += '&cHashQRCode=' + Upper(cCripto) //http://hnfe.sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx?chNFe=29150513464482000182650010000000071000000077&nVersao=100&tpAmb=2&dhEmi=323031352d30352d30355431323a34393a31322d30333a3030&vNF=800.00&vICMS=0.00&digVal=393547787a314552464a7338652b6b5357592f54367a7a773438733d&cIdToken=000001&cHashQRCode=291FDA5C7420FA4B8D074069CB3EBB37422D66E2 if GeraQrCode(Memo1Text,cFileName) = 0 cBmpFile := cFilename //getcurdir()+"\images3.bmp" if file(cBmpFile) ? 'existe o bitmap',cBmpFile endif //PrintBitMap( oPrinter, cBMPFile ) //oPrinter:SetPrc(oPrinter:Prow()+05 ,1 ) endif Quote Link to comment Share on other sites More sharing options...
josehilton Posted May 6, 2015 Author Report Share Posted May 6, 2015 Meu agradecimento a todos that colaborou e meu Projetos da NFC-e Graças a deus eA Ajuda de todos ja ESTA FUNCIONANDO Hilton DATAHORAEX: = Baixa (Str2Hex (nfe_emissao)) cdigval: = Baixa (Str2Hex (nfe_digval)) cQrcode: = "chNFe =" + alltrim (nfe_chave) cQrcode + = "& nVersao = 100" cQrcode + = "& tpAmb =" + alltrim (nfe_tipoambiente) cQrcode + = "& dhEmi =" + DATAHORAEX cQrcode + = "& VNF =" + alltrim (nfe_t_valornota) cQrCode + = "& vímas =" + ALLTRIM (nfe_t_valoricms) CqRcODE + = '& digVal =' + cdigval CqRCODE + = '& cIdToken =' + '000001' //chNFe=29150513464482000182650010000000071000000077&nVersao=100&tpAmb=2&dhEmi=323031352d30352d30355431323a34393a31322d30333a3030&vNF=800.00&vICMS=0.00&digVal=393547787a314552464a7338652b6b5357592f54367a7a773438733d & CIdToken = 000001 cCripto: = hb_sha1 (cQrcode) Memo1Text: = " ? http://hnfe.sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx " Memo1Text + = cQrcode Memo1Text + = '& cHashQRCode =' + Superior (cCripto) // http://hnfe.sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx?chNFe=29150513464482000182650010000000071000000077&nVersao=100&tpAmb=2&dhEmi=323031352d30352d30355431323a34393a31322d30333a3030&vNF=800.00&vICMS=0.00&digVal=393547787a314552464a7338652b6b5357592f54367a7a773438733d &cIdToken=000001&cHashQRCode=291FDA5C7420FA4B8D074069CB3EBB37422D66E2 se GeraQrCode (Memo1Text, cFileName) = 0 cBmpFile: = cFilename //getcurdir()+"\images3.bmp " se o arquivo (cBmpFile) ? "Existe o bitmap ', cBmpFile endif // PrintBitMap (oPrinter, cBMPFile) // OPrinter: SetPrc (oPrinter: Prow () + 05, 1) endif Quote Link to comment Share on other sites More sharing options...
MARSAN Posted June 17, 2015 Report Share Posted June 17, 2015 Hilton primeiramente parabens pelo sucesso no seu projeto. Hilton voce ou algum colega que está atualizado neste projeto poste ai um link para iniciarmos aqui mais esta batalha, me indique onde baixar o material atualizado (manuais e etc) para dar inicio ao desenvolvimento. Quote Link to comment Share on other sites More sharing options...
JUDSON ROSA Posted October 15, 2021 Report Share Posted October 15, 2021 alguem sabe me dizer onde encontro esta funcao ChashQRCODE := CRIA_HASHCODE(LINHA,W_NFE_CODIGO_CSN) Ja q a versao q eu uso do xharbour nao tem o hb_sha1 , queria sabe se alguem ou o Paulo PJ teria como me passar essa funcao. Preciso criar o hash para completar minha rotina : cDados_URL := 'chNFe=' + cCHNFE +; '&nVersao=' + versaoQRCode +; '&tpAmb=' + cTpAmb +; '&dhEmi=' + Lower(str2hex(cdhemi)) +; '&vNF=' + alltrim(CVNF)+; '&vICMS=' + alltrim(CVICMS)+; '&digVal=' + Lower(str2hex(cdigval))+; '&cIdToken=' + alltrim( IdToken ) // criando o hash cCodigo_hash := hb_sha1(cDados_URL) // --------->>>>>>>>>>>>>>>>> AQUI DA ERRO ( POIS MINHA VERSAO NAO TEM ESSA FUNCAO NO XHARBOUR ) URL0 := URLConsulta + "?" URL0 := URL0 + cDados_URL URL0 := URL0 + '&cHashQRCode=' + Upper(cCodigo_hash) no aguardo .. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted October 15, 2021 Report Share Posted October 15, 2021 Peça ao autor: Abs. Quote Link to comment Share on other sites More sharing options...
JUDSON ROSA Posted October 15, 2021 Report Share Posted October 15, 2021 E kapi achei a função onde vc apontou , mas a maesma o hb_sha1() , essa da erro , ou seja nao existe na minha versao FUNC CRIA_HASHCODE(LINHA,CSC) *********************************************************************** local cUrl := 'http://www4.fazenda.rj.gov.br/consultaNFCe/QRCode?' cQrCodeHash := cUrl + linha+'&cHashQRCode=' + lower(hb_sha1(linha+csc,.f.)) return(cQrCodeHash) *********************************************************************** Quote Link to comment Share on other sites More sharing options...
kapiaba Posted October 15, 2021 Report Share Posted October 15, 2021 Qual versão? Se muito velha, não tens saida. Actualize para uma mais recente, só tens a granhar. Abs. Quote Link to comment Share on other sites More sharing options...
JUDSON ROSA Posted October 18, 2021 Report Share Posted October 18, 2021 kapy , uso a versao xh 12.1 kkkk , mais tenho a versao xh 19.06 ( onde fiz um teste e nesta tem o hb_sha1() ) , nao mudei ainda pq nao tenho a versao libmySQL.lib para o xh 19.06 , a pesar q o xh 19.06 tem o mariadb , mas o q falta e o tempo , se alguem tiver a libmySQL.lib para xh 19.06 eu agradeço. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted October 18, 2021 Report Share Posted October 18, 2021 Mira: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.