diff --git a/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java b/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java index 28be65b9..ec7b53da 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java @@ -264,8 +264,10 @@ public class PdfDao { Map formulaEnabledMap = new HashMap<>(); Map formulaTypeMap = new HashMap<>(); Map fieldTypeMap = new HashMap<>(); + Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray - contentResponseBean.getSettings().stream() + + contentResponseBean.getSettings().stream() .filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns" .map(SettingResponseBean::getValue) .filter(Objects::nonNull) // Ensure value is not null @@ -375,9 +377,17 @@ public class PdfDao { if (columnSums.containsKey(key)) { double total = columnSums.getOrDefault(key, 0.0); // Get the total for the column - PdfPCell sumCell = PdfUtils.htmlToPdfPCell(Utils.convertToItalianFormat(String.valueOf(total)), textFont); +// PdfPCell sumCell = PdfUtils.htmlToPdfPCell(Utils.convertToItalianFormat(String.valueOf(total)), textFont); + // Convert total to Italian format, defaulting to "0" if null + String formattedTotal = Utils.convertToItalianFormat(String.valueOf(total)); + + // Create a table cell with the formatted value + PdfPCell sumCell = new PdfPCell(new Phrase(formattedTotal,lightGrayFont)); + + sumCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for totals sumCell.setHorizontalAlignment(Element.ALIGN_CENTER); + sumCell.setPaddingTop(8f); sumCell.setMinimumHeight(30f); table.addCell(sumCell); // Add total for the column } else {