parsing: timelog entries now generate balanced transactions, using virtual postings

This commit is contained in:
Simon Michael 2010-05-23 18:54:14 +00:00
parent be30aac3f5
commit 65cf381dbc
3 changed files with 9 additions and 10 deletions

View File

@ -87,9 +87,7 @@ entryFromTimeLogInOut i o
hrs = elapsedSeconds (toutc otime) (toutc itime) / 3600 where toutc = localTimeToUTC utc hrs = elapsedSeconds (toutc otime) (toutc itime) / 3600 where toutc = localTimeToUTC utc
amount = Mixed [hours hrs] amount = Mixed [hours hrs]
ps = [Posting{pstatus=False,paccount=acctname,pamount=amount, ps = [Posting{pstatus=False,paccount=acctname,pamount=amount,
pcomment="",ptype=RegularPosting,ptransaction=Just t} pcomment="",ptype=VirtualPosting,ptransaction=Just t}]
--,Posting "assets:time" (-amount) "" RegularPosting
]
tests_TimeLog = TestList [ tests_TimeLog = TestList [

View File

@ -6,8 +6,8 @@ i 2010/1/1 09:00:00 a:b
o 2010/1/1 09:03:00 o 2010/1/1 09:03:00
>>>=0 >>>=0
# incidentally this didn't trigger it.. go figure # incidentally this didn't trigger it.. go figure
bin/hledger -f - balance #bin/hledger -f - balance
<<< #<<<
i 2010/1/1 09:00:00 a:b #i 2010/1/1 09:00:00 a:b
o 2010/1/1 09:02:00 #o 2010/1/1 09:02:00
>>>=0 #>>>=0

View File

@ -1,10 +1,11 @@
# a timelog session is parsed as a similarly-named transaction with one virtual posting
bin/hledger -f - print bin/hledger -f - print
<<< <<<
i 2009/1/1 08:00:00 x i 2009/1/1 08:00:00 something
o 2009/1/1 09:00:00 o 2009/1/1 09:00:00
>>> >>>
2009/01/01 * 08:00-09:00 2009/01/01 * 08:00-09:00
x 1.0h (something) 1.0h
>>>2 >>>2