PDF Calc, Cosmetics

This commit is contained in:
Carsten Graf
2026-01-26 10:29:03 +01:00
parent 563d4fc373
commit bbb176dbe3
6 changed files with 30 additions and 7 deletions

View File

@@ -251,12 +251,13 @@ function generatePDF(timesheetId, req, res) {
doc.moveTo(50, y).lineTo(550, y).stroke();
doc.moveDown(0.5);
doc.font('Helvetica-Bold');
doc.text(`Gesamtstunden: ${totalHours.toFixed(2)} h`, 50, doc.y);
// Gesamtstunden = Arbeitsstunden + Urlaubsstunden (Urlaub zählt als Arbeitszeit)
const totalHoursWithVacation = totalHours + vacationHours;
doc.text(`Gesamtstunden: ${totalHoursWithVacation.toFixed(2)} h`, 50, doc.y);
// Überstunden berechnen und anzeigen
const wochenstunden = timesheet.wochenstunden || 0;
// Überstunden = (Tatsächliche Stunden + Urlaubsstunden) - Wochenstunden
const totalHoursWithVacation = totalHours + vacationHours;
const overtimeHours = totalHoursWithVacation - wochenstunden;
doc.moveDown(0.3);
@@ -467,11 +468,12 @@ function generatePDFToBuffer(timesheetId, req) {
doc.moveTo(50, y).lineTo(550, y).stroke();
doc.moveDown(0.5);
doc.font('Helvetica-Bold');
doc.text(`Gesamtstunden: ${totalHours.toFixed(2)} h`, 50, doc.y);
// Gesamtstunden = Arbeitsstunden + Urlaubsstunden (Urlaub zählt als Arbeitszeit)
const totalHoursWithVacation = totalHours + vacationHours;
doc.text(`Gesamtstunden: ${totalHoursWithVacation.toFixed(2)} h`, 50, doc.y);
const wochenstunden = timesheet.wochenstunden || 0;
// Überstunden = (Tatsächliche Stunden + Urlaubsstunden) - Wochenstunden
const totalHoursWithVacation = totalHours + vacationHours;
const overtimeHours = totalHoursWithVacation - wochenstunden;
doc.moveDown(0.3);