diff --git a/src/components/MatrixView.tsx b/src/components/MatrixView.tsx index 3aa0215..86e5ed3 100644 --- a/src/components/MatrixView.tsx +++ b/src/components/MatrixView.tsx @@ -21,10 +21,18 @@ export function MatrixView({ data, headers }: MatrixViewProps) { // Convert header to lowercase for checks const h = header.toLowerCase(); + // Always format weight/NW/GW/kg columns to 2 decimals — checked before any exclusion logic + if (h.includes('nw') || h.includes('gw') || h.includes('weight') || h.includes('kg')) { + if (typeof val === 'number') return val.toFixed(2); + if (typeof val === 'string') { + const num = parseFloat(val.trim().replace(',', '.')); + if (!isNaN(num)) return num.toFixed(2); + } + return val; + } + // Do NOT format columns that are clearly IDs, barcodes, or codes - // But allow if it's a weight/measure column (e.g. Article NW (kg)) - if ((h.includes('id') || h.includes('no') || h.includes('code') || h.includes('art.') || h.includes('barcode') || h.includes('article')) && - !(h.includes('nw') || h.includes('gw') || h.includes('weight') || h.includes('kg'))) { + if (h.includes('id') || h.includes('no') || h.includes('code') || h.includes('art.') || h.includes('barcode') || h.includes('article')) { return val; }