2010-11-13 02:54:21 +03:00
|
|
|
# a default commodity defined with the D directive will be used for any
|
look harder for decimal point & digit groups (fixes #196)
Amount display styles have been reworked a bit; they are now calculated
after journal parsing, not during it. This allows the fix for #196:
we now search through the amounts until a decimal point is detected,
instead of just looking at the first one; likewise for digit groups.
Digit groups are now implemented with a better type.
Digit group size detection has been improved a little:
1000,000 now gives group sizes [3,4,4,...], not [3,3,...], and
10,000 gives groups sizes [3,3,...] not [3,2,2,..].
(To get [3,2,2,...] you'd use eg 00,00,000.)
There are still some old (or new ?) issues; I don't think we handle
inconsistent decimal points & digit groups too well. But for now all
tests pass.
2014-07-03 10:26:16 +04:00
|
|
|
# subsequent commodity-less posting amounts. The sample amount's display style
|
|
|
|
# is also applied, and the resulting amount may end up setting the canonical
|
|
|
|
# display style for the commodity.
|
2011-09-23 02:23:28 +04:00
|
|
|
|
|
|
|
# 1. no default commodity
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f- print
|
2010-11-13 02:54:21 +03:00
|
|
|
<<<
|
2011-09-23 02:23:28 +04:00
|
|
|
2010/1/1
|
2010-11-13 02:54:21 +03:00
|
|
|
a 1000
|
|
|
|
b
|
2011-09-23 02:23:28 +04:00
|
|
|
>>>
|
|
|
|
2010/01/01
|
|
|
|
a 1000
|
|
|
|
b -1000
|
2010-11-13 02:54:21 +03:00
|
|
|
|
2011-09-23 02:23:28 +04:00
|
|
|
>>>=0
|
2010-11-13 02:54:21 +03:00
|
|
|
|
2011-09-23 02:23:28 +04:00
|
|
|
# 2. pound, two decimal places, no digit group separator
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f- print
|
2011-09-23 02:23:28 +04:00
|
|
|
<<<
|
|
|
|
D £1000.00
|
|
|
|
2010/1/1
|
2010-11-13 02:54:21 +03:00
|
|
|
a 1000
|
|
|
|
b
|
2011-09-23 02:23:28 +04:00
|
|
|
>>>
|
|
|
|
2010/01/01
|
|
|
|
a £1000.00
|
|
|
|
b £-1000.00
|
2010-11-13 02:54:21 +03:00
|
|
|
|
2011-09-23 02:23:28 +04:00
|
|
|
>>>=0
|
2010-11-13 02:54:21 +03:00
|
|
|
|
2011-09-23 02:23:28 +04:00
|
|
|
# 3. dollar, comma decimal point, three decimal places, no digit group separator
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f- print
|
2011-09-23 02:23:28 +04:00
|
|
|
<<<
|
|
|
|
D $1,000
|
|
|
|
2010/1/1
|
2010-11-13 02:54:21 +03:00
|
|
|
a 1000
|
|
|
|
b
|
2011-09-23 02:23:28 +04:00
|
|
|
>>>
|
|
|
|
2010/01/01
|
|
|
|
a $1000,000
|
|
|
|
b $-1000,000
|
2010-11-13 02:54:21 +03:00
|
|
|
|
2011-09-23 02:23:28 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 4. dollar, three digit group separator, one decimal place
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f- print
|
2011-09-23 02:23:28 +04:00
|
|
|
<<<
|
|
|
|
D $1,000.0
|
|
|
|
2010/1/1
|
|
|
|
(a) 1000000
|
2010-11-13 02:54:21 +03:00
|
|
|
>>>
|
2011-09-23 02:23:28 +04:00
|
|
|
2010/01/01
|
|
|
|
(a) $1,000,000.0
|
2010-11-13 02:54:21 +03:00
|
|
|
|
2011-09-23 02:23:28 +04:00
|
|
|
>>>=0
|
2010-11-13 02:54:21 +03:00
|
|
|
|
look harder for decimal point & digit groups (fixes #196)
Amount display styles have been reworked a bit; they are now calculated
after journal parsing, not during it. This allows the fix for #196:
we now search through the amounts until a decimal point is detected,
instead of just looking at the first one; likewise for digit groups.
Digit groups are now implemented with a better type.
Digit group size detection has been improved a little:
1000,000 now gives group sizes [3,4,4,...], not [3,3,...], and
10,000 gives groups sizes [3,3,...] not [3,2,2,..].
(To get [3,2,2,...] you'd use eg 00,00,000.)
There are still some old (or new ?) issues; I don't think we handle
inconsistent decimal points & digit groups too well. But for now all
tests pass.
2014-07-03 10:26:16 +04:00
|
|
|
# 5. commodity and display style applied to the second posting amount..
|
|
|
|
# which ends up setting the digit group style, since it's the first amount
|
|
|
|
# with digit groups. The great precision is used.
|
2012-10-21 22:23:23 +04:00
|
|
|
hledgerdev -f- print
|
2011-09-23 02:23:28 +04:00
|
|
|
<<<
|
|
|
|
D $1,000.0
|
|
|
|
2010/1/1
|
|
|
|
(a) $1000000.00
|
|
|
|
(b) 1000000
|
|
|
|
>>>
|
|
|
|
2010/01/01
|
|
|
|
(a) $1,000,000.00
|
|
|
|
(b) $1,000,000.00
|
2010-11-13 02:54:21 +03:00
|
|
|
|
2011-08-15 02:15:39 +04:00
|
|
|
>>>=0
|
2011-09-23 02:23:28 +04:00
|
|
|
|