From 7f9e12d0d2092a7d4e21b5ef4656af2085ac9208 Mon Sep 17 00:00:00 2001 From: Rushmore75 Date: Thu, 22 Jan 2026 12:23:56 -0700 Subject: [PATCH] init --- .gitignore | 2 ++ gen.sh | 24 ++++++++++++++++++++++++ template.mm | 41 +++++++++++++++++++++++++++++++++++++++++ work.csv | 4 ++++ 4 files changed, 71 insertions(+) create mode 100644 .gitignore create mode 100755 gen.sh create mode 100644 template.mm create mode 100644 work.csv diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2235288 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.bak +*.pdf diff --git a/gen.sh b/gen.sh new file mode 100755 index 0000000..6d6f0f1 --- /dev/null +++ b/gen.sh @@ -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 diff --git a/template.mm b/template.mm new file mode 100644 index 0000000..16792bd --- /dev/null +++ b/template.mm @@ -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! + diff --git a/work.csv b/work.csv new file mode 100644 index 0000000..f39d388 --- /dev/null +++ b/work.csv @@ -0,0 +1,4 @@ +Prep,2 +Cooking,1.25 +Event,10 +Cleanup,2.5