Commit Graph

297 Commits

Author SHA1 Message Date
Simon Michael
5c09553481 lib: keep amounts aligned when rendering a transaction with posting flags
Related to #563, when rendering a transaction, we reserve two more chars
of width so that amounts remain aligned when there are posting flags.
Affects hledger-ui's transaction screen, print, hledger-rewrite etc.
2017-06-04 21:26:18 -07:00
Simon Michael
1adc636554 lib: show pending posting flags when rendering a transaction (fix #563)
This affects hledger-ui's transaction screen, print, hledger-rewrite etc.
A pending flag on postings is now displayed, just like a cleared flag.
Also there will now be a space between flag and account name.
And it's slightly better at aligning amounts, due to now considering
virtual posting parentheses/brackets or something.
2017-06-04 17:54:57 -07:00
Simon Michael
cd70bb1a86 disable not-yet-implemented test that was breaking travis (#551) 2017-06-04 14:51:25 -07:00
Simon Michael
4f712754e4 lib: test for #551 2017-05-30 13:57:52 -07:00
Christian G. Warden
d39040c634 Add Support for Rewriting Multipler Postings Into Different Commodities (#557)
When generating a new posting as a multiple of an existing posting,
support conversion to a different commodity.  For example, postings in
hours can be used to generate postings in USD.

Automatic transactions generated from rewrite rules use the commodity,
amount style, and transaction price if the rewrite defines a commodity.
2017-05-30 07:30:15 -07:00
Simon Michael
a6c2f0697d tests: make cashflow.test compatible with released shelltestrunner 2017-05-24 15:46:00 -07:00
Nicolas Wavrant
309d1ccd59 CsvReader: simplify '-' signs if there exist more than one (#548)
It prevents hledger to crash later, as it fails to read
amount strings containing more than one '-'

Fix #524
2017-05-14 09:34:33 +09:00
Simon Michael
02eb809348 timeclock: comment out unfinished tests 2017-04-25 18:56:38 -07:00
Simon Michael
1af0f66e73 lib: timeclock test notes 2017-04-25 12:04:39 -07:00
Dmitry Astapov
c4c4be5fad Fix parsing of blank/empty balances + testcases (#539) 2017-04-18 09:07:30 -07:00
Dmitry Astapov
451f9d7307 "balance" parser for csv reader (#537)
* "balance" parser for csv reader

* Some docs for
2017-04-14 14:52:03 -07:00
Simon Michael
e50dede708 cashflow: make totals row and -N more like balance/bs/is (#518) 2017-03-31 16:39:47 -07:00
Simon Michael
b82e800ae6 bs/cf/is: fix subtitle appearing above total (and put on one line) (#527) 2017-03-30 17:18:30 -07:00
Justin Le
ac68ae1349 simple functional tests for multicolumn modes for is/bs/cf 2017-03-30 15:35:04 -07:00
Moritz Kiefer
f4b3f1c094 Add an option to use unicode in balance tables (#528)
* Add an option to use unicode in balance tables

fixes #522

* Add a test for unicode tables

* Document --pretty-tables

* Support --pretty-tables in BalanceView
2017-03-29 11:12:01 -07:00
Simon Michael
7d0734f1ed update addons tests, note a todo 2017-03-29 08:21:30 -07:00
Simon Michael
5d2f9d742a test: cli: test stderr for more verbose failures 2017-03-29 06:40:39 -07:00
Simon Michael
895a66eb06 cli: first of several cleanups; separate commands list & usage (#297) 2017-03-28 18:44:34 -07:00
Simon Michael
5a7f74c6ff tests: use compiled addons in func tests, much quicker 2017-03-28 18:43:14 -07:00
Simon Michael
863989e0e7 print: bring back the short -x form of --explicit (#442) 2017-03-27 05:17:35 -07:00
Joshua Kehn
4f00925ad5 [TEST] Add balance/cashflow/incomestatement shelltest
These pass the current version of hledger available on homebrew and
cover the bug reported in #514 and fixed in #515.
2017-03-20 10:04:28 -04:00
Mykola Orliuk
0a8212bda3 equity: generate assertions 2017-01-25 14:45:54 -08:00
Mykola Orliuk
f3cb32a56f prices: new addon (#486) 2017-01-25 11:50:54 -08:00
Mykola Orliuk
d5c2ed4fa7 budget: bucketing 2017-01-20 13:42:17 -08:00
Mykola Orliuk
3a632acea0 budget: periodic transactions support 2017-01-20 13:42:17 -08:00
Mykola Orliuk
2d9259ab3a budget: new addon 2017-01-20 13:42:17 -08:00
Mykola Orliuk
7437c96ff6 Make hledger-rewrite tool suitable for re-factoring original journals (#490)
* cli: fix bug in pivot for postings without tag

Without this fix for postings without tag query checked effective
account which is always empty text ("").

* rewrite: inherit dates, change application order

For budgeting it is important to inherit actual date of posting if it
differs from date of transaction. These dates will be added
as a separate line of comment.

More natural order of rewrites is when result of first defined one is
available for all next rewrites.

* rewrite: factor out Hledger.Data.AutoTransaction

* rewrite: add diff output

With this option you can modify your original files without loosing
inter-transaction comments etc. I.e. you can run:

hledger-rewrite --diff Agency \
  --add-posting 'Expenses:Taxes  *0.17' \
  | patch

As result multiple files should be updated.
Also it is nice to review your changes using colordiff instead of
patch.

* lib: track source lines range for journal

* doc: auto entries and diff output for rewrite
2017-01-20 07:33:24 -08:00
Mykola Orliuk
295af41f38 cli: fix bug in pivot for postings without tag (#491)
Without this fix for postings without tag query checked effective
account which is always empty text ("").
2017-01-19 07:53:00 -08:00
Simon Michael
39662260cd cli: use a blank acct name for postings without the specified pivot tag
Eg. if you --pivot code, postings from transactions with no code value
were formerly displayed with the unpivoted account name, so you'd see
a mixture of account names and codes. Now we always pivot the account name,
to blank if nothing else. This probably makes reports pretty ugly, it's just another
step towards making --pivot's behaviour clearer.
2017-01-13 14:06:23 -08:00
Mykola Orliuk
8954944ee6 Apply ModifierTransaction's from journal during hledger-rewrite. (#477)
* rewrite: rewrite every posting

Also start using ModifierTransaction

* rewrite: use journal parser for postings

* rewrite: use ModifierTransactions from Journal

See simonmichael/hledger#99
2017-01-13 12:41:16 -08:00
Mykola Orliuk
fabd6b450a Update tests to match current pivot effect (#476) 2017-01-13 11:53:06 -08:00
Mykola Orliuk
76867c98a3 Feature/pivot implicit tags (#460)
* Add implicit tags code/desc/payee for --pivot

Additionally allow using of transaction inherited tags.

* Use original posting in query by account name

To be able to query on individual postings and by account name it is
useful to have access to original account name (before pivot).
Especially this is useful when all postings within transaction gets
the same pivot name due.
As a side effect we'll match by alias.

Note: to query on amt it usually expected to see matches with inferred
amounts.
2017-01-13 08:02:11 -08:00
Mykola Orliuk
015b764d00 Preserve implicit amounts and prices the way user wrote them in output of print command (#471)
* Remember original postings during infer and pivot

This includes such functions like:
- inferFromAssignment
- inferBalancingAmount
- inferBalancingPrices
- pivotPosting

* Use original postings for hledger print

- Introduce "--explicit" option for "print" command which brings back
  old behavior when every inferred number being printed.
- Make "print" by default print original postings without inferred
  amounts. But use effective account name to have effect from aliases.
- Instruct shell tests with an new expected output or to use
  --explicit option when inferred amounts are checked.

Resolves simonmichael/hledger#442
2017-01-13 07:25:44 -08:00
Nikolay Orlyuk
c0d12f5d1c Normalize amount in infereBalancingAmount (#469)
This fixes issue exposed by a fix for simonmichael/hledger#465
2017-01-11 12:09:07 -08:00
Nikolay Orlyuk
ea7a7d78aa Strip prices for equity report (#468)
Fixes simonmichael/hledger#467
2017-01-11 07:53:01 -08:00
Nikolay Orlyuk
32d9365fc2 Ensure showTransaction produce a valid journal (#466)
- Make output of print to be a valid journal
- Partially reverts 419f5f2a2

Fixes simonmichael/hledger#465
2017-01-10 20:44:10 -08:00
Simon Michael
34ec7406a1 move add-ons and scripts to bin/ 2017-01-08 07:28:23 -08:00
Simon Michael
3ae8712bbc rename data/ to examples/ 2017-01-08 07:26:13 -08:00
Mykola Orliuk
44538cce57 extra: tests for equity and rewrite 2017-01-05 16:06:21 -08:00
Simon Michael
a5992c38a8 update market price tests #403 #453 2016-12-30 14:36:27 -08:00
Simon Michael
fe58ef7946 lib: fix typo breaking tests (#438) 2016-12-10 07:13:17 -08:00
Johannes Gerer
45401e538e Balance Assignments and accounts resetting (#438)
* Changed behavior of `readJournalFiles` to be identical to `readJournalFile` for singleton lists

* Balance Assertions have to be simple Amounts

* Add 'isAssignment' and 'assignmentPostings' to Hledger.Data.Posting and Transaction

* Implemented 'balanceTransactionUpdate', a more general version of 'balanceTransaction' that takes an update function

* Fixed test cases.

* Implemented balance assignment ("resetting a balance")

* Add assertions to show function

* updated the comments

* numbering is not needed in journalCheckBalanceAssertions

* remove prices before balance checks

* rename functions
2016-12-10 07:04:48 -08:00
Johannes Gerer
74502f7e50 more general parser types enabling reuse outside of IO (#439) 2016-12-09 15:57:17 -08:00
Simon Michael
97ef9d621c disable failing test #415 2016-10-21 17:50:47 -07:00
Simon Michael
cf71a803f9 csv: add a failing test for #415 2016-10-08 15:20:26 -10:00
Simon Michael
18bed45e1a bal: draft some tests for #373 2016-09-21 09:34:01 -07:00
Simon Michael
5ea088d1ca bs,is,cf: add functional tests, fix bs infinite loop #393 2016-08-13 07:47:43 -07:00
Simon Michael
c1ddbfc08a drop unusual "d" suffix when showing a day period 2016-08-11 11:23:05 -07:00
Moritz Kiefer
4141067428 Replace Parsec with Megaparsec (see #289) (#366)
* Replace Parsec with Megaparsec (see #289)

This builds upon PR #289 by @rasendubi

* Revert renaming of parseWithState to parseWithCtx

* Fix doctests

* Update for Megaparsec 5

* Specialize parser to improve performance

* Pretty print errors

* Swap StateT and ParsecT

This is necessary to get the correct backtracking behavior, i.e. discard
state changes if the parsing fails.
2016-07-29 08:57:10 -07:00
Simon Michael
6ec4426edd journal: fix balance assertion test 2016-07-06 15:22:29 -07:00