Commit Graph

863 Commits

Author SHA1 Message Date
Pavlo Kerestey
63d4c51dc4 Use quoteIfNeeded in quoteIfSpaced. Fix escapeDoubleQuotes to escape 2018-04-12 12:04:20 -07:00
Pavlo Kerestey
980210070a Explicit exports of Hledger.Utils.Text 2018-04-12 12:04:20 -07:00
Simon Michael
0b5ddcebee cli: clarify smart dates with more examples; add support for YYYYMM 2018-04-04 17:45:23 +01:00
Simon Michael
4ff3a749c6 lib: note an oddity with runJournalParser 2018-03-31 02:44:31 +01:00
Mykola Orliuk
b377bff90a lib: support scientific number notation (#704, #706)
closes simonmichael/hledger#704
2018-03-31 01:49:46 +01:00
Simon Michael
2b34ff1184 lib: reportSpan debug output 2018-03-30 02:41:03 +01:00
Simon Michael
ebaac2866b lib: fix reportStartEndDates, rename to reportSpan 2018-03-30 00:16:35 +01:00
Simon Michael
dc4def835c lib: refactor runPeriodicTransaction, add a test 2018-03-29 18:11:34 +01:00
Simon Michael
d060398484 lib: splitSpan: return no spans for an empty datespan
Fixes an issue where a bounded budget could wrongly appear in a
disjoint report period.
2018-03-29 18:10:51 +01:00
Simon Michael
4d562ef068 lib: don't count periodic/modifier txns in Journal debug output 2018-03-29 16:45:34 +01:00
Simon Michael
083d9190fd budget: only periodic txns with the selected interval are used 2018-03-29 15:51:52 +01:00
Moritz Kiefer
d7b68fbd7d Use skipMany/skipSome for parsing spacenonewline
This avoids allocating the list of space characters only to then
discard it.
2018-03-25 22:59:05 +01:00
Simon Michael
84579bb1b4 silence redundant import warnings with ghc 8.4 2018-03-24 22:51:56 +00:00
Peter Simons
4c5a58ec1e hledger-lib: add missing Semigroup instance for Journal
GHC 8.4.1 makes Semigroup a superclass of Monoid. See
https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid
for details.
2018-03-12 23:17:14 +00:00
Simon Michael
968ae13035 lib: redo buggy Amount refactoring 2018-02-16 02:26:39 -08:00
Simon Michael
b6a089b8a3 lib: Amount: hlint 2018-02-15 17:28:23 -08:00
Simon Michael
b231d99e38 lib: Account, AccountName: hlint 2018-02-15 11:38:34 -08:00
Simon Michael
6d94eed6fd lib: Types: fix/silence hlint warnings 2018-02-15 07:35:51 -08:00
Simon Michael
13855d6b53 csv: no csv records is no longer an error 2018-02-01 09:41:03 -08:00
Simon Michael
d3fde29b36 bal: --invert flag to flip all signs 2018-01-29 14:53:23 -08:00
Simon Michael
9b88fc2ed0 bal/bs/cf/is: sort accounts by account code, if any, then account name
If any accounts have numeric codes assigned via account directives,
those accounts will be listed first, lowest account codes first.
2018-01-23 11:33:24 -08:00
Simon Michael
d420a8b534 journal: account directive: parse and store a numeric account code also 2018-01-23 11:33:23 -08:00
Simon Michael
88ef586480 lib: rename, clarify purpose of balanceReportFromMultiBalanceReport 2018-01-23 11:32:24 -08:00
Simon Michael
5b1883fcdf bs/bse/cf/is: fix display of abbreviated name for December 2018-01-19 12:45:51 -08:00
Simon Michael
e9624486b6 bs/bse/cf/is: show local abbreviated month names on monthly columns 2018-01-18 11:46:12 -08:00
Simon Michael
6b349e3123 bs/bse/cf/is: show all balances as normally-positive (experimental)
Income, liability and equity balances, which until now we have
always displayed as negative numbers, are now shown as normally positive
by these reports.
Negative numbers now indicate a contra-balance (eg an overdrawn
checking account), a net loss, a negative net worth, etc.
This makes these reports more like conventional financial statements,
and easier to read and share with normal people.
2018-01-18 11:01:07 -08:00
Simon Michael
3b2a9eaba4 lib: refactor 2018-01-15 14:15:52 -08:00
Simon Michael
79812f974a rename NormalBalance -> NormalSign 2018-01-15 14:12:38 -08:00
Simon Michael
fedf36e823 lib: when the text encoding is UTF-8, ignore any UTF-8 BOM prefix
Paypal's new CSV has this BOM prefix (at the time of writing),
which was causing a confusing parse error.
2018-01-04 16:29:23 -08:00
Simon Michael
81e964502b lib: refactor low-level text file reading 2018-01-04 16:17:25 -08:00
Simon Michael
ecdbc05703 Merge branch 'feature/space-as-digits-sep' of https://github.com/ony/hledger into ony-feature/space-as-digits-sep 2017-12-30 09:29:22 -08:00
Simon Michael
8f55b6137d uses today's prices, not those of last txn date, for -V (fix #683,#648) 2017-12-29 21:42:59 -08:00
Simon Michael
69e255cead lib: deduplicate, refactor valuation code 2017-12-29 16:52:08 -08:00
Simon Michael
d15a2dc4c0 lib: fix journalAccountNames doc
[ci skip]
2017-12-29 12:34:51 -08:00
Simon Michael
ddef7d722d lib: update journal account names api
Now we have:

-- | Sorted unique account names posted to by this journal's transactions.
journalAccountNamesUsed :: Journal -> [AccountName]

-- | Sorted unique account names implied by this journal's transactions -
-- accounts posted to and all their implied parent accounts.
journalAccountNamesImplied :: Journal -> [AccountName]

-- | Sorted unique account names declared by account directives in this journal.
journalAccountNamesDeclared :: Journal -> [AccountName]

-- | Sorted unique account names declared by account directives or posted to
-- by transactions in this journal.
journalAccountNamesDeclaredOrUsed :: Journal -> [AccountName]

-- | Sorted unique account names declared by account directives, or posted to
-- or implied as parents by transactions in this journal.
journalAccountNamesDeclaredOrImplied :: Journal -> [AccountName]

-- | Convenience/compatibility alias for journalAccountNamesImpliedOrUsed.
journalAccountNames :: Journal -> [AccountName]
2017-12-29 12:18:04 -08:00
Simon Michael
d7d75c50fe lib: expandAccountNames, accountNamesFromPostings should sort here 2017-12-29 12:16:46 -08:00
Nadrieril
9e6e06033f lib: Allow balance-only entries in csv reader 2017-12-14 18:26:29 -08:00
Mykola Orliuk
95db5062d6 journal: inherit commodities in included files
Followup on some comments for simonmichael/hledger#487
2017-12-04 12:26:26 -08:00
Mykola Orliuk
9cdd02e0b0 journal: pretty errors for included files
Fixes simonmichael/hledger#660
2017-12-04 12:26:26 -08:00
Mykola Orliuk
fa2e680b2e lib: fix styles after cost application
Fixes simonmichael/hledger#509
2017-12-04 12:26:26 -08:00
Mykola Orliuk
47766ea9d4 journal: support space as digits sep
Resolves simonmichael/hledger#330
2017-11-29 17:20:18 +01:00
Dmitry Astapov
6f92e70575 lib: remove needless numeric comparisons in bal/bs
accountsFromPostings is currently doing excessive work when adding up
postings in each account. It sorts (accountName, amount) tuples which
cause amounts in them to be compared. There is no need to look at amount
here at all since subsequent summing up and counting does not depend on
order. It is enough to sort by accountname only.

Went through similar pieces of code, made them all look uniform.
2017-11-29 07:08:18 -08:00
Mykola Orliuk
e58272f28f journal: use groups sep and prec for decimal hint
Use whole AmountStyle in process of resolving decimal/groups separator
ambiguity.

Resolve simonmichael/hledger#399
2017-11-27 15:47:56 -08:00
Mykola Orliuk
7cbdeb40a4 journal: get decimal hint from default commodity
If appropriate commodity directive is missing fallback to default
commodity directive to get number representation style.
2017-11-27 15:47:56 -08:00
Mykola Orliuk
b7dbe044b0 journal: use decimal sep hint for amount parser
Make use of commodity format directive as a hint for parsing amount.

Kinda resolves simonmichael/hledger#487
2017-11-27 15:47:56 -08:00
Mykola Orliuk
dafdaec1ca journal: factor out rawnumberp 2017-11-27 15:47:56 -08:00
Mykola Orliuk
bcf7a1add5 journal: make numbers parsing more strict
- Hunt down adjacent punctuations with altering char.
- Add some tests dedicated to parsing amounts.
2017-11-27 15:47:56 -08:00
Mykola Orliuk
53ad035b24 journal: limit scope of directives backtracking
Effectively improves error reporting for directives.

Resolves simonmichael/hledger#402
2017-11-27 14:32:48 -08:00
Mykola Orliuk
48623b4ceb lib: fix backtracking in periodexpr parser
- Simplify doctests for periodexpr.
- Besides consuming leading space consume ending space for periodexpr also.
- Drop implicit option (def, def) behaviour of periodexpr. I.e. disallow
  hledger reg -p '' and auto-transaction with heading just '~'.
- Slightly re-factor periodexpr.
- Ensure that reportinginterval doesn't consume trailing space.
  Useful if  we'll start disallowing periods like "every1stjan2009-".
2017-11-27 06:38:47 -08:00
Dmitry Astapov
23f3da4e92 cli: --auto adds automated postings to reports
Ledger-style automated postings, previously supported only by
hledger-budget, have landed as a first-class feature.  The --auto
flag activates them, so that any postings they generate are
included in reports.
2017-11-26 14:57:41 +00:00