Skip to content

Commit

Permalink
enhacement #77 - Project and Identifier in PDF (#78)
Browse files Browse the repository at this point in the history
* added project and identifier in PDF in the following form (en): Project: 001 - Project name
* placed project and identifier below the report title 
* print ' -' in PDF only if project has a name
  • Loading branch information
sgempi authored Jul 11, 2024
1 parent 072ed8c commit 25d53bc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
17 changes: 16 additions & 1 deletion backend/pdf/expenseReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,21 @@ function drawGeneralInformation(page: pdf_lib.PDFPage, expenseReport: ExpenseRep
font: opts.font,
color: opts.textColor
})

//Project identifier and name
var y = y - opts.fontSize * 1.5
page.drawText(
i18n.t('labels.project', { lng: opts.language }) +
': ' +
expenseReport.project.identifier +
(expenseReport.project.name ? ' - ' + expenseReport.project.name : ''),
{
x: opts.xStart,
y: y,
size: opts.fontSize,
font: opts.font,
color: opts.textColor
}
)
// Traveler
var y = y - opts.fontSize * 1.5 * 1.5
page.drawText(
Expand Down Expand Up @@ -140,6 +154,7 @@ function drawGeneralInformation(page: pdf_lib.PDFPage, expenseReport: ExpenseRep
font: opts.font,
color: opts.textColor
})

return y
}

Expand Down
15 changes: 15 additions & 0 deletions backend/pdf/healthCareCost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,21 @@ function drawGeneralInformation(page: pdf_lib.PDFPage, healthCareCost: HealthCar
color: opts.textColor
})

//Project identifier and name
var y = y - opts.fontSize * 1.5
page.drawText(
i18n.t('labels.project', { lng: opts.language }) +
': ' +
healthCareCost.project.identifier +
(healthCareCost.project.name ? ' - ' + healthCareCost.project.name : ''),
{
x: opts.xStart,
y: y,
size: opts.fontSize,
font: opts.font,
color: opts.textColor
}
)
// Isurance + patientName
var y = y - opts.fontSize * 1.5 * 1.5
page.drawText(
Expand Down
16 changes: 15 additions & 1 deletion backend/pdf/travel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,21 @@ function drawGeneralTravelInformation(page: pdf_lib.PDFPage, travel: Travel, opt
font: opts.font,
color: opts.textColor
})

//Project identifier and name
var y = y - opts.fontSize * 1.5
page.drawText(
i18n.t('labels.project', { lng: opts.language }) +
': ' +
travel.project.identifier +
(travel.project.name ? ' - ' + travel.project.name : ''),
{
x: opts.xStart,
y: y,
size: opts.fontSize,
font: opts.font,
color: opts.textColor
}
)
// Traveler
var y = y - opts.fontSize * 1.5 * 1.5
page.drawText(
Expand Down

0 comments on commit 25d53bc

Please sign in to comment.