diff --git a/lib/Sped/Gnre/Helper/GnreHelper.php b/lib/Sped/Gnre/Helper/GnreHelper.php index c7d98f5..6f522b5 100644 --- a/lib/Sped/Gnre/Helper/GnreHelper.php +++ b/lib/Sped/Gnre/Helper/GnreHelper.php @@ -52,23 +52,20 @@ public function __construct($xmlNf) public static function getGuiaGnre($xmlNf): Guia { $xml = self::parseNf($xmlNf); - - $guia = new Guia(); - + $guia = new Guia(); $guia->c04_docOrigem = $xml->NrNf; $guia->c28_tipoDocOrigem = $xml->TipoDoc; $guia->c21_cepEmitente = $xml->CEPEmpresa; $guia->c16_razaoSocialEmitente = $xml->NmEmpresa; $guia->c18_enderecoEmitente = $xml->EnderecoEmpresa; - $guia->c19_municipioEmitente = $xml->CdMunicipioEmpresa; + $guia->c19_municipioEmitente = $xml->MunicipioEmpresa; $guia->c20_ufEnderecoEmitente = $xml->UfEmpresa; $guia->c17_inscricaoEstadualEmitente = $xml->NrIEEmpresa; $guia->c22_telefoneEmitente = $xml->TelefoneEmpresa; $guia->c01_UfFavorecida = $xml->IdUfCliente; $guia->c36_inscricaoEstadualDestinatario = $xml->NrIECliente; $guia->c37_razaoSocialDestinatario = $xml->NmCliente; - $guia->c38_municipioDestinatario = $xml->CdMunicipioCliente; - + $guia->c38_municipioDestinatario = $xml->MunicipioCliente; return $guia; } @@ -83,16 +80,19 @@ public static function parseNf($xmlNf): stdClass $parsed->CEPEmpresa = $xml->NFe->infNFe->emit->enderEmit->CEP; $parsed->EnderecoEmpresa = $xml->NFe->infNFe->emit->enderEmit->xLgr; $parsed->CdMunicipioEmpresa = $xml->NFe->infNFe->emit->enderEmit->cMun; + $parsed->MunicipioEmpresa = $xml->NFe->infNFe->emit->enderEmit->xMun; $parsed->UfEmpresa = $xml->NFe->infNFe->emit->enderEmit->UF; $parsed->TelefoneEmpresa = $xml->NFe->infNFe->emit->enderEmit->fone; $parsed->NrIEEmpresa = $xml->NFe->infNFe->emit->IE; $parsed->NmEmpresa = $xml->NFe->infNFe->emit->xNome; $parsed->NrDocumentoCliente = $xml->NFe->infNFe->dest->CNPJ ?: $xml->NFe->infNFe->dest->CPF; + $parsed->NrIECliente = $xml->NFe->infNFe->dest->IE; $parsed->NmCliente = $xml->NFe->infNFe->dest->xNome; $parsed->NmCidade = $xml->NFe->infNFe->dest->enderDest->xMun; $parsed->IdUfCliente = $xml->NFe->infNFe->dest->enderDest->UF; $parsed->CdMunicipioCliente = $xml->NFe->infNFe->dest->enderDest->cMun; + $parsed->MunicipioCliente = $xml->NFe->infNFe->dest->enderDest->xMun; $parsed->ISUFCliente = $xml->NFe->infNFe->dest->ISUF; $parsed->TipoDoc = $xml->NFe->infNFe->ide->tpDoc; $parsed->NrChaveNFe = $xml->protNFe->infProt->chNFe;