From d46ccae6027aed49d2dad0f2465ab717bacf30a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=20Gon=C3=A7aalves?= Date: Fri, 21 Nov 2025 17:56:37 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20corre=C3=A7=C3=A3o=20tabela=20analitica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/dre-entidade/analitico.tsx | 381 +++++++++++------------------ 1 file changed, 141 insertions(+), 240 deletions(-) diff --git a/src/app/dre-entidade/analitico.tsx b/src/app/dre-entidade/analitico.tsx index bf9e28c..93d3dc0 100644 --- a/src/app/dre-entidade/analitico.tsx +++ b/src/app/dre-entidade/analitico.tsx @@ -523,89 +523,31 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { }; const baseColumns = [ - { - field: "data_lancamento", - headerName: "Dt Lanc", - width: 120, - sortable: true, - resizable: true, - renderCell: dateCellRenderer, - }, - { - field: "data_compensacao", - headerName: "Dt Comp", - width: 120, - sortable: true, - resizable: true, - renderCell: dateCellRenderer, - }, - { - field: "data_vencimento", - headerName: "Dt Venc", - width: 120, - sortable: true, - resizable: true, - renderCell: dateCellRenderer, - }, - { - field: "data_caixa", - headerName: "Dt Caixa", - width: 120, - sortable: true, - resizable: true, - renderCell: dateCellRenderer, - }, - { - field: "data_pagto", - headerName: "Dt Pagto", - width: 120, - sortable: true, - resizable: true, - renderCell: dateCellRenderer, - }, - { - field: "entidade", - headerName: "Entidade", - width: 100, - sortable: true, - resizable: true, - renderCell: (params: any) => params.value || "-", - }, - { - field: "tipo_parceiro", - headerName: "Tipo Parc", - width: 120, - sortable: true, - resizable: true, - renderCell: (params: any) => params.value || "-", - }, { field: "codigo_fornecedor", - headerName: "Cod.Fornec", - width: 120, + headerName: "Cod. Fornec", + width: 100, sortable: true, resizable: true, }, { field: "nome_fornecedor", headerName: "Fornecedor", - flex: 1, - minWidth: 200, + width: 200, sortable: true, resizable: true, }, { field: "codigo_centrocusto", headerName: "Cod.CC", - width: 100, + width: 90, sortable: true, resizable: true, }, { field: "centro_custo", headerName: "Centro Custo", - flex: 1, - minWidth: 200, + width: 180, sortable: true, resizable: true, renderCell: (params: any) => params.value || "-", @@ -613,78 +555,131 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { { field: "codigo_conta", headerName: "Cod.Conta", - width: 120, + width: 100, sortable: true, resizable: true, }, { field: "conta", headerName: "Conta", - flex: 1, - minWidth: 180, + width: 200, sortable: true, resizable: true, }, - { - field: "valor", - headerName: "Vl.Realizado", - type: "number" as const, - width: 140, - sortable: true, - resizable: true, + { + field: "valor", + headerName: "VI.Realizado", + type: "number" as const, + width: 120, + sortable: true, + resizable: true, renderCell: (params: any) => currencyCellRenderer(params, true), }, - { - field: "valor_previsto", - headerName: "Vl.Previsto", - type: "number" as const, - width: 130, - sortable: true, - resizable: true, + { + field: "valor_previsto", + headerName: "VI.Pr", + type: "number" as const, + width: 85, + sortable: true, + resizable: true, renderCell: (params: any) => currencyCellRenderer(params, false), }, - { - field: "valor_confirmado", - headerName: "Vl.Confirmado", - type: "number" as const, - width: 140, - sortable: true, - resizable: true, - renderCell: (params: any) => currencyCellRenderer(params, false), - }, - { - field: "valor_pago", - headerName: "Vl.Pago", - type: "number" as const, - width: 120, - sortable: true, - resizable: true, + { + field: "valor_confirmado", + headerName: "VI.Confirmado", + type: "number" as const, + width: 125, + sortable: true, + resizable: true, renderCell: (params: any) => currencyCellRenderer(params, false), }, { field: "historico", - headerName: "Historico", - flex: 1, - minWidth: 250, - sortable: true, - resizable: true, - }, - { - field: "historico2", - headerName: "Historico 2", - flex: 1, - minWidth: 300, + headerName: "Histórico", + width: 250, sortable: true, resizable: true, }, { field: "numero_lancamento", - headerName: "Num.Lanc", + headerName: "ID", width: 100, sortable: true, resizable: true, renderCell: (params: any) => params.value || "-", }, + { + field: "data_lancamento", + headerName: "Dt Lanc", + width: 95, + sortable: true, + resizable: true, + renderCell: dateCellRenderer, + }, + { + field: "data_compensacao", + headerName: "Dt Comp", + width: 95, + sortable: true, + resizable: true, + renderCell: dateCellRenderer, + }, + { + field: "data_vencimento", + headerName: "Dt Venc", + width: 95, + sortable: true, + resizable: true, + renderCell: dateCellRenderer, + }, + { + field: "data_caixa", + headerName: "Dt Caixa", + width: 95, + sortable: true, + resizable: true, + renderCell: dateCellRenderer, + }, + { + field: "data_pagto", + headerName: "Dt Pagto", + width: 95, + sortable: true, + resizable: true, + renderCell: dateCellRenderer, + }, + { + field: "entidade", + headerName: "Entidade", + width: 90, + sortable: true, + resizable: true, + renderCell: (params: any) => params.value || "-", + }, + { + field: "tipo_parceiro", + headerName: "Tipo Parc", + width: 95, + sortable: true, + resizable: true, + renderCell: (params: any) => params.value || "-", + }, + { + field: "valor_pago", + headerName: "VI.Pago", + type: "number" as const, + width: 100, + sortable: true, + resizable: true, + renderCell: (params: any) => currencyCellRenderer(params, false), + }, + { + field: "historico2", + headerName: "Histórico 2", + width: 250, + sortable: true, + resizable: true, + }, ]; // Adicionar renderHeader com filtro Excel para todas as colunas @@ -911,23 +906,23 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { {/* DataGridPro */} -
-
-

- Total de Registros: {sortedAndFilteredData.length} -

-
- Valor Total: - {new Intl.NumberFormat("pt-BR", { - style: "currency", - currency: "BRL", - }).format(valorTotal)} - +
+
+ Total de Registros:{" "} + {sortedAndFilteredData.length} +
+
+ Valor Total:{" "} + + {new Intl.NumberFormat("pt-BR", { + style: "currency", + currency: "BRL", + }).format(valorTotal)} +
-
-
+
row.id || `row-${row.recnum || Math.random()}`} sx={{ - overflowAnchor: 'none', - height: "100%", - display: "flex", - flexDirection: "column", - "& .MuiDataGrid-root": { - display: "flex", - flexDirection: "column", - height: "100%", - flex: 1, - overflow: "hidden", - }, - "& .MuiDataGrid-main": { - overflow: "hidden !important", - position: "relative", - height: "100%", - display: "flex", - flexDirection: "column", - flex: 1, - }, - // Container dos headers - DEVE FICAR FIXO (não rola) - "& .MuiDataGrid-container--top": { - overflow: "hidden !important", - position: "relative", - zIndex: 100, + height: "100%", + width: "100%", + "& .MuiDataGrid-root": { + border: "none", + }, + "& .MuiDataGrid-columnHeaders": { backgroundColor: "#f9fafb", - flexShrink: 0, - flexGrow: 0, - }, - "& .MuiDataGrid-columnHeaders": { - position: "relative !important", - backgroundColor: "#f9fafb !important", - zIndex: 100, borderBottom: "1px solid #e5e7eb", }, - "& .MuiDataGrid-columnHeader": { - backgroundColor: "#f9fafb !important", - }, - "& .MuiDataGrid-columnHeaderRow": { - backgroundColor: "#f9fafb !important", - }, - "& .MuiDataGrid-columnHeadersInner": { - backgroundColor: "#f9fafb !important", - }, + "& .MuiDataGrid-columnHeader": { + backgroundColor: "#f9fafb !important", + fontWeight: 600, + fontSize: "0.875rem", + }, "& .MuiDataGrid-cell": { borderBottom: "1px solid #f0f0f0", fontSize: "0.875rem", }, - // Container do virtualScroller - deve ter scroll e ocupar espaço restante - "& .MuiDataGrid-container--bottom": { - flex: 1, - overflow: "hidden !important", - position: "relative", - minHeight: 0, - display: "flex", - flexDirection: "column", + "& .MuiDataGrid-virtualScroller": { + scrollbarWidth: "thin", + "&::-webkit-scrollbar": { + width: "8px", + height: "8px", }, - // Apenas o virtualScroller deve ter scroll - "& .MuiDataGrid-virtualScroller": { - overflowY: "auto !important", - overflowX: "auto !important", - height: "100% !important", - flex: 1, - overflowAnchor: 'none', - // Garantir que a barra de scroll seja visível - scrollbarWidth: "thin", - "&::-webkit-scrollbar": { - height: "8px", - width: "8px", - }, - "&::-webkit-scrollbar-track": { - background: "#f1f1f1", - }, - "&::-webkit-scrollbar-thumb": { - background: "#888", - borderRadius: "4px", - }, - "&::-webkit-scrollbar-thumb:hover": { - background: "#555", - }, + "&::-webkit-scrollbar-track": { + background: "#f1f1f1", }, - "& .MuiDataGrid-virtualScrollerContent": { - minWidth: "max-content", + "&::-webkit-scrollbar-thumb": { + background: "#888", + borderRadius: "4px", + }, + "&::-webkit-scrollbar-thumb:hover": { + background: "#555", }, - "& .MuiDataGrid-row": { - minWidth: "max-content", }, "& .MuiDataGrid-toolbarContainer": { backgroundColor: "#f8fafc", borderBottom: "1px solid #e5e7eb", padding: "8px 16px", }, - "& .MuiDataGrid-scrollbar": { - display: "none", - }, - // Ocultar todos os ícones nativos das colunas "& .MuiDataGrid-columnHeaderMenuContainer": { display: "none !important", }, @@ -1046,48 +986,9 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { "& .MuiDataGrid-columnHeaderSortIcon": { display: "none !important", }, - "& .MuiDataGrid-columnHeaderSortIconContainer": { - display: "none !important", - }, - "& .MuiDataGrid-iconButtonContainer": { - display: "none !important", - }, - "& .MuiDataGrid-columnHeaderSeparator": { - display: "none !important", - }, - "& .MuiDataGrid-columnHeaderSortButton": { - display: "none !important", - }, - // Ocultar qualquer ícone de menu adicional - "& .MuiDataGrid-menuIcon": { - display: "none !important", - }, - "& .MuiDataGrid-menuIconButton": { - display: "none !important", - }, - "& .MuiDataGrid-columnHeaderMenuIcon": { - display: "none !important", - }, - "& .MuiDataGrid-columnHeaderMenuIconButton": { - display: "none !important", - }, - "& .MuiDataGrid-menuContainer": { - display: "none !important", - }, - "& .MuiDataGrid-menu": { - display: "none !important", - }, - // Ocultar footer de paginação "& .MuiDataGrid-footerContainer": { display: "none !important", }, - "& .MuiDataGrid-pagination": { - display: "none !important", - }, - "& .MuiTablePagination-root": { - display: "none !important", - }, - // Garantir que nosso botão customizado apareça "& .MuiDataGrid-columnHeaderTitleContainer": { width: "100%", display: "flex",