hledger-flow: capital-one: bank: reorder columns
Upstream has reordered their columns (same data, different order).
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# 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
|
date-format %m/%d/%y
|
||||||
|
|
||||||
account1 assets:capital-one:%subaccount
|
account1 assets:capital-one:%subaccount
|
||||||
|
|||||||
@@ -66,27 +66,27 @@ function parse_credit()
|
|||||||
|
|
||||||
function parse_bank()
|
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" \
|
gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" \
|
||||||
'{
|
'{
|
||||||
if (NR>1 || NF)
|
if (NR>1 || NF)
|
||||||
{
|
{
|
||||||
# Date format is MM/DD/YY
|
# Date format is MM/DD/YY
|
||||||
yy=substr($2, 7, 2)
|
yy=substr($3, 7, 2)
|
||||||
global_yy=substr(global_year, 3, 2)
|
global_yy=substr(global_year, 3, 2)
|
||||||
|
|
||||||
if (yy != global_yy)
|
if (yy != global_yy)
|
||||||
next
|
next
|
||||||
|
|
||||||
printf $1 OFS # Account Number
|
printf $1 OFS # Account Number
|
||||||
printf $2 OFS # Transaction Date
|
printf $2 OFS # Transaction Description
|
||||||
printf $3 OFS # Transaction Amount
|
printf $3 OFS # Transaction Date
|
||||||
printf $4 OFS # Transaction Type
|
printf $4 OFS # Transaction Type
|
||||||
printf $5 OFS # Transaction Description
|
printf $5 OFS # Transaction Amount
|
||||||
printf $6 OFS # Balance
|
printf $6 OFS # Balance
|
||||||
|
|
||||||
direction=($3 ~ /^-/ ? "OUT" : "IN")
|
direction=($5 ~ /^-/ ? "OUT" : "IN")
|
||||||
|
|
||||||
printf direction OFS
|
printf direction OFS
|
||||||
printf global_subaccount
|
printf global_subaccount
|
||||||
|
|||||||
Reference in New Issue
Block a user