diff --git a/container/src/hledger-flow/accounts/capital-one/capital-one-bank-shared.rules b/container/src/hledger-flow/accounts/capital-one/capital-one-bank-shared.rules index d3d5982..5af983b 100644 --- a/container/src/hledger-flow/accounts/capital-one/capital-one-bank-shared.rules +++ b/container/src/hledger-flow/accounts/capital-one/capital-one-bank-shared.rules @@ -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 diff --git a/container/src/hledger-flow/accounts/capital-one/capital-one-shared.bash b/container/src/hledger-flow/accounts/capital-one/capital-one-shared.bash index 0ba5278..937af30 100755 --- a/container/src/hledger-flow/accounts/capital-one/capital-one-shared.bash +++ b/container/src/hledger-flow/accounts/capital-one/capital-one-shared.bash @@ -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"