mirror of
https://github.com/Garmelon/Arbeitszeitdokumentationsgenerator.git
synced 2026-04-12 08:45:05 +02:00
Format template using typstyle
Also changing a few small details so they play nicer with the formatter.
This commit is contained in:
parent
14622a1fb2
commit
c1e61d251f
1 changed files with 141 additions and 99 deletions
|
|
@ -20,12 +20,15 @@
|
||||||
set par(leading: 5pt)
|
set par(leading: 5pt)
|
||||||
|
|
||||||
// Weird vertical text in the bottom left
|
// Weird vertical text in the bottom left
|
||||||
place(bottom + left, dx: -6mm, dy: -1mm,
|
place(
|
||||||
rotate(-90deg, origin: bottom + left,
|
bottom + left,
|
||||||
text(size: 6pt, tracking: 3.1pt,
|
dx: -6mm,
|
||||||
"K_PSE_PB_AZDoku_01_04-20"
|
dy: -1mm,
|
||||||
)
|
rotate(
|
||||||
)
|
-90deg,
|
||||||
|
origin: bottom + left,
|
||||||
|
text(size: 6pt, tracking: 3.1pt, "K_PSE_PB_AZDoku_01_04-20"),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Main box
|
// Main box
|
||||||
|
|
@ -34,23 +37,34 @@
|
||||||
height: 100%,
|
height: 100%,
|
||||||
stroke: _kit_stroke,
|
stroke: _kit_stroke,
|
||||||
radius: (top-right: 4.5mm, bottom-left: 4.5mm),
|
radius: (top-right: 4.5mm, bottom-left: 4.5mm),
|
||||||
inset: 0mm
|
inset: 0mm,
|
||||||
)[
|
)[
|
||||||
// Logo
|
// Logo
|
||||||
#place(top + left, dx: 9.5mm, dy: 3.5mm,
|
#place(
|
||||||
image("kit_logo.svg", width: 29mm)
|
top + left,
|
||||||
|
dx: 9.5mm,
|
||||||
|
dy: 3.5mm,
|
||||||
|
image("kit_logo.svg", width: 29mm),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Heading
|
// Heading
|
||||||
#place(top + left, dx: 78mm, dy: 9mm,
|
#place(
|
||||||
text(weight: "bold", size: 14pt, fill: _kit_green,
|
top + left,
|
||||||
[Arbeitszeitdokumentation]
|
dx: 78mm,
|
||||||
)
|
dy: 9mm,
|
||||||
|
text(
|
||||||
|
weight: "bold",
|
||||||
|
size: 14pt,
|
||||||
|
fill: _kit_green,
|
||||||
|
)[Arbeitszeitdokumentation],
|
||||||
)
|
)
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
#place(bottom + right, dx: -15mm, dy: -1.5mm,
|
#place(
|
||||||
text(size: 9pt, [Seite 1 von 1])
|
bottom + right,
|
||||||
|
dx: -15mm,
|
||||||
|
dy: -1.5mm,
|
||||||
|
text(size: 9pt)[Seite 1 von 1],
|
||||||
)
|
)
|
||||||
|
|
||||||
// Main content
|
// Main content
|
||||||
|
|
@ -58,7 +72,7 @@
|
||||||
inset: (top: 24.5mm, left: 7.5mm, right: 13mm),
|
inset: (top: 24.5mm, left: 7.5mm, right: 13mm),
|
||||||
width: 100%,
|
width: 100%,
|
||||||
height: 100%,
|
height: 100%,
|
||||||
body
|
body,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -75,7 +89,7 @@
|
||||||
width: 3.5mm,
|
width: 3.5mm,
|
||||||
outset: (y: 0.4mm),
|
outset: (y: 0.4mm),
|
||||||
stroke: _kit_stroke,
|
stroke: _kit_stroke,
|
||||||
align(center + horizon, if checked { "X" } else { " " })
|
align(center + horizon, if checked { "X" } else { " " }),
|
||||||
)
|
)
|
||||||
|
|
||||||
#let _header(
|
#let _header(
|
||||||
|
|
@ -87,23 +101,25 @@
|
||||||
department: " ",
|
department: " ",
|
||||||
monthly_hours: " ",
|
monthly_hours: " ",
|
||||||
hourly_wage: " ",
|
hourly_wage: " ",
|
||||||
) = [
|
) = {
|
||||||
#set text(size: 11pt)
|
// "OE" means "Institut / Organisationseinheit"
|
||||||
#pad(left: 2.5mm, grid(
|
set text(size: 11pt)
|
||||||
|
pad(
|
||||||
|
left: 2.5mm,
|
||||||
|
grid(
|
||||||
columns: (1fr, 92mm),
|
columns: (1fr, 92mm),
|
||||||
rows: 6mm,
|
rows: 6mm,
|
||||||
|
|
||||||
[],
|
[],
|
||||||
align(right)[
|
align(right)[
|
||||||
*Monat / Jahr:* #h(6mm)
|
*Monat / Jahr:* #h(6mm)
|
||||||
#_underlined(align(center)[
|
#_underlined(
|
||||||
|
align(center)[
|
||||||
#box(width: 21mm)[#month] / #box(width: 21mm)[#year]
|
#box(width: 21mm)[#month] / #box(width: 21mm)[#year]
|
||||||
])
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
|
|
||||||
[*Name, Vorname des/r Beschäftigten:*],
|
[*Name, Vorname des/r Beschäftigten:*], _underlined(box(width: 100%, name)),
|
||||||
_underlined(box(width: 100%, name)),
|
|
||||||
|
|
||||||
[*Personalnummer:*],
|
[*Personalnummer:*],
|
||||||
_underlined[
|
_underlined[
|
||||||
#box(width: 1fr)[#staff_id]
|
#box(width: 1fr)[#staff_id]
|
||||||
|
|
@ -116,27 +132,30 @@
|
||||||
#h(8mm)
|
#h(8mm)
|
||||||
],
|
],
|
||||||
|
|
||||||
[*OE:*], // Institut / Organisationseinheit
|
[*OE:*], _underlined(box(width: 100%)[#department]),
|
||||||
_underlined(box(width: 100%)[#department]),
|
|
||||||
|
|
||||||
[*Vertraglich vereinbarte Arbeitszeit:*],
|
[*Vertraglich vereinbarte Arbeitszeit:*],
|
||||||
[
|
[
|
||||||
#_underlined(align(center)[
|
#_underlined(
|
||||||
|
align(center)[
|
||||||
#h(4mm)
|
#h(4mm)
|
||||||
#box(width: 10mm)[#monthly_hours]
|
#box(width: 10mm)[#monthly_hours]
|
||||||
Std.
|
Std.
|
||||||
#h(4mm)
|
#h(4mm)
|
||||||
])
|
],
|
||||||
|
)
|
||||||
#h(1fr)
|
#h(1fr)
|
||||||
*Stundensatz:*
|
*Stundensatz:*
|
||||||
#h(4mm)
|
#h(4mm)
|
||||||
#_underlined(align(center)[
|
#_underlined(
|
||||||
|
align(center)[
|
||||||
#box(width: 18mm)[#hourly_wage]
|
#box(width: 18mm)[#hourly_wage]
|
||||||
*€*
|
*€*
|
||||||
])
|
],
|
||||||
]
|
)
|
||||||
))
|
],
|
||||||
]
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#let _log(..entries) = {
|
#let _log(..entries) = {
|
||||||
set text(size: 10pt)
|
set text(size: 10pt)
|
||||||
|
|
@ -174,7 +193,9 @@
|
||||||
carry_next_month: [],
|
carry_next_month: [],
|
||||||
) = {
|
) = {
|
||||||
set text(size: 10pt)
|
set text(size: 10pt)
|
||||||
align(right, table(
|
align(
|
||||||
|
right,
|
||||||
|
table(
|
||||||
columns: (54mm, 23.3mm),
|
columns: (54mm, 23.3mm),
|
||||||
rows: 5.05mm,
|
rows: 5.05mm,
|
||||||
align: center + horizon,
|
align: center + horizon,
|
||||||
|
|
@ -185,21 +206,28 @@
|
||||||
[*monatliche Soll-Arbeitszeit:*], [#monthly_hours],
|
[*monatliche Soll-Arbeitszeit:*], [#monthly_hours],
|
||||||
[*Übertrag vom Vormonat:*], [#carry_prev_month],
|
[*Übertrag vom Vormonat:*], [#carry_prev_month],
|
||||||
[*Übertrag in den Folgemonat:*], [#carry_next_month],
|
[*Übertrag in den Folgemonat:*], [#carry_next_month],
|
||||||
))
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#let _footer() = pad(left: 2.5mm)[
|
#let _footer() = pad(left: 2.5mm)[
|
||||||
#v(3.5mm)
|
#v(3.5mm)
|
||||||
|
|
||||||
|
#let signature = pad(
|
||||||
|
left: -2.5mm,
|
||||||
|
line(
|
||||||
|
length: 100%,
|
||||||
|
stroke: stroke(thickness: _kit_stroke, dash: "densely-dotted"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
#grid(
|
#grid(
|
||||||
columns: (1fr, 77.5mm),
|
columns: (1fr, 77.5mm),
|
||||||
column-gutter: 6.5mm,
|
column-gutter: 6.5mm,
|
||||||
row-gutter: (12mm, 3mm),
|
row-gutter: (12mm, 3mm),
|
||||||
[Ich bestätige die Richtigkeit der Angaben:],
|
[Ich bestätige die Richtigkeit der Angaben:], [Geprüft:],
|
||||||
[Geprüft:],
|
signature, signature,
|
||||||
pad(left: -2.5mm, line(length: 100%, stroke: stroke(thickness: _kit_stroke, dash: "densely-dotted"))),
|
[Datum, Unterschrift Beschäftigte/r], [Datum, Unterschrift Dienstvorgesetzte/r],
|
||||||
pad(left: -2.5mm, line(length: 100%, stroke: stroke(thickness: _kit_stroke, dash: "densely-dotted"))),
|
|
||||||
[Datum, Unterschrift Beschäftigte/r],
|
|
||||||
[Datum, Unterschrift Dienstvorgesetzte/r],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -256,10 +284,15 @@
|
||||||
|
|
||||||
#let _month_length(year, month) = {
|
#let _month_length(year, month) = {
|
||||||
assert(1 <= month and month <= 12)
|
assert(1 <= month and month <= 12)
|
||||||
if (1, 3, 5, 7, 8, 10, 12).contains(month) { 31 }
|
if (1, 3, 5, 7, 8, 10, 12).contains(month) {
|
||||||
else if (4, 6, 9, 11).contains(month) { 30 }
|
31
|
||||||
else if _is_leap_year(year) { 29 }
|
} else if (4, 6, 9, 11).contains(month) {
|
||||||
else { 28 }
|
30
|
||||||
|
} else if _is_leap_year(year) {
|
||||||
|
29
|
||||||
|
} else {
|
||||||
|
28
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#let _next_day(date) = {
|
#let _next_day(date) = {
|
||||||
|
|
@ -324,17 +357,17 @@
|
||||||
let e = calc.rem(b, 4)
|
let e = calc.rem(b, 4)
|
||||||
// let f = calc.quo(b + 8, 25)
|
// let f = calc.quo(b + 8, 25)
|
||||||
// let g = calc.quo(b - f + 1, 3)
|
// let g = calc.quo(b - f + 1, 3)
|
||||||
let g = calc.quo(8*b + 13, 25)
|
let g = calc.quo(8 * b + 13, 25)
|
||||||
let h = calc.rem(19*a + b - d - g + 15, 30)
|
let h = calc.rem(19 * a + b - d - g + 15, 30)
|
||||||
let i = calc.quo(c, 4)
|
let i = calc.quo(c, 4)
|
||||||
let k = calc.rem(c, 4)
|
let k = calc.rem(c, 4)
|
||||||
let l = calc.rem(32 + 2*e + 2*i - h - k, 7)
|
let l = calc.rem(32 + 2 * e + 2 * i - h - k, 7)
|
||||||
// let m = calc.quo(a + 11*h + 22*l, 451)
|
// let m = calc.quo(a + 11 * h + 22 * l, 451)
|
||||||
let m = calc.quo(a + 11*h + 19*l, 433)
|
let m = calc.quo(a + 11 * h + 19 * l, 433)
|
||||||
// let n = calc.quo(h + l - 7*m + 114, 31)
|
// let n = calc.quo(h + l - 7 * m + 114, 31)
|
||||||
let n = calc.quo(h + l - 7*m + 90, 25)
|
let n = calc.quo(h + l - 7 * m + 90, 25)
|
||||||
// let o = calc.rem(h + l - 7*m + 114, 31)
|
// let o = calc.rem(h + l - 7 * m + 114, 31)
|
||||||
let p = calc.rem(h + l - 7*m + 33*n + 19, 32)
|
let p = calc.rem(h + l - 7 * m + 33 * n + 19, 32)
|
||||||
let month = n
|
let month = n
|
||||||
// let day = o + 1
|
// let day = o + 1
|
||||||
let day = p
|
let day = p
|
||||||
|
|
@ -427,7 +460,11 @@
|
||||||
// Conclusion: A hard limit of 8 working hours a day will likely cause the
|
// Conclusion: A hard limit of 8 working hours a day will likely cause the
|
||||||
// least headaches in the long run.
|
// least headaches in the long run.
|
||||||
let max_duration = _parse_duration("08:00")
|
let max_duration = _parse_duration("08:00")
|
||||||
_assert_day(day, info.duration <= max_duration, "must not work more than 8 hours per day (see comment in typst template for more details)")
|
_assert_day(
|
||||||
|
day,
|
||||||
|
info.duration <= max_duration,
|
||||||
|
"must not work more than 8 hours per day (see comment in typst template for more details)",
|
||||||
|
)
|
||||||
|
|
||||||
// The TimeSheetGenerator requires 30 minutes rest after more than 6 hours
|
// The TimeSheetGenerator requires 30 minutes rest after more than 6 hours
|
||||||
// of work, and 45 minutes rest after more than 9 hours of work:
|
// of work, and 45 minutes rest after more than 9 hours of work:
|
||||||
|
|
@ -444,12 +481,14 @@
|
||||||
// completeness. This should prevent correctness bugs if the working hour
|
// completeness. This should prevent correctness bugs if the working hour
|
||||||
// limit is ever increased again.
|
// limit is ever increased again.
|
||||||
if info.duration > _parse_duration("09:00") {
|
if info.duration > _parse_duration("09:00") {
|
||||||
_assert_day(day,
|
_assert_day(
|
||||||
|
day,
|
||||||
info.rest >= _parse_duration("00:45"),
|
info.rest >= _parse_duration("00:45"),
|
||||||
"at least 45 minutes rest required after more than 9 hours of work",
|
"at least 45 minutes rest required after more than 9 hours of work",
|
||||||
)
|
)
|
||||||
} else if info.duration > _parse_duration("06:00") {
|
} else if info.duration > _parse_duration("06:00") {
|
||||||
_assert_day(day,
|
_assert_day(
|
||||||
|
day,
|
||||||
info.rest >= _parse_duration("00:30"),
|
info.rest >= _parse_duration("00:30"),
|
||||||
"30 minutes rest required after more than 6 hours of work",
|
"30 minutes rest required after more than 6 hours of work",
|
||||||
)
|
)
|
||||||
|
|
@ -545,7 +584,10 @@
|
||||||
_fmt_duration(e.rest),
|
_fmt_duration(e.rest),
|
||||||
{
|
{
|
||||||
_fmt_duration(e.duration)
|
_fmt_duration(e.duration)
|
||||||
if e.note != none { " "; e.note }
|
if e.note != none {
|
||||||
|
" "
|
||||||
|
e.note
|
||||||
|
}
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue