Commit Graph

291 Commits

Author SHA1 Message Date
Simon Michael
e333c76d6f leaves utility 2008-12-04 19:32:42 +00:00
Simon Michael
6f6ce11ca8 more balance-calculating extraction 2008-12-05 08:26:13 +00:00
Simon Michael
eca112f7d4 extract common balance-calculating code 2008-12-05 05:09:54 +00:00
Simon Michael
76df6ec88f optimise cacheLedger by using the tree to help calculate account balances
from:

	total time  =        0.14 secs   (7 ticks @ 20 ms)
	total alloc = 275,520,536 bytes  (excludes profiling overheads)

     cacheLedger                                     1   0.0    0.1      42.9       48.6
      sumTransactions                                0   0.0    0.6      28.6       42.5
       isZeroAmount                              13529   0.0    2.0      14.3       39.2
        showAmount                               13529   0.0    7.2      14.3       37.2
         showAmount'                             13529  14.3   29.9      14.3       29.9
         con2tag_Side#                           27232   0.0    0.0       0.0        0.0
       normaliseMixedAmount                       6733   0.0    1.8      14.3        2.7
        con2tag_Side#                              120   0.0    0.0       0.0        0.0
        sumAmountsPreservingPrice                 6803   0.0    0.2      14.3        1.0
         amountop                                13351   0.0    0.4      14.3        0.8
          convertAmountTo                        13351  14.3    0.4      14.3        0.4
           conversionRate                        13351   0.0    0.0       0.0        0.0
      isAccountNamePrefixOf                      25122   0.0    2.0       0.0        2.0

to:

	total time  =        0.08 secs   (4 ticks @ 20 ms)
	total alloc = 168,637,964 bytes  (excludes profiling overheads)

     cacheLedger                                     1   0.0    0.1       0.0       27.1
      sumTransactions                                0   0.0    0.3       0.0       18.8
       isZeroAmount                               3931   0.0    0.9       0.0       17.3
        showAmount                                3931   0.0    3.4       0.0       16.3
         showAmount'                              3931   0.0   12.9       0.0       12.9
         con2tag_Side#                            7884   0.0    0.0       0.0        0.0
       normaliseMixedAmount                       1964   0.0    0.8       0.0        1.3
        con2tag_Side#                               12   0.0    0.0       0.0        0.0
        sumAmountsPreservingPrice                 1970   0.0    0.1       0.0        0.5
         amountop                                 3793   0.0    0.2       0.0        0.4
          convertAmountTo                         3793   0.0    0.2       0.0        0.2
           conversionRate                         3793   0.0    0.0       0.0        0.0
2008-12-05 03:31:45 +00:00
Simon Michael
8bc078ff7b fix haddock error preventing docs update 2008-12-10 05:52:26 +00:00
Simon Michael
fdb45b8d9c make mixed amount adding and showing more robust 2008-12-05 04:36:32 +00:00
Simon Michael
063dce2642 more string utils 2008-12-06 07:15:19 +00:00
nick
4ea30b7411 Fixed ;-only bug 2008-12-08 07:20:29 +00:00
Simon Michael
130e3bcd30 utils tweaks 2008-12-10 07:08:50 +00:00
Simon Michael
da70e00e3b make fromparse utility show the parse error 2008-12-08 17:15:02 +00:00
nick
68682fa0ee Tilde expansion in !include 2008-12-10 17:40:05 +00:00
nick
600582184c Support for !account directives, and tests 2008-12-08 07:21:33 +00:00
nick
9b7a3689f5 !account affects timelog entries 2008-12-10 17:40:36 +00:00
tim
250c92f646 Support parsing of dates in yyyy-dd-mm format 2008-12-09 07:15:18 +00:00
Simon Michael
470cae55ca show clockin/out times in timelog entries, detect clockout < clockin 2008-12-11 01:35:07 +00:00
Simon Michael
614e6e6932 count timelog sessions on the day they end, like ledger, for now 2008-12-05 01:16:42 +00:00
tim
4bc97d237a Added support for reading historical prices from files 2008-12-16 10:54:20 +00:00
nick
5e0313e447 Added timelog entries to ledger and added useful utilities 2008-12-08 01:48:03 +00:00
Simon Michael
b51740e9bb optimise canonicaliseAmounts
First optimisation in a while. hledger -s bal on my ledger took 2s, and profiling showed:

	total time  =        0.66 secs   (33 ticks @ 20 ms)
	total alloc = 3,631,667,848 bytes  (excludes profiling overheads)

     canonicaliseAmounts                             1   0.0    0.8      69.7       92.4
      rawLedgerCommoditiesWithSymbol              3928  27.3   23.1      69.7       91.6
       rawLedgerCommodities                          0  18.2   18.7      42.4       68.5
        amounts                                7712628   3.0    0.0       3.0        0.0
        rawLedgerAmounts                             0   0.0    9.3      21.2       49.9
         rawLedgerTransactions                       0   9.1   19.5      21.2       40.5
          flattenEntry                         3408636  12.1   21.0      12.1       21.0

Now it takes 1/2s and the profile is healthier:

	total time  =        0.14 secs   (7 ticks @ 20 ms)
	total alloc = 275,520,536 bytes  (excludes profiling overheads)

     canonicaliseAmounts                             1   0.0    0.4       0.0        0.5
      amounts                                     1964   0.0    0.0       0.0        0.0
      rawLedgerTransactions                          0   0.0    0.1       0.0        0.1
       flattenEntry                                868   0.0    0.1       0.0        0.1
2008-12-05 02:09:19 +00:00
nick
0be862f760 Fixed TimeLog handling and certain blank lines 2008-12-08 03:45:35 +00:00
Simon Michael
3343e21ab1 work towards a fix for zero-balance root account eliding 2009-01-17 18:07:20 +00:00
Simon Michael
a51596899f a cached ledger now includes the full ledger text, also.
This reads the file twice, since I couldn't figure out how to do it just
once with the new error monad.. fixes welcome.
2008-12-10 07:29:08 +00:00
nick
ee4a2a1c1e New ledger parser with file inclusion 2008-12-08 01:49:31 +00:00
Simon Michael
ebdf67a5ab smart dates: also accept yyyymmdd with no separators 2009-01-17 20:07:24 +00:00
nick
91f3b7faac Abstract over all GenParser state types 2008-12-08 01:11:07 +00:00
Simon Michael
5a0156d5ee smart dates: work towards next/last monthname/weekdayname 2009-01-17 20:21:44 +00:00
Simon Michael
77098fec7e lowercase/uppercase 2008-11-27 06:32:31 +00:00
Simon Michael
0c4cf88578 perl-like strip 2008-11-26 21:11:44 +00:00
Simon Michael
f69716ddf9 fix reporting of unbalanced entries 2008-12-05 10:04:59 +00:00
Simon Michael
5e9f9e530a better register summarising with --depth and -E support, datespan splitting bugfix 2008-12-04 19:29:29 +00:00
Simon Michael
3699343318 fix the regexpr version fix, we really do require 0.5.1 2008-12-16 18:35:46 +00:00
Simon Michael
acbb669bcc fix a collision with latest regexpr package 2008-12-11 20:07:06 +00:00
Simon Michael
41a3fb91d5 support reporting intervals in period expressions and register report, and -W/-M/-D 2008-12-03 23:20:38 +00:00
Simon Michael
dd93418784 handle "from ... to ..." period expressions 2008-11-27 19:42:03 +00:00
Simon Michael
c3bec2a3de options cleanup 2008-11-27 06:48:46 +00:00
Simon Michael
57c31f5ab0 support basic --period expressions, containing a single smart date 2008-11-27 06:29:29 +00:00
Simon Michael
d25995c1c8 refactor with DateSpan 2008-11-27 04:31:01 +00:00
Simon Michael
630e22312b remove DateTime and Date types, use Day and UTCTime directly
This seems simplest for now, I might bring type synonyms back later.
2008-11-27 04:01:07 +00:00
Simon Michael
b7616562d9 this/last/next month/quarter/year 2008-11-27 02:49:22 +00:00
Simon Michael
7858ed1327 this/next/last day/week 2008-11-27 01:49:13 +00:00
Simon Michael
884ebf2979 gather date stuff together, FuzzyDate -> SmartDate 2008-11-27 00:35:00 +00:00
Simon Michael
52ab3372b8 add a regexp utility plus a dependency on regexpr, the sanest regexp library 2008-11-26 03:46:23 +00:00
tim
1ea8c6c9ee Added helper functions for current time and date 2008-11-25 21:30:21 +00:00
Simon Michael
e8a0d42906 cleanup 2008-11-26 22:15:22 +00:00
Simon Michael
8c56c3c4b3 refactoring date parsing, FuzzyDate 2008-11-26 23:21:24 +00:00
Simon Michael
49a84957a9 cleanup smartdate 2008-11-26 21:34:26 +00:00
Simon Michael
3e1a615dbf misc cleanup 2008-11-26 05:21:44 +00:00
Simon Michael
4d49177117 hacking in more date parsing.. today/tomorrow/yesterday 2008-11-26 04:51:15 +00:00
Simon Michael
6c88197c6a do IO date parsing up front, and support (english) month names 2008-11-26 04:04:05 +00:00
Simon Michael
1c60514973 tighten up date parsing, make it io-friendly and parse Y, M/D, D 2008-11-25 23:52:42 +00:00
Simon Michael
b3c0bba51e haddock fix 2008-11-24 00:14:11 +00:00
Simon Michael
dc007e69a5 --options-anywhere to use ^ for negative patterns and permit options anywhere in command-line 2008-11-25 19:29:33 +00:00
Simon Michael
4d53fac9a3 clean up special char definitions in AccountName.hs 2008-11-24 00:22:47 +00:00
Simon Michael
dfe59676fb support all five date comparisons in --display 2008-11-26 21:18:24 +00:00
Simon Michael
33b2deba75 correction, dates in display expressions should be in brackets 2008-11-25 18:47:26 +00:00
Simon Michael
0582046648 preliminary --display/-d support (-d "d>DATE", sufficient for reconciling) 2008-11-24 21:51:31 +00:00
Simon Michael
0ef22d5cf6 doc fix 2008-10-16 09:50:22 +00:00
Simon Michael
febcb381f2 comment 2008-10-18 06:49:40 +00:00
Simon Michael
64c6082c23 parse comment lines beginning with a space, as from M-; in emacs ledger-mode 2008-10-18 10:54:22 +00:00
Simon Michael
7879ca63ca haddock 2008-10-18 19:16:44 +00:00
Simon Michael
497daebd44 docs 2008-10-17 00:57:00 +00:00
Simon Michael
f40696fa47 small doc edits 2008-10-17 16:54:10 +00:00
Simon Michael
93ced249b3 commodity cleanup 2008-10-18 19:30:07 +00:00
tim
d04a8dcd00 Removed quickcheck import
It doesn't appear to be used, and isn't declared in the cabal file
2008-11-10 21:31:25 +00:00
Simon Michael
71667f654a rectangular string utilities 2008-11-22 09:06:44 +00:00
Simon Michael
a7384a9183 show mixed amounts vertically 2008-11-22 09:07:04 +00:00
Simon Michael
a49b9715ef allow extra whitespace and comments at end of ledger 2008-11-22 07:00:52 +00:00
Simon Michael
1607661b87 fix the print command 2008-11-22 06:35:10 +00:00
Simon Michael
4c97ca5514 smarter handling of priced amounts. Normalising and some basic arithmetic now preserve prices.
Currently, amounts with the same commodity but different prices are kept separate. Useful ?
2008-11-22 20:30:43 +00:00
Simon Michael
54ee68976b support converting amounts to cost, using their saved price.
And do this by default for auto-balancing transactions, as ledger seems to.
2008-11-22 20:32:58 +00:00
Simon Michael
54b164a7ab nullamt and nullmixedamt 2008-11-22 17:21:49 +00:00
Simon Michael
52ff46a326 --basis/-B flag, to show all priced amounts on cost basis. Also a --cost alias. 2008-11-22 20:35:17 +00:00
Simon Michael
2d49bc4100 haddock 2008-11-08 22:04:59 +00:00
Simon Michael
8939c1f7b7 samesymbol cleanup 2008-11-08 22:49:14 +00:00
Simon Michael
7362fbd730 begin smart date parsing 2008-11-22 12:18:19 +00:00
tim
60b4610c2f Fix bug in parsing of TimeLogs, and enabled a test case for them 2008-11-12 07:17:31 +00:00
Simon Michael
c46189a75b filter by account patterns when caching a ledger, fix balance report totals 2008-11-22 05:51:48 +00:00
Simon Michael
ea5a87815b rename setAmountDisplayPrefs to canonicaliseAmounts 2008-11-08 22:02:38 +00:00
tim
514f015849 Implemented types for dates and datetimes
This patch replaces the strings used in the Entry, TimeLogEntry, and Transaction
records with real types. Rather than use the inbuild system date and time types
directly, two custom types have been implemented that wrap UTCTime: Date and
DateTime. A minimal API for these has been added.
2008-11-11 12:34:05 +00:00
Simon Michael
a7b3e0d38d define nullentry, nullrawtxn 2008-11-08 20:25:51 +00:00
tim
3a35847aa1 Fix some signatures for functions that really take dates 2008-11-10 22:05:40 +00:00
Simon Michael
33f06f334e first attempt at storing per-amount price 2008-11-22 16:26:01 +00:00
Simon Michael
8e412b1be3 autoamt -> missingamt 2008-10-18 20:29:42 +00:00
Simon Michael
f3ba1eda0c amount cleanup 2008-10-18 20:27:25 +00:00
Simon Michael
0f2c8542fc if we happen to be showing a not-yet-auto-balanced entry, hide the AUTO marker 2008-10-16 03:55:38 +00:00
Simon Michael
47cf7c3eb6 gather match functions in one place 2008-11-22 05:48:56 +00:00
Simon Michael
83d36dae63 more tests cleanup, and start to move match functions to Utils 2008-11-22 04:44:12 +00:00
Simon Michael
96e0f70a38 use the greatest precision detected for a commodity, not the first one 2008-11-08 21:44:41 +00:00
Simon Michael
5c0ff1daa5 separate confusing "normalise" uses, begin to fix broken amount display prefs 2008-10-18 21:10:08 +00:00
Simon Michael
17ab6cb0ab support --real/-R flag 2008-10-16 09:50:16 +00:00
Simon Michael
57603db7b9 support -C/--cleared flag to filter by entry status (not transaction status) 2008-10-16 09:04:44 +00:00
Simon Michael
0b23598138 remove the hard-coded rate from Commodity 2008-10-18 10:46:49 +00:00
Simon Michael
80beac7d43 try making MixedAmount a full newtype, to avoid TypeSynonymInstances error 2008-10-18 10:38:01 +00:00
Simon Michael
2d41368b8b introduce MixedAmount 2008-10-17 00:57:10 +00:00
Simon Michael
f865ab1c1c code cleanups 2008-10-18 00:52:49 +00:00
Simon Michael
db8b00d6e5 doc update 2008-10-16 03:27:43 +00:00
Simon Michael
cc81700d2a normalise amounts after adding them, why not 2008-10-18 09:02:00 +00:00
Simon Michael
ebcf695240 simplify, remove dead code 2008-10-18 09:02:19 +00:00
Simon Michael
648887b36f use MixedAmount everywhere. seems to work. 2008-10-18 08:39:08 +00:00
Simon Michael
4f83326f14 display virtual accounts with appropriate brackets in register report 2008-10-16 06:12:40 +00:00
Simon Michael
c444b02349 a first cut at mixed amounts. Accounts have a MixedAmount balance, displayed on one line 2008-10-17 03:14:23 +00:00
Simon Michael
d31ba41703 rename and unify the autofill stuff 2008-10-18 06:45:02 +00:00
Simon Michael
a304ad3ca6 and more code cleanups. 2008-10-18 04:15:43 +00:00
Simon Michael
861e2beb1c clearer error message when we can't balance an entry 2008-10-16 04:00:45 +00:00
Simon Michael
0cfbced165 and allow parsing of mixed-commodity entries, as long as we don't have to balance them 2008-10-17 03:32:00 +00:00
Simon Michael
17ceb9039b rename sumLedgerTransactions 2008-10-16 08:48:25 +00:00
Simon Michael
405f71c389 ignore virtual transactions when auto-balancing 2008-10-16 06:52:35 +00:00
Simon Michael
9acf11de4d when we fail because of more than one missing amount in an entry, show the full entry 2008-10-16 03:56:43 +00:00
Simon Michael
a1d10691a3 more code cleanups 2008-10-18 02:43:13 +00:00
Simon Michael
dce8fd0dde parse virtual and balanced virtual transactions, refactor register and transaction output 2008-10-16 06:00:46 +00:00
Simon Michael
014723497f allow any non-whitespace in account names, perhaps avoiding misleading missing amounts errors 2008-10-16 04:17:25 +00:00
Simon Michael
490a81577f make patterns case-insensitive 2008-10-15 22:18:20 +00:00
Simon Michael
ba67e4c0a9 remove dead code 2008-10-15 22:18:05 +00:00
Simon Michael
4679003b83 for debugging 2008-10-15 21:10:59 +00:00
Simon Michael
5f1bec0b60 fix the always-on thousands comma 2008-10-15 19:54:35 +00:00
Simon Michael
ea2a418811 fix a bug in commodity detection 2008-10-15 19:28:36 +00:00
Simon Michael
529393ae49 ledger 2.6-style account name eliding 2008-10-15 19:14:34 +00:00
Simon Michael
7dea3bc201 hide the assets:time account in timelog reports 2008-10-15 19:11:06 +00:00
Simon Michael
3bcc3277ac the parser was too strict about decimal places when balance-checking 2008-10-15 18:01:49 +00:00
Simon Michael
5fcab59414 support negative patterns and ledger's special balance report account matching rule 2008-10-15 17:04:47 +00:00
Simon Michael
3dca1ca548 make isZeroAmount more robust, fix timelog balance total 2008-10-15 07:06:02 +00:00
Simon Michael
f99963786c require a balanced entry to have just one commodity, for now 2008-10-15 07:00:47 +00:00
Simon Michael
3138046744 clarify entry balance checking and show the full entry when unbalanced 2008-10-15 06:47:47 +00:00
Simon Michael
9f341b0279 make show entry more useful 2008-10-15 06:47:00 +00:00
Simon Michael
1e3291af48 focus on tests in Tests.hs, clean up 2008-10-15 06:32:52 +00:00
Simon Michael
7a69efec70 match full account name when (any) account pattern contains :, as ledger seems to 2008-10-15 06:32:42 +00:00
Simon Michael
760befef89 more cleanups 2008-10-15 06:00:10 +00:00
Simon Michael
8d70ed87ea small cleanups 2008-10-15 02:11:30 +00:00
Simon Michael
3dc5f54f39 display thousands with commas when appropriate 2008-10-15 01:06:05 +00:00
Simon Michael
aac492c746 rename amount show functions 2008-10-15 00:37:38 +00:00
Simon Michael
782d05aa61 use the display settings of the first amount detected in each commodity 2008-10-15 00:34:02 +00:00
Simon Michael
b1e2a83556 comment update 2008-10-15 00:33:15 +00:00
Simon Michael
042a8179e8 always give a proper parse error for numbers, remember precisions and thousands separators
(per amount for now)
2008-10-14 23:14:31 +00:00
Simon Michael
4efdda25b4 replace Currency with a more flexible, ledger-style Commodity 2008-10-12 21:52:48 +00:00
Simon Michael
80ef214f79 nicer ghci/repl usage, update docs 2008-10-12 09:17:21 +00:00
Simon Michael
a9f021eebe slightly less verbose Show Ledger 2008-10-12 09:16:04 +00:00
Simon Michael
01cd388c24 remove dead code, simplify cacheLedger again 2008-10-12 07:46:54 +00:00
Simon Michael
ce3eeb80b6 consolidate register command code, make it do filtering 2008-10-12 07:34:00 +00:00
Simon Michael
c07c149378 type signatures 2008-10-12 06:10:32 +00:00
Simon Michael
35376cfd9b more informative Show Account 2008-10-12 05:07:19 +00:00
Simon Michael
9b51d922dd more utilities 2008-10-11 04:18:26 +00:00
Simon Michael
2ff9c21b95 more account queries 2008-10-11 04:17:52 +00:00
Simon Michael
2cef939da1 rename accounts/filteraccounts fields to accountmap/filteraccountmap 2008-10-10 22:28:10 +00:00
Simon Michael
3458d1f379 more utils, Control.Monad 2008-10-10 11:52:15 +00:00
Simon Michael
d172cd0d6e a more compact showtree 2008-10-10 11:11:55 +00:00
Simon Michael
9b5a35b5d2 assertnotequal 2008-10-10 11:11:49 +00:00
Simon Michael
37e75d610e more tests cleanup.. prepare for per-module tests, but consolidate in Tests where I think we will stay 2008-10-10 08:16:55 +00:00
Simon Michael
d98643a364 tests cleanup 2008-10-10 07:39:20 +00:00
Simon Michael
d1dfcafc39 move entry filter functions to RawLedger 2008-10-10 04:23:25 +00:00
Simon Michael
67c203f316 move commands to top-level modules, make Ledger pure (except for Parse) 2008-10-10 03:32:12 +00:00