nfephp-org / sped-da

Classes para geração dos documentos auxiliares usados pelos padrões Sped
Other
138 stars 239 forks source link

DAMDFe não mostra as NFes referenciadas #428

Open eumanito opened 3 years ago

eumanito commented 3 years ago

Criei um MDFe com notas fiscais referenciadas, o XML ficou certo (abaixo exemplo), porém usando a biblioteca nfephp-org/sped-da, esta não aparece no PDF. Precisa preencher mais alguma coisa no XML?

<?xml version="1.0" encoding="UTF-8"?>
<mdfeProc versao="3.00" xmlns="http://www.portalfiscal.inf.br/mdfe">
<MDFe xmlns="http://www.portalfiscal.inf.br/mdfe">
<infMDFe Id="MDFe43210202029980000180580010000000021147301925" versao="3.00">
<ide>
<cUF>43</cUF>
<tpAmb>2</tpAmb>
<tpEmit>2</tpEmit>
<mod>58</mod>
<serie>1</serie>
<nMDF>2</nMDF>
<cMDF>14730192</cMDF>
<cDV>5</cDV>
<modal>1</modal>
<dhEmi>2021-02-02T11:44:17-03:00</dhEmi>
<tpEmis>1</tpEmis>
<procEmi>0</procEmi>
<verProc>1.00</verProc>
<UFIni>RS</UFIni>
<UFFim>RS</UFFim>
<infMunCarrega>
<cMunCarrega>4313300</cMunCarrega>
<xMunCarrega>Nova Prata</xMunCarrega>
</infMunCarrega>
<dhIniViagem>2021-02-02T11:43:00-03:00</dhIniViagem>
</ide>
<emit>
<CNPJ>02029980000180</CNPJ>
<IE>0850035660</IE>
<xNome>SERPPAR - JOSE OSCAR RIGON EPP</xNome>
<xFant>SERPPAR</xFant>
<enderEmit>
<xLgr>Av Antonio Pandolfo</xLgr>
<nro>45</nro>
<xBairro>Bercario Industrial</xBairro>
<cMun>4313300</cMun>
<xMun>Nova Prata</xMun>
<CEP>95320000</CEP>
<UF>RS</UF>
<fone>5432422161</fone>
</enderEmit>
</emit>
<infModal versaoModal="3.00">
<rodo>
<veicTracao>
<cInt>1</cInt>
<placa>ASD1234</placa>
<tara>1500</tara>
<capKG>20000</capKG>
<condutor>
<xNome>Motorista de Exemplo</xNome>
<CPF>33421925003</CPF>
</condutor>
<tpRod>01</tpRod>
<tpCar>01</tpCar>
<UF>RS</UF>
</veicTracao>
</rodo>
</infModal>
<infDoc>
<infMunDescarga>
<cMunDescarga>4302402</cMunDescarga>
<xMunDescarga>Bom Retiro do Sul</xMunDescarga>
<infNFe>
<chNFe>43120211868493000100550010000038811271861221</chNFe>
</infNFe>
<infNFe>
<chNFe>43120211868493000100550010000038821008939506</chNFe>
</infNFe>
<infNFe>
<chNFe>43120211868493000100550010000038831756190099</chNFe>
</infNFe>
<infNFe>
<chNFe>43120211868493000100550010000038841955323916</chNFe>
</infNFe>
<infNFe>
<chNFe>43120211868493000100550010000038851912610694</chNFe>
</infNFe>
<infNFe>
<chNFe>43120211868493000100550010000038861035924297</chNFe>
</infNFe>
<infNFe>
<chNFe>43120211868493000100550010000038881612452220</chNFe>
</infNFe>
</infMunDescarga>
</infDoc>
<tot>
<qNFe>7</qNFe>
<vCarga>3135.20</vCarga>
<cUnid>01</cUnid>
<qCarga>171.3600</qCarga>
</tot>
<infAdic>
<infCpl>NFe:3881;3882;3883;3884;3885;3886;3888;</infCpl>
</infAdic>
</infMDFe>
<infMDFeSupl>
<qrCodMDFe>
<![CDATA[https://dfe-portal.svrs.rs.gov.br/mdfe/qrCode?chMDFe=43210202029980000180580010000000021147301925&tpAmb=2]]>
</qrCodMDFe>
</infMDFeSupl>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#MDFe43210202029980000180580010000000021147301925">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>Q/Rp/X9yP0ANDEum6OoYT8lKZms=</D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uYnIwDgYDVR0PAQH/BAQDAgXgMB0GA1UdJQQWMBQGCCsGAQUFBwMEBggrBgEFBQcDAjANBgkqhkiG9w0BAQsFAAOCAgEAtEJIDyVn2i6FweFO0K5fxfQXXzMIqY7dU5HsRQ3ifvwBbuuf4pX78u5Px8pUFZp+jCD2NL+xuZ6cog0Mb8Ofvz3nse+8oXY7W+ygWmsmtMjD6OnzX+5dI0VBiCngN7bt3Q2qpfgSGJiwcVUX0C4r0sJCBGmHn1bA4hIjVZqY9eNbBOadltRnCGGdiRie/u+JEcnzIpYBl+0zDwNwRcattVvXrKy0myoHdId9UzTeZFp8as4VqZpszxacrG69wGf+Q+HeP+9eP7AaP2JEU6yNBRsnmkB1fJ4VZitz1VSH6n3+eEilz7pnYRjU5tVrlz6B0yxtwoY0yW7vvlR8+IeyNeMdqprroNCgvtBSFrb56cW8VnXUL8aVBUpkOXBtKlKnFugcdvYFXbXz33b4pBoFC/8JFQLQ14pg3VdhifTcAvXL7W+2qYUmEpZcDjcN1pSrQSS5bF8UzpmwAdyfpP5KtZ/oQx1JN18nL8558oDL9ljzsZAPaBGndDIShixbHkn8lzhz7TOC2LXjHmNay8Bs6STNf8HVTq8cc8FdK2Ca1GgDRnEJyD+9wn+60cw2ptDuggyQXUm8P9wYLDKXYLD/7MsIcB7gYCxUxFd6FlhgZFXNZNRTg1pyztFOk3D/phlZNB9sNNgVMwHlJwLncSFUwtLe+Dawg53+iOq5EDicfQc=</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</MDFe>
<protMDFe versao="3.00">
<infProt Id="MDFe943210000003548">
<tpAmb>2</tpAmb>
<verAplic>RS20200812115905</verAplic>
<chMDFe>43210202029980000180580010000000021147301925</chMDFe>
<dhRecbto>2021-02-02T11:44:22-03:00</dhRecbto>
<nProt>943210000003548</nProt>
<digVal>Q/Rp/X9yP0ANDEum6OoYT8lKZms=</digVal>
<cStat>100</cStat>
<xMotivo>Autorizado o uso do MDF-e</xMotivo>
</infProt>
</protMDFe>
</mdfeProc>
evandromurilo commented 3 years ago

Parece um problema quando existem exatamente 7 chaves no documento.

Primeiro o código define a flagDetContContinuacao se existirem mais de 7 documentos:

https://github.com/nfephp-org/sped-da/blob/e369579935b90889b17784f82090d982ea4995bd/src/CTe/Dacte.php#L2149-L2151

Depois ele renderiza se forem menos do que 7:

https://github.com/nfephp-org/sped-da/blob/e369579935b90889b17784f82090d982ea4995bd/src/CTe/Dacte.php#L2192

O caso onde são exatamente 7 não está coberto, pelo que me parece.

@robmachado Faz sentido pra você?