diff --git a/composer.json b/composer.json index 7125261..33e2fc3 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "laminas/laminas-servicemanager": "~3.0", "laminas/laminas-barcode": "^2.3", "smarty/smarty": "~3.1", - "nfephp-org/sped-nfe": "~5.0", + "nfephp-org/sped-nfe": "~5.0", "ext-gd": "*", "ext-dom": "*" }, diff --git a/lib/Sped/Gnre/Helper/GnreHelper.php b/lib/Sped/Gnre/Helper/GnreHelper.php index 920301f..c611dd0 100644 --- a/lib/Sped/Gnre/Helper/GnreHelper.php +++ b/lib/Sped/Gnre/Helper/GnreHelper.php @@ -55,12 +55,15 @@ public static function getGuiaGnre($xmlNf): Guia $xml = self::parseNf($xmlNf); $guia = new Guia(); $guia->c04_docOrigem = $xml->NrNf; - $guia->c28_tipoDocOrigem = $xml->TipoDoc; + //$guia->c28_tipoDocOrigem = $xml->TipoDoc; + $guia->c28_tipoDocOrigem = 10; $guia->c21_cepEmitente = $xml->CEPEmpresa; $guia->c16_razaoSocialEmitente = $xml->NmEmpresa; $guia->c03_idContribuinteEmitente = $xml->NrDocumentoEmpresa; $guia->c18_enderecoEmitente = $xml->EnderecoEmpresa; - $guia->c19_municipioEmitente = $xml->MunicipioEmpresa; + + $guia->c19_municipioEmitente = 15004; //$xml->CdMunicipioEmpresa; + $guia->c20_ufEnderecoEmitente = $xml->UfEmpresa; $guia->c17_inscricaoEstadualEmitente = $xml->NrIEEmpresa; $guia->c22_telefoneEmitente = $xml->TelefoneEmpresa; @@ -68,17 +71,20 @@ public static function getGuiaGnre($xmlNf): Guia $guia->c35_idContribuinteDestinatario = $xml->NrDocumentoCliente; $guia->c36_inscricaoEstadualDestinatario = $xml->NrIECliente; $guia->c37_razaoSocialDestinatario = $xml->NmCliente; - $guia->c38_municipioDestinatario = $xml->MunicipioCliente; + $guia->c38_municipioDestinatario = '06200'; //$xml->CdMunicipioCliente; return $guia; } - public static function parseNf($xmlNf): stdClass + public static function parseNf($xmlNf): ?stdClass { $xml = simplexml_load_string($xmlNf); $parsed = new stdClass(); + if (!$xml->NFe) + return null; + $parsed->CEPEmpresa = $xml->NFe->infNFe->emit->enderEmit->CEP; $parsed->EnderecoEmpresa = $xml->NFe->infNFe->emit->enderEmit->xLgr; diff --git a/xsd/v2/dados_gnre_v2.00.xsd b/xsd/v2/dados_gnre_v2.00.xsd index 31e063e..5a8561d 100644 --- a/xsd/v2/dados_gnre_v2.00.xsd +++ b/xsd/v2/dados_gnre_v2.00.xsd @@ -18,8 +18,8 @@ - 0 - GNRE Simples -1 - GNRE Multiplos Doc. de Origem + 0 - GNRE Simples +1 - GNRE Multiplos Doc. de Origem 2 - GNRE Multiplas Receitas