From 5a9fb44bdbd3a612dfe07d17d76d305078709ea4 Mon Sep 17 00:00:00 2001 From: "ewerton.almeida" Date: Wed, 13 Aug 2025 22:37:09 -0300 Subject: [PATCH] =?UTF-8?q?Inclus=C3=A3o=20da=20coluna=20Arquivo=20PDF=20n?= =?UTF-8?q?as=20exporta=C3=A7=C3=B5es=20em=20excel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/main.py b/app/main.py index d0daa2e..114e93d 100644 --- a/app/main.py +++ b/app/main.py @@ -412,6 +412,7 @@ async def export_excel( "Valor Total": f.valor_total, "Distribuidora": f.distribuidora, "Data Processamento": f.data_processamento, + "Arquivo PDF": f.arquivo_pdf, }) filename = "relatorio_aliquota_icms.xlsx" @@ -447,6 +448,7 @@ async def export_excel( "Consumo (kWh)": f.consumo, "Tarifa": f.tarifa, "Nota Fiscal": f.nota_fiscal, + "Arquivo PDF": f.arquivo_pdf, }) filename = "relatorio_exclusao_icms.xlsx" @@ -484,6 +486,7 @@ async def export_excel( "Tarifa": f.tarifa, "Distribuidora": f.distribuidora, "Data Processamento": f.data_processamento, + "Arquivo PDF": f.arquivo_pdf, }) filename = "relatorio_geral.xlsx" @@ -491,6 +494,11 @@ async def export_excel( output = BytesIO() df = pd.DataFrame(dados) + # força "Arquivo PDF" a ser a última coluna + if "Arquivo PDF" in df.columns: + cols = [c for c in df.columns if c != "Arquivo PDF"] + ["Arquivo PDF"] + df = df[cols] + # garante que colunas percentuais estejam numéricas (se existirem) for col in ["ICMS (%)", "ICMS (%) (UF/Ref)", "Dif. ICMS (pp)", "PIS (%)", "COFINS (%)"]: if col in df.columns: