init
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.bak
|
||||
*.pdf
|
||||
24
gen.sh
Executable file
24
gen.sh
Executable 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
41
template.mm
Normal 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!
|
||||
|
||||
Reference in New Issue
Block a user