From 849fcecd90b47236913bd192b239e0a774c053b8 Mon Sep 17 00:00:00 2001 From: Danimar Ribeiro Date: Thu, 5 Oct 2023 14:11:33 -0300 Subject: [PATCH] Formatando com separador de milhar os numeros --- pytrustnfe/nfe/danfe.py | 4 +++- setup.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pytrustnfe/nfe/danfe.py b/pytrustnfe/nfe/danfe.py index 62b47b92..3d5d251b 100644 --- a/pytrustnfe/nfe/danfe.py +++ b/pytrustnfe/nfe/danfe.py @@ -7,6 +7,7 @@ from io import BytesIO from textwrap import wrap import math +from decimal import Decimal from reportlab.lib import utils from reportlab.pdfgen import canvas @@ -84,7 +85,8 @@ def getdateByTimezone(cDateUTC, timezone=None): def format_number(cNumber): if cNumber: - return cNumber.replace(",", "X").replace("X", ".").replace(".", ",") + cNumber = "{0:,}".format(Decimal(cNumber)) + return cNumber.replace(",", "X").replace(".", ",").replace("X", ".") return "" diff --git a/setup.py b/setup.py index a6308521..911c7281 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages -VERSION = "2.0.0" +VERSION = "2.0.1" setup(