forked from EvergreenCrypto/docker-finance
Merge pull request #204 into master
812d9cc container: hledger-flow: remove potential % interpretation (printf) (Aaron Fiore)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -47,6 +47,7 @@ function parse()
|
||||
sub(/^ /, "", $5) # may have an empty space in front of line
|
||||
gsub(/, /, " - ") # may have (multiple) commas followed by space
|
||||
gsub(/"/, "", $5) # may have (multiple) quotes
|
||||
sub(/%/, "%%", $5) # remove potential interpretation
|
||||
|
||||
printf $1 OFS # Date
|
||||
printf $2 OFS # Time
|
||||
|
||||
@@ -127,6 +127,7 @@ function btcpayserver::legacy()
|
||||
printf $22 OFS # InvoiceItemCode
|
||||
|
||||
# TODO: if description contains comma(s)?
|
||||
sub(/%/, "%%", $23)
|
||||
printf $23 OFS # InvoiceItemDesc
|
||||
|
||||
printf $24 OFS # InvoiceFullStatus
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -46,7 +46,10 @@ function parse_credit()
|
||||
printf $1 OFS # Transaction Date
|
||||
printf $2 OFS # Posted Date
|
||||
printf $3 OFS # Card No.
|
||||
|
||||
sub(/%/, "%%", $4)
|
||||
printf $4 OFS # Description
|
||||
|
||||
printf $5 OFS # Category
|
||||
|
||||
# Debit = OUT, Credit = IN
|
||||
@@ -84,7 +87,10 @@ function parse_bank()
|
||||
sub(/^-/, "", $5)
|
||||
|
||||
printf $1 OFS # Account Number
|
||||
|
||||
sub(/%/, "%%", $2)
|
||||
printf $2 OFS # Transaction Description
|
||||
|
||||
printf $3 OFS # Transaction Date
|
||||
printf $4 OFS # Transaction Type
|
||||
printf $5 OFS # Transaction Amount
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -45,7 +45,10 @@ function parse_credit()
|
||||
|
||||
printf $1 OFS # Transaction Date
|
||||
printf $2 OFS # Post Date
|
||||
|
||||
sub(/%/, "%%", $3)
|
||||
printf $3 OFS # Description
|
||||
|
||||
printf $4 OFS # Category
|
||||
printf $5 OFS # Type
|
||||
|
||||
@@ -75,6 +78,8 @@ function parse_bank()
|
||||
|
||||
printf $1 OFS # Details (CREDIT/DEBIT/DSLIP/etc.)
|
||||
printf $2 OFS # Posting Date
|
||||
|
||||
sub(/%/, "%%", $3)
|
||||
printf $3 OFS # Description
|
||||
|
||||
# Amount
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -47,6 +47,8 @@ function parse_credit()
|
||||
|
||||
printf $1 OFS # Trans. Date
|
||||
printf $2 OFS # Post Date
|
||||
|
||||
sub(/%/, "%%", $3)
|
||||
printf $3 OFS # Description
|
||||
|
||||
# Flip the amount signs for proper liabilities accounting
|
||||
@@ -74,7 +76,10 @@ function parse_bank()
|
||||
next
|
||||
|
||||
printf $1 OFS # Transaction Date
|
||||
|
||||
sub(/%/, "%%", $2)
|
||||
printf $2 OFS # Transaction Description
|
||||
|
||||
printf $3 OFS # Transaction Type
|
||||
|
||||
sub(/\$/,"",$4);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -44,7 +44,10 @@ function parse()
|
||||
next
|
||||
|
||||
printf $1 OFS # transaction_hash
|
||||
|
||||
sub(/%/, "%%", $2)
|
||||
printf $2 OFS # label
|
||||
|
||||
printf $3 OFS # confirmations
|
||||
|
||||
# value (without fee)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -66,6 +66,8 @@ function parse()
|
||||
|
||||
printf $7 OFS # Price
|
||||
printf $8 OFS # Comission
|
||||
|
||||
sub(/%/, "%%", $9)
|
||||
printf $9 OFS # Description
|
||||
|
||||
printf direction OFS
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -55,7 +55,10 @@ function parse()
|
||||
if ($10 == "") {$10 = "0"}
|
||||
|
||||
printf $1 " " $2 OFS # Date/Time
|
||||
|
||||
sub(/%/, "%%", $4)
|
||||
printf $4 OFS # Name (description)
|
||||
|
||||
printf $5 OFS # Type
|
||||
printf $6 OFS # Status
|
||||
printf $7 OFS # Currency
|
||||
@@ -68,7 +71,10 @@ function parse()
|
||||
printf $12 OFS # To Email Address
|
||||
printf $13 OFS # Transaction ID
|
||||
printf $(NF-4) OFS # Contact Phone Number
|
||||
|
||||
sub(/%/, "%%", $(NF-2))
|
||||
printf $(NF-2) OFS # Note
|
||||
|
||||
printf $(NF) OFS # Balance Impact
|
||||
|
||||
# Direction
|
||||
|
||||
@@ -70,7 +70,10 @@ function parse_report()
|
||||
|
||||
# Print
|
||||
printf timestamp OFS # timestamp
|
||||
|
||||
sub(/%/, "%%", $3)
|
||||
printf $3 OFS # description (Name)
|
||||
|
||||
printf $4 OFS # type
|
||||
printf $5 OFS # status
|
||||
printf $6 OFS # currency
|
||||
@@ -91,6 +94,8 @@ function parse_report()
|
||||
printf $12 OFS # balance
|
||||
|
||||
printf $13 OFS # txid (Transaction ID)
|
||||
|
||||
sub(/%/, "%%", $14)
|
||||
printf $14 OFS # title (Item Title)
|
||||
|
||||
printf direction OFS
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -72,7 +72,10 @@ function parse()
|
||||
printf $6 OFS # Fee
|
||||
printf $7 OFS # Fee unit
|
||||
printf $8 OFS # Address
|
||||
|
||||
sub(/%/, "%%", $9)
|
||||
printf $9 OFS # Label
|
||||
|
||||
printf("%.8f", $10); printf OFS # Amount # TODO: more than 8 places for Ethereum, etc.?
|
||||
printf $11 OFS # Amount unit
|
||||
printf $12 OFS # Fiat (USD)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2024-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -59,6 +59,8 @@ function parse()
|
||||
# Skip $1 # start date
|
||||
|
||||
printf $2 OFS # end date (date)
|
||||
|
||||
sub(/%/, "%%", $3)
|
||||
printf $3 OFS # description
|
||||
|
||||
# Skip $4
|
||||
|
||||
Reference in New Issue
Block a user