hledger-flow: capital-one: bank: fix direction

This commit is contained in:
2024-08-28 19:01:25 -07:00
parent 8bc90fedf4
commit 7f413d5351
2 changed files with 9 additions and 2 deletions

View File

@@ -22,6 +22,9 @@ account1 assets:capital-one:%subaccount
amount %amount_ USD
comment card:%card, type:%type, direction:%direction
if %direction ^OUT$
amount -%amount_ USD
# Default as equity
if %direction ^IN$
account2 equity:capital-one:%subaccount:withdrawal

View File

@@ -79,6 +79,10 @@ function parse_bank()
if (yy != global_yy)
next
# Remain consistent w/ pre-2024 format
# (will be added in rules)
sub(/^-/, "", $5)
printf $1 OFS # Account Number
printf $2 OFS # Transaction Description
printf $3 OFS # Transaction Date
@@ -86,9 +90,9 @@ function parse_bank()
printf $5 OFS # Transaction Amount
printf $6 OFS # Balance
direction=($5 ~ /^-/ ? "OUT" : "IN")
direction=($4 ~ /^Debit$/ ? "OUT" : "IN")
printf direction OFS
printf global_subaccount
printf "\n"