Merge pull request #80 into master

c69c841 hledger-flow: capital-one: bank: reorder columns (Aaron Fiore)
This commit is contained in:
2024-07-11 15:38:24 -07:00
2 changed files with 7 additions and 7 deletions

View File

@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
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

View File

@@ -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