This commit is contained in:
2026-01-22 12:23:56 -07:00
commit 7f9e12d0d2
4 changed files with 71 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.bak
*.pdf

24
gen.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
if [[ -z $1 ]]; then
echo First argument must be a csv containing: jobs,hours
exit
fi
if [[ -z $2 ]]; then
echo Second argument must be the name of who you are billing
exit
fi
TMP=$(mktemp)
cat $1 | awk -F, '{ sum += $2 }; { print $1 ";" $2 ";" $2 * 50 } END { print "Total" ";" sum ";" sum * 50}' > $TMP
# Last line
# Everything but the last line
TOTAL=$(cat $TMP | tail -n 1) \
BODY=$(cat $TMP | head -n -1) \
COMPANY=$2 \
envsubst < template.mm | groff -t -mm -T pdf > output.pdf
rm $TMP

41
template.mm Normal file
View File

@@ -0,0 +1,41 @@
\# Make headers bold
.ds HF 3 3
\# Make lvl 1 headers 20pt, lvl 2 18pt
.ds HP 20 18
.S 12
\# Disable page header
.PH ''''
\# Centered block
.DS C
.HU "Your Bill"
.DE
\# Contact info
.TS
nospaces center tab(;);
LR.
Cooies Unlimited;(123) 456-7890
123 Sesame St.;cookie@example.com
Dumpster 1;\*[DT]
Nicevile FL;Invoice ID #001
.TE
\# Billing info
.TS
nospaces center tab(;);
CbSS
CiCi|Ci
RN|N.
${COMPANY}
Job;Hours;Cost
_
${BODY}
_
.T&
RbN|Nb.
${TOTAL}
.TE
.PP
If you have any questions please reach out at any of the provided contacts above.
Thank you for your business!

4
work.csv Normal file
View File

@@ -0,0 +1,4 @@
Prep,2
Cooking,1.25
Event,10
Cleanup,2.5
1 Prep 2
2 Cooking 1.25
3 Event 10
4 Cleanup 2.5