Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pysped/nfe/danfe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@
# <http://www.gnu.org/licenses/>
#

from pysped.nfe.danfe.danfe import DANFE
#from pysped.nfe.danfe.daede import DAEDE
import sys


if sys.version_info.major == 2:
from pysped.nfe.danfe.danfe_geraldo import DANFE
else:
from pysped.nfe.danfe.danfe import DANFE

from pysped.nfe.danfe.daede import DAEDE
from pysped.nfe.danfe.danfce import DANFCE
from pysped.nfe.danfe.danfse import DANFSE
2 changes: 1 addition & 1 deletion pysped/nfe/leiaute/nfe_110.py
Original file line number Diff line number Diff line change
Expand Up @@ -4007,7 +4007,7 @@ def _calcula_dv(self, valor):
def gera_nova_chave(self):
chave = str(self.infNFe.ide.cUF.valor).zfill(2)

if str(self.infNFe.versao.valor) == '3.10':
if str(self.infNFe.versao.valor) in ('3.10', '4.00'):
chave += str(self.infNFe.ide.dhEmi.valor.strftime('%y%m')).zfill(4)

else:
Expand Down
8 changes: 4 additions & 4 deletions pysped/nfe/leiaute/nfe_310.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ def get_xml(self):
xml += self.vICMSST.xml
else:
xml += self.modBC.xml
xml += self.vBC.xml
xml += self.pRedBC.xml
xml += self.vBC.xml
xml += self.pICMS.xml
xml += self.vICMS.xml
xml += self.modBCST.xml
Expand Down Expand Up @@ -646,8 +646,8 @@ def get_xml(self):

elif self.CST.valor == '70':
xml += self.modBC.xml
xml += self.vBC.xml
xml += self.pRedBC.xml
xml += self.vBC.xml
xml += self.pICMS.xml
xml += self.vICMS.xml
xml += self.modBCST.xml
Expand All @@ -665,8 +665,8 @@ def get_xml(self):

elif self.CST.valor == '90':
xml += self.modBC.xml
xml += self.vBC.xml
xml += self.pRedBC.xml
xml += self.vBC.xml
xml += self.pICMS.xml
xml += self.vICMS.xml
xml += self.modBCST.xml
Expand Down Expand Up @@ -729,8 +729,8 @@ def get_xml(self):

elif self.CSOSN.valor == '900':
xml += self.modBC.xml
xml += self.vBC.xml
xml += self.pRedBC.xml
xml += self.vBC.xml
xml += self.pICMS.xml
xml += self.vICMS.xml
xml += self.modBCST.xml
Expand Down
39 changes: 21 additions & 18 deletions pysped/nfe/leiaute/nfe_400.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,10 @@ def get_xml(self):
xml += self.pICMSST.xml
xml += self.vICMSST.xml

xml += self.vBCFCPST.xml
xml += self.pFCPST.xml
xml += self.vFCPST.xml
if self.vFCP.valor:
xml += self.vBCFCPST.xml
xml += self.pFCPST.xml
xml += self.vFCPST.xml

else:
xml += self.modBC.xml
Expand Down Expand Up @@ -337,8 +338,8 @@ def get_xml(self):

elif self.CST.valor == '70':
xml += self.modBC.xml
xml += self.vBC.xml
xml += self.pRedBC.xml
xml += self.vBC.xml
xml += self.pICMS.xml
xml += self.vICMS.xml
xml += self.modBCST.xml
Expand All @@ -352,17 +353,18 @@ def get_xml(self):
xml += self.pICMSST.xml
xml += self.vICMSST.xml

xml += self.vBCFCPST.xml
xml += self.pFCPST.xml
xml += self.vFCPST.xml
if self.vFCP.valor:
xml += self.vBCFCPST.xml
xml += self.pFCPST.xml
xml += self.vFCPST.xml

xml += self.vICMSDeson.xml
xml += self.motDesICMS.xml

elif self.CST.valor == '90':
xml += self.modBC.xml
xml += self.vBC.xml
xml += self.pRedBC.xml
xml += self.vBC.xml
xml += self.pICMS.xml
xml += self.vICMS.xml

Expand Down Expand Up @@ -934,7 +936,7 @@ class Pag(XMLNFe):
def __init__(self):
super(Pag, self).__init__()
self.detPag = []
self.vTroco = TagDecimal(nome='vTroco' , codigo='', tamanho=[1, 13, 1], decimais=[0, 2, 2], raiz='//pag')
self.vTroco = TagDecimal(nome='vTroco' , codigo='YA09', tamanho=[1, 13, 1], decimais=[0, 2, 2], raiz='//pag')

def get_xml(self):
#
Expand All @@ -946,7 +948,8 @@ def get_xml(self):
for d in self.detPag:
xml += d.xml

xml += self.vTroco.xml
if self.vTroco.valor:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mesmo enviando a tag vTroco em branco ( '' ) o PySPED parece preencher o campo com 0.00 150.000.00</
vTroco> e ao enviar a TAG dessa forma a SEFAZ retorna erro 869 - Mensagem Rejeição: Valor do troco incorreto - Status Recebido Retorno

xml += self.vTroco.xml
xml += '</pag>'
return xml

Expand Down Expand Up @@ -1042,17 +1045,17 @@ def get_xml(self):
xml += self.vBC.xml
xml += self.vICMS.xml
xml += self.vICMSDeson.xml
if self.vFCPUFDest.valor:
xml += self.vFCPUFDest.xml
if self.vICMSUFDest.valor:
xml += self.vICMSUFDest.xml
if self.vICMSUFRemet.valor:
xml += self.vICMSUFRemet.xml
xml += self.vFCP.xml
xml += self.vBCST.xml
xml += self.vST.xml
xml += self.vFCPST.xml
xml += self.vFCPSTRet.xml
if self.vICMSUFDest.valor:
xml += self.vICMSUFDest.xml
if self.vICMSUFRemet.valor:
xml += self.vICMSUFRemet.xml
if self.vFCPUFDest.valor:
xml += self.vFCPUFDest.xml
xml += self.vProd.xml
xml += self.vFrete.xml
xml += self.vSeg.xml
Expand All @@ -1074,9 +1077,9 @@ def set_xml(self, arquivo):
self.vICMS.xml = arquivo
self.vICMSDeson.xml = arquivo
self.vFCPUFDest.xml = arquivo
self.vFCP.xml = arquivo
self.vICMSUFDest.xml = arquivo
self.vICMSUFRemet.xml = arquivo
self.vFCP.xml = arquivo
self.vBCST.xml = arquivo
self.vST.xml = arquivo
self.vFCPST.xml = arquivo
Expand Down Expand Up @@ -1348,7 +1351,7 @@ def set_xml(self, arquivo):
self.transp.xml = arquivo
self.cobr.xml = arquivo

self.pag = self.le_grupo('//NFe/infNFe/pag', Pag)
self.pag.xml = arquivo
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Por algum motivo que não consegui identificar, da forma que era feito antes o programa parecia chamar duas vezes a função e na segunda não encontrava a TAG retornando erro


self.infAdic.xml = arquivo
self.exporta.xml = arquivo
Expand Down
2 changes: 1 addition & 1 deletion pysped/nfe/processador_nfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def enviar_lote(self, numero_lote=None, lista_nfes=[]):
arq.write(n.xml)
arq.close

arq = open(self.caminho + str(envio.idLote.valor).strip().rjust(15, '0') + '-env-lot.xml', 'w')
arq = open(self.caminho + str(envio.idLote.valor).strip().rjust(15, '0') + '-env-lot.xml', 'w', encoding='utf-8')
arq.write(envio.xml)
arq.close()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name = "PySPED",
version = "1.1.0",
version = "1.2.0",
author = "Aristides Caldeira",
author_email = 'aristides.caldeira@tauga.com.br',
test_suite='tests',
Expand Down