container: hledger-flow: vultr: add credits support

- Fixes direction to allow for credits issued by Vultr for N instances
- Updates documentation, adds where to put invoices to catch Sales Tax
This commit is contained in:
2025-09-23 17:13:13 -07:00
parent a2f99b79b4
commit e3f50ddb72
2 changed files with 17 additions and 6 deletions

View File

@@ -53,6 +53,12 @@ function parse()
-v global_subaccount="$global_subaccount" \
-v invoice="$_invoice" \
'{
# WARNING:
#
# Because upstream INVOICE DATE will be at beginning of the month,
# any January invoices *MUST* also go into the previous year December,
# in order to catch Sales Tax issued on the 1st for the previous month.
if ($2 !~ global_year)
next
@@ -66,14 +72,14 @@ function parse()
# Skip $4
printf $5 OFS # quantity
direction = ($6 ~ /^"-/ ? "IN" : "OUT")
sub(/^"-/, "\"", $6)
printf $6 OFS # amount
printf invoice OFS # invoice number
# NOTE: Vultr currently only provides expenses w/out sales tax
direction="OUT"
printf direction OFS
printf global_subaccount
printf "\n"

View File

@@ -1,6 +1,6 @@
# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
# Copyright (C) 2024-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,11 +20,16 @@ fields date,description,quantity,amount_,invoice,direction,subaccount
date-format %Y-%m-%d %H:%M
account1 assets:vultr:%subaccount:USD
amount -%amount_ USD
amount %amount_ USD
comment invoice:%invoice, quantity:%quantity, direction:%direction
account2 expenses:vultr:%subaccount:USD
if %direction ^IN$
account2 income:vultr:%subaccount:credits:USD
if %direction ^OUT$
amount -%amount_ USD
account2 expenses:vultr:%subaccount:USD
if %description ^Sales Tax$
account2 expenses:vultr:%subaccount:sales_tax:USD