Skip to content

Commit

Permalink
thousandseparator added to monetary fields
Browse files Browse the repository at this point in the history
  • Loading branch information
carcaroff authored and danimaribeiro committed Sep 25, 2018
1 parent 21994c7 commit 7f5fe48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pytrustnfe/nfe/danfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def getdateByTimezone(cDateUTC, timezone=None):

def format_number(cNumber):
if cNumber:
# Vírgula para a separação de milhar e 2f para 2 casas decimais
value = "{:,.2f}".format(float(cNumber))
return cNumber.replace(",", "X").replace(".", ",").replace("X", ".")
return ""

Expand Down Expand Up @@ -746,8 +748,8 @@ def produtos(self, oXML=None, el_det=None, index=0, max_index=0,
tagtext(oNode=el_prod, cTag='qCom')))
self.stringRight(nMr - 64.5, nLin, format_number(
tagtext(oNode=el_prod, cTag='vUnCom')))
self.stringRight(nMr - 50.5, nLin,
tagtext(oNode=el_prod, cTag='vProd'))
self.stringRight(nMr - 50.5, nLin, format_number(
tagtext(oNode=el_prod, cTag='vProd')))
self.stringRight(nMr - 38.5, nLin, format_number(vBC))
self.stringRight(nMr - 26.5, nLin, format_number(vICMS))
self.stringRight(nMr - 7.5, nLin, format_number(pICMS))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages


VERSION = "1.0.8"
VERSION = "1.0.9"


setup(
Expand Down

0 comments on commit 7f5fe48

Please sign in to comment.