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

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