chore: add base currency label to PDF totals row

This commit is contained in:
Claus Lohmar 2026-06-17 12:57:41 +00:00
parent 7c84c0858f
commit b50699fc0e

View file

@ -743,13 +743,20 @@ func generatePDF(eventName string, expenses []database.Expense, userName, userDe
pdf.Ln(3)
pdf.SetFont("Helvetica", "B", 9)
if hasConversion {
// Local currency total
// Determine the base/claim currency from the first expense that has one.
baseCur := ""
for _, exp := range expenses {
if exp.BaseCurrency != "" {
baseCur = exp.BaseCurrency
break
}
}
pdf.Cell(colWidths[0], 8, "")
pdf.Cell(colWidths[1], 8, "")
pdf.Cell(colWidths[2], 8, "TOTAL")
pdf.Cell(colWidths[3], 8, fmt.Sprintf("%.2f", totalOrig))
pdf.Cell(colWidths[4], 8, "")
pdf.Cell(colWidths[5], 8, fmt.Sprintf("%.2f", totalConv))
pdf.Cell(colWidths[5], 8, fmt.Sprintf("%.2f %s", totalConv, baseCur))
pdf.Cell(colWidths[6], 8, "")
pdf.Cell(colWidths[7], 8, "")
} else {