summaryrefslogtreecommitdiff
path: root/payinfo-to-journal
diff options
context:
space:
mode:
Diffstat (limited to 'payinfo-to-journal')
-rwxr-xr-xpayinfo-to-journal67
1 files changed, 0 insertions, 67 deletions
diff --git a/payinfo-to-journal b/payinfo-to-journal
deleted file mode 100755
index abdc4c4..0000000
--- a/payinfo-to-journal
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env bash
-#
-# get paystub info from bamboohr, dump to ledger-cli journal file
-
-journal="$HOME/org/fund/from-qutebrowser.journal"
-
-json=$(pup '.PayDetailTable table tr json{}' < "$QUTE_HTML")
-
-# this must be different than 'sel' because the income table has 4 columns
-# instead of 3
-sel_income() {
- jq '.[] | {(.children[0].text): .children[2].text}' <<< $json \
- | jq -s add \
- | jq ".\"$1\"" \
- | sed 's/\$\|\"//g' \
- | sed "s/null/0.00/"
-}
-income=$(sel_income "Regular")
-
-# 'reduce' puts '$in' first, so when we find duplicate fields, we choose the
-# first, thus selecting "Deducted from your check" instead of "Paid by your
-# employer on your behalf" which I don't need to track
-data=$(jq '.[] | {(.children[0].text): .children[1].text}' <<< $json \
- | jq -n 'reduce inputs as $in (null; $in + .)'
-)
-# select a field from extracted data
-sel() {
- jq ".\"$1\"" <<< $data \
- | sed 's/\$\|\"//g' \
- | sed "s/null/0.00/"
-}
-
-date=$(pup "#fabricModalHeadline text{}" < "$QUTE_HTML" \
- | sed "s/ Paystub//"
-)
-
-# parse the "Direct Deposit" section
-get_deposits() {
- pup '.PaystubMessage__text json{}' < "$QUTE_HTML" \
- | jq '.[1].text' \
- | sed 's/, /\n/g' \
- | sed 's/$\([0-9.,]*\) .* x-\(....\)/ as:me:cash:\2 \1 USD/g' \
- | sed 's/"//g' \
- | sed 's/\.$//g'
-}
-deposits=$(get_deposits)
-
-cat <<EOF >> ~/org/fund/from-bamboohr.journal
-$(date --date="$date" '+%Y/%m/%d') * Groq Paycheck
- in:me:groq:salary -$income USD
- ex:me:taxs:federal:income $(sel "Federal") USD
- ex:me:taxs:federal:medicare $(sel "Medicare") USD
- ex:me:taxs:federal:social-security $(sel "Social Security") USD
- ex:me:taxs:california:sdi $(sel "CA-SDI") USD
- ex:me:taxs:california:income $(sel "State (CA)") USD
- ex:me:taxs:ohio:income $(sel "State (OH)") USD
- as:me:groq:deductions:401k $(sel "401K Savings Pre-Tax") USD
- ex:me:groq:deductions:medical $(sel "Blue Shield Plat PPO Med Ins Pre-Tax") USD
- ex:me:groq:deductions:medical $(sel "Domestic Partner Medical") USD
- ex:me:groq:deductions:dental $(sel "Delta Dental Insurance Pre-Tax") USD
- ex:me:groq:deductions:dental $(sel "Domestic Partner Dental") USD
- ex:me:groq:deductions:vision $(sel "Vision Insurance Pre-Tax") USD
- ex:me:groq:deductions:vision $(sel "Domestic Partner Vision") USD
-${deposits[@]}
-
-
-EOF