From f6c8943d4e489cef91a1c2d726ccba0085d901f4 Mon Sep 17 00:00:00 2001 From: "ewerton.almeida" Date: Wed, 13 Aug 2025 23:10:11 -0300 Subject: [PATCH] Seis casas decimais para estes campos: "ICMS (%)", "ICMS (%) (UF/Ref)", "Dif. ICMS (pp)", "PIS (%)", "COFINS (%)", "Consumo (kWh)" --- app/main.py | 6 +++--- requirements.txt | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index 114e93d..2cf87c1 100644 --- a/app/main.py +++ b/app/main.py @@ -507,12 +507,12 @@ async def export_excel( with pd.ExcelWriter(output, engine="xlsxwriter") as writer: df.to_excel(writer, index=False, sheet_name="Relatório") - # aplica formatação 4 casas decimais + # aplica formatação 6 casas decimais wb = writer.book ws = writer.sheets["Relatório"] - fmt_4dec = wb.add_format({"num_format": "0.0000"}) + fmt_4dec = wb.add_format({"num_format": "0.000000"}) - for col in ["ICMS (%)", "ICMS (%) (UF/Ref)", "Dif. ICMS (pp)", "PIS (%)", "COFINS (%)"]: + for col in ["ICMS (%)", "ICMS (%) (UF/Ref)", "Dif. ICMS (pp)", "PIS (%)", "COFINS (%)", "Consumo (kWh)"]: if col in df.columns: i = df.columns.get_loc(col) # largura automática básica + formato; ajuste a largura se quiser (ex.: 12) diff --git a/requirements.txt b/requirements.txt index 12a2159..afacc1a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,5 @@ python-multipart==0.0.6 openpyxl==3.1.2 pandas==2.2.2 PyMuPDF==1.22.5 -httpx==0.27.0 \ No newline at end of file +httpx==0.27.0 +xlsxwriter==3.2.0 \ No newline at end of file