diff --git a/src/app/DRE/analitico.tsx b/src/app/DRE/analitico.tsx index b3e8f0f..fa3acd0 100644 --- a/src/app/DRE/analitico.tsx +++ b/src/app/DRE/analitico.tsx @@ -251,22 +251,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { width: 130, sortable: true, resizable: true, - valueFormatter: (params: any) => { + renderCell: (params: any) => { const value = params.value; if (value === null || value === undefined || value === "" || value === 0) return "-"; const numValue = typeof value === "string" ? parseFloat(value) : Number(value); if (isNaN(numValue)) return "-"; - return new Intl.NumberFormat("pt-BR", { + const formatted = new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL", }).format(numValue); - }, - cellClassName: (params: any) => { - const value = params.value; - if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500"; - const numValue = typeof value === "string" ? parseFloat(value) : Number(value); - if (isNaN(numValue)) return "text-gray-500"; - return numValue < 0 ? "text-red-600" : "text-gray-900"; + return ( + + {formatted} + + ); }, }, { @@ -276,22 +274,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { width: 140, sortable: true, resizable: true, - valueFormatter: (params: any) => { + renderCell: (params: any) => { const value = params.value; if (value === null || value === undefined || value === "" || value === 0) return "-"; const numValue = typeof value === "string" ? parseFloat(value) : Number(value); if (isNaN(numValue)) return "-"; - return new Intl.NumberFormat("pt-BR", { + const formatted = new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL", }).format(numValue); - }, - cellClassName: (params: any) => { - const value = params.value; - if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500"; - const numValue = typeof value === "string" ? parseFloat(value) : Number(value); - if (isNaN(numValue)) return "text-gray-500"; - return numValue < 0 ? "text-red-600" : "text-gray-900"; + return ( + + {formatted} + + ); }, }, { @@ -301,22 +297,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { width: 130, sortable: true, resizable: true, - valueFormatter: (params: any) => { + renderCell: (params: any) => { const value = params.value; if (value === null || value === undefined || value === "" || value === 0) return "-"; const numValue = typeof value === "string" ? parseFloat(value) : Number(value); if (isNaN(numValue)) return "-"; - return new Intl.NumberFormat("pt-BR", { + const formatted = new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL", }).format(numValue); - }, - cellClassName: (params: any) => { - const value = params.value; - if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500"; - const numValue = typeof value === "string" ? parseFloat(value) : Number(value); - if (isNaN(numValue)) return "text-gray-500"; - return numValue < 0 ? "text-red-600" : "text-gray-900"; + return ( + + {formatted} + + ); }, }, { @@ -341,7 +335,7 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { width: 80, sortable: true, resizable: true, - valueFormatter: (params: any) => params.value || "-", + renderCell: (params: any) => params.value || "-", }, ] as any, []);