Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions public/js/pdf-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ function drawItemsTable(
// Sum row: last column shows "SUM: {formattedTotal}", rest are empty
const sumRowIndex = body.length;
const sumRow: string[] = columns.map((_col, idx) => {
if (idx === columns.length - 1) {
if (idx === 0) {
return `${t.invoiceItemsTable.sum}: ${formatNumber(data.total)}`;
}
return '';
Expand Down Expand Up @@ -480,9 +480,14 @@ function drawItemsTable(

// Style the sum row (always last)
if (rowIdx === sumRowIndex) {
hookData.cell.styles.fontStyle = 'bold';
hookData.cell.styles.fillColor = TABLE_HEADER_BG;
hookData.cell.styles.halign = 'right';
if (hookData.column.index === 0) {
hookData.cell.colSpan = columns.length;
hookData.cell.styles.fontStyle = 'bold';
hookData.cell.styles.fillColor = TABLE_HEADER_BG;
hookData.cell.styles.halign = 'right';
} else {
hookData.cell.text = [];
}
}

// Style note sub-rows: merge across all columns, italic, lighter bg
Expand Down
Loading