From a18838fb2a0ec65be3cbf9309231253a79da1f5a Mon Sep 17 00:00:00 2001 From: yoganandhan Date: Wed, 6 May 2026 17:38:40 +0530 Subject: [PATCH] changes in food report penalty amount pdf --- .../fooddistributiondetailedreport.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/resources/templates/modules/fooddistribution/fooddistributiondetailedreport.html b/src/main/resources/templates/modules/fooddistribution/fooddistributiondetailedreport.html index 5e31070..f4d95a1 100644 --- a/src/main/resources/templates/modules/fooddistribution/fooddistributiondetailedreport.html +++ b/src/main/resources/templates/modules/fooddistribution/fooddistributiondetailedreport.html @@ -381,6 +381,8 @@ doc.content[1].table.dontBreakRows = true; var rowCount = doc.content[1].table.body.length; + var totalPenalty = 0; + for (var i = 1; i < rowCount; i++) { var evidenceCell = doc.content[1].table.body[i][4]; var urlText = typeof evidenceCell === 'object' ? evidenceCell.text : evidenceCell; @@ -394,7 +396,22 @@ decoration: 'underline' }; } + + var penaltyCell = doc.content[1].table.body[i][5]; + var penaltyText = typeof penaltyCell === 'object' ? penaltyCell.text : penaltyCell; + if (penaltyText && penaltyText !== '-' && penaltyText !== 'Pending') { + var amount = parseInt(penaltyText.replace(/[^0-9]/g, '')); + if (!isNaN(amount)) { + totalPenalty += amount; + } + } } + + doc.content[1].table.body.push([ + { text: 'Total Penalty Amount', colSpan: 5, alignment: 'right', bold: true }, + {}, {}, {}, {}, + { text: 'Rs. ' + totalPenalty, bold: true } + ]); } }, {