chore: add base currency label to PDF totals row
This commit is contained in:
parent
7c84c0858f
commit
b50699fc0e
1 changed files with 9 additions and 2 deletions
|
|
@ -743,13 +743,20 @@ func generatePDF(eventName string, expenses []database.Expense, userName, userDe
|
||||||
pdf.Ln(3)
|
pdf.Ln(3)
|
||||||
pdf.SetFont("Helvetica", "B", 9)
|
pdf.SetFont("Helvetica", "B", 9)
|
||||||
if hasConversion {
|
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[0], 8, "")
|
||||||
pdf.Cell(colWidths[1], 8, "")
|
pdf.Cell(colWidths[1], 8, "")
|
||||||
pdf.Cell(colWidths[2], 8, "TOTAL")
|
pdf.Cell(colWidths[2], 8, "TOTAL")
|
||||||
pdf.Cell(colWidths[3], 8, fmt.Sprintf("%.2f", totalOrig))
|
pdf.Cell(colWidths[3], 8, fmt.Sprintf("%.2f", totalOrig))
|
||||||
pdf.Cell(colWidths[4], 8, "")
|
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[6], 8, "")
|
||||||
pdf.Cell(colWidths[7], 8, "")
|
pdf.Cell(colWidths[7], 8, "")
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue