-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CTE insucesso de entrega - contrib. Ubiratan
- Loading branch information
JoseQuintas
committed
Dec 18, 2024
1 parent
b79c925
commit 9a7c38c
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "sefazclass.ch" | ||
|
||
FUNCTION ze_sefaz_CTeEventoInsucessoEntrega( Self, cChave, nSequencia, nProt, ; | ||
dDataEntrega, cHoraEntrega, nTentativa, cMotivo, cJustificativa, nLatitude, ; | ||
nLongitude, cStrImagem, aChaveNfeList, cCertificado, cAmbiente ) | ||
|
||
LOCAL cChaveNfe, cXml := "", cHash | ||
|
||
hb_Default( @::cVersao, WS_CTE_DEFAULT ) | ||
cHash := hb_Sha1( cChave + hb_Base64Encode( cStrImagem ), .T. ) | ||
cHash := hb_Base64Encode( cHash ) | ||
cXml += [<detEvento versaoEvento="] + ::cVersao + [">] | ||
cXml += [<evIECTe>] | ||
cXml += XmlTag( "descEvento", "Insucesso na Entrega do CT-e" ) | ||
cXml += XmlTag( "nProt", Ltrim( Str( nProt ) ) ) | ||
cXml += XmlTag( "dhTentativaEntrega", DateTimeXml( dDataEntrega, cHoraEntrega, ::cUF ) ) | ||
cXml += XmlTag( "nTentativa", Ltrim( Str( nTentativa ) ) ) | ||
cXml += XmlTag( "tpMotivo", Ltrim( cMotivo ) ) | ||
|
||
if Alltrim(cMotivo) == '4' | ||
cXml += XmlTag( "xJustMotivo", Ltrim( cJustificativa ) ) | ||
endif | ||
|
||
IF nLatitude != 0 .AND. nLongitude != 0 | ||
cXml += XmlTag( "latitude", NumberXml( nLatitude, 16, 6 ) ) | ||
cXml += XmlTag( "longitude", NumberXml( nLongitude, 16, 6 ) ) | ||
ENDIF | ||
|
||
cXml += XmlTag( "hashTentativaEntrega", cHash ) | ||
cXml += XmlTag( "dhHashTentativaEntrega", DateTimeXml( Date(), Time(), ::cUF ) ) | ||
|
||
FOR EACH cChaveNfe IN aChaveNfeList | ||
cXml += "<infEntrega>" | ||
cXml += XmlTag( "chNFe", cChaveNfe ) | ||
cXml += "</infEntrega>" | ||
NEXT | ||
|
||
cXml += [</evIECTe>] | ||
cXml += [</detEvento>] | ||
|
||
::CTeEvento( cChave, nSequencia, "110190", cXml, cCertificado, cAmbiente ) | ||
|
||
RETURN ::cXmlRetorno | ||
|