From c69c841a18695de6e14340e42de0001de29fce67 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Wed, 10 Jul 2024 15:36:38 -0700 Subject: [PATCH] hledger-flow: capital-one: bank: reorder columns Upstream has reordered their columns (same data, different order). --- .../capital-one/capital-one-bank-shared.rules | 2 +- .../accounts/capital-one/capital-one-shared.bash | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) 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 2db494e..68f233a 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 @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -fields card,date,amount_,type,description,balance_,direction,subaccount +fields card,description,date,type,amount_,balance_,direction,subaccount date-format %m/%d/%y account1 assets:capital-one:%subaccount 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 fe387e4..0ba5278 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 @@ -66,27 +66,27 @@ function parse_credit() function parse_bank() { - lib_preprocess::assert_header "Account Number,Transaction Date,Transaction Amount,Transaction Type,Transaction Description,Balance" + lib_preprocess::assert_header "Account Number,Transaction Description,Transaction Date,Transaction Type,Transaction Amount,Balance" gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" \ '{ if (NR>1 || NF) { # Date format is MM/DD/YY - yy=substr($2, 7, 2) + yy=substr($3, 7, 2) global_yy=substr(global_year, 3, 2) if (yy != global_yy) next printf $1 OFS # Account Number - printf $2 OFS # Transaction Date - printf $3 OFS # Transaction Amount + printf $2 OFS # Transaction Description + printf $3 OFS # Transaction Date printf $4 OFS # Transaction Type - printf $5 OFS # Transaction Description + printf $5 OFS # Transaction Amount printf $6 OFS # Balance - direction=($3 ~ /^-/ ? "OUT" : "IN") + direction=($5 ~ /^-/ ? "OUT" : "IN") printf direction OFS printf global_subaccount