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.
This commit is contained in:
		
							parent
							
								
									1adc636554
								
							
						
					
					
						commit
						5c09553481
					
				| @ -216,8 +216,8 @@ postingAsLines elideamount onelineamounts ps p = concat [ | ||||
|     assertion = maybe "" ((" = " ++) . showAmountWithZeroCommodity) $ pbalanceassertion p | ||||
|     statusandaccount = indent $ fitString (Just $ minwidth) Nothing False True $ pstatusandacct p | ||||
|         where | ||||
|           -- pad to the maximum account name width, to keep amounts aligned   | ||||
|           minwidth = maximum $ map (textWidth . T.pack . pacctstr) ps | ||||
|           -- pad to the maximum account name width, plus 2 to leave room for status flags, to keep amounts aligned   | ||||
|           minwidth = maximum $ map ((2+) . textWidth . T.pack . pacctstr) ps | ||||
|           pstatusandacct p' = pstatusprefix p' ++ pacctstr p' | ||||
|           pstatusprefix p' | null s    = "" | ||||
|                            | otherwise = s ++ " " | ||||
|  | ||||
| @ -21,15 +21,15 @@ | ||||
|     assets:cash | ||||
| >>> | ||||
| 2016/12/31 closing balances | ||||
|     assets:bank                      $-80 = $0 | ||||
|     assets:cash                      $-10 = $0 | ||||
|     liabilities                      $-25 = $0 | ||||
|     assets:bank                        $-80 = $0 | ||||
|     assets:cash                        $-10 = $0 | ||||
|     liabilities                        $-25 = $0 | ||||
|     equity:closing balances | ||||
| 
 | ||||
| 2017/01/01 opening balances | ||||
|     assets:bank                       $80 = $80 | ||||
|     assets:cash                       $10 = $10 | ||||
|     liabilities                       $25 = $25 | ||||
|     assets:bank                         $80 = $80 | ||||
|     assets:cash                         $10 = $10 | ||||
|     liabilities                         $25 = $25 | ||||
|     equity:opening balances | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -59,13 +59,13 @@ Y2016 | ||||
| 	liabilities:employer | ||||
| >>> | ||||
| 2016/12/31 closing balances | ||||
|     assets:bank              -5,733.00 EUR = 0.00 EUR | ||||
|     liabilities:employer         -1.00 EUR = 0.00 EUR | ||||
|     assets:bank                -5,733.00 EUR = 0.00 EUR | ||||
|     liabilities:employer           -1.00 EUR = 0.00 EUR | ||||
|     equity:closing balances | ||||
| 
 | ||||
| 2017/01/01 opening balances | ||||
|     assets:bank               5,733.00 EUR = 5,733.00 EUR | ||||
|     liabilities:employer          1.00 EUR = 1.00 EUR | ||||
|     assets:bank                 5,733.00 EUR = 5,733.00 EUR | ||||
|     liabilities:employer            1.00 EUR = 1.00 EUR | ||||
|     equity:opening balances | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -91,13 +91,13 @@ Y2016 | ||||
|     assets:cash | ||||
| >>> | ||||
| 2016/12/31 closing balances | ||||
|     assets:bank                       $20 = $0 | ||||
|     assets:cash                      $-15 = $0 | ||||
|     assets:bank                         $20 = $0 | ||||
|     assets:cash                        $-15 = $0 | ||||
|     equity:closing balances | ||||
| 
 | ||||
| 2017/01/01 opening balances | ||||
|     assets:bank                      $-20 = $-20 | ||||
|     assets:cash                       $15 = $15 | ||||
|     assets:bank                        $-20 = $-20 | ||||
|     assets:cash                         $15 = $15 | ||||
|     equity:opening balances | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -13,14 +13,14 @@ | ||||
|     assets:bank | ||||
| >>> | ||||
| 2016/01/01 paycheck | ||||
|     income:remuneration         $-100 | ||||
|     income:donations             $-15 | ||||
|     income:remuneration           $-100 | ||||
|     income:donations               $-15 | ||||
|     assets:bank | ||||
|     (liabilities:tax)            $-33    ; income tax | ||||
|     (liabilities:tax)             $-5    ; income tax | ||||
|     (liabilities:tax)              $-33    ; income tax | ||||
|     (liabilities:tax)               $-5    ; income tax | ||||
| 
 | ||||
| 2016/01/01 withdraw | ||||
|     assets:cash           $20 | ||||
|     assets:cash             $20 | ||||
|     assets:bank | ||||
| 
 | ||||
| >>>2 | ||||
| @ -38,13 +38,13 @@ | ||||
|     expenses:gifts  ; [1/2] | ||||
| >>> | ||||
| 2016/01/01 withdraw | ||||
|     assets:cash           $20 | ||||
|     assets:cash             $20 | ||||
|     assets:bank | ||||
| 
 | ||||
| 2016/01/01 gift | ||||
|     assets:cash             $-15 | ||||
|     expenses:gifts      ; [1/2] | ||||
|     (budget:gifts)          $-15    ; [2016/01/02] | ||||
|     assets:cash               $-15 | ||||
|     expenses:gifts        ; [1/2] | ||||
|     (budget:gifts)            $-15    ; [2016/01/02] | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -53,13 +53,13 @@ | ||||
| ../../bin/hledger-rewrite -f- | ||||
| <<< | ||||
| 2017/04/24 * 09:00-09:25 | ||||
|     (assets:unbilled:client1)         0.42h | ||||
|     (assets:unbilled:client1)           0.42h | ||||
| 
 | ||||
| 2017/04/25 * 10:00-11:15 | ||||
|     (assets:unbilled:client1)         1.25h | ||||
|     (assets:unbilled:client1)           1.25h | ||||
| 
 | ||||
| 2017/04/25 * 14:00-15:32 | ||||
|     (assets:unbilled:client2)         1.54h | ||||
|     (assets:unbilled:client2)           1.54h | ||||
| 
 | ||||
| ; billing rules | ||||
| = ^assets:unbilled:client1 | ||||
| @ -69,16 +69,16 @@ | ||||
|   (assets:to bill:client2)   *150.00 CAD | ||||
| >>> | ||||
| 2017/04/24 * 09:00-09:25 | ||||
|     (assets:unbilled:client1)         0.42h | ||||
|     (assets:to bill:client1)      42.00 CAD | ||||
|     (assets:unbilled:client1)           0.42h | ||||
|     (assets:to bill:client1)        42.00 CAD | ||||
| 
 | ||||
| 2017/04/25 * 10:00-11:15 | ||||
|     (assets:unbilled:client1)         1.25h | ||||
|     (assets:to bill:client1)     125.00 CAD | ||||
|     (assets:unbilled:client1)           1.25h | ||||
|     (assets:to bill:client1)       125.00 CAD | ||||
| 
 | ||||
| 2017/04/25 * 14:00-15:32 | ||||
|     (assets:unbilled:client2)         1.54h | ||||
|     (assets:to bill:client2)     231.00 CAD | ||||
|     (assets:unbilled:client2)           1.54h | ||||
|     (assets:to bill:client2)       231.00 CAD | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -106,18 +106,18 @@ | ||||
|   income:consulting:client2 | ||||
| >>> | ||||
| 2017/04/24 * 09:00-09:25 | ||||
|     (assets:unbilled:client1)         0.42h | ||||
|     assets:to bill:client1           $42.00 | ||||
|     (assets:unbilled:client1)           0.42h | ||||
|     assets:to bill:client1             $42.00 | ||||
|     income:consulting:client1 | ||||
| 
 | ||||
| 2017/04/25 * 10:00-11:15 | ||||
|     (assets:unbilled:client1)         1.25h | ||||
|     assets:to bill:client1          $125.00 | ||||
|     (assets:unbilled:client1)           1.25h | ||||
|     assets:to bill:client1            $125.00 | ||||
|     income:consulting:client1 | ||||
| 
 | ||||
| 2017/04/25 * 14:00-15:32 | ||||
|     (assets:unbilled:client2)         1.54h | ||||
|     assets:to bill:client2          $231.00 | ||||
|     (assets:unbilled:client2)           1.54h | ||||
|     assets:to bill:client2            $231.00 | ||||
|     income:consulting:client2 | ||||
| 
 | ||||
| >>>2 | ||||
| @ -140,16 +140,16 @@ | ||||
| #     assets:bank | ||||
| >>> | ||||
| 2016/01/01 withdraw | ||||
|     assets:cash            $20 | ||||
|     assets:cash              $20 | ||||
|     assets:bank | ||||
|     expenses:fee            $5 | ||||
|     assets:bank            $-5 | ||||
|     expenses:fee              $5 | ||||
|     assets:bank              $-5 | ||||
| 
 | ||||
| 2016/01/02 withdraw | ||||
|     assets:cash | ||||
|     assets:bank           $-30 | ||||
|     expenses:fee            $5 | ||||
|     assets:bank            $-5 | ||||
|     assets:bank             $-30 | ||||
|     expenses:fee              $5 | ||||
|     assets:bank              $-5 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -189,62 +189,62 @@ | ||||
|     (budget:misc)  *-1 | ||||
| >>> | ||||
| 2016/12/31 | ||||
|     expenses:housing       $600.00 | ||||
|     expenses:housing         $600.00 | ||||
|     assets:cash | ||||
| 
 | ||||
| 2017/01/01 | ||||
|     expenses:food           $20.00 | ||||
|     expenses:leisure        $15.00 | ||||
|     expenses:grocery        $30.00 | ||||
|     expenses:food             $20.00 | ||||
|     expenses:leisure          $15.00 | ||||
|     expenses:grocery          $30.00 | ||||
|     assets:cash | ||||
|     Here comes Santa             0 | ||||
|     Here comes Santa             0 | ||||
|     Here comes Santa             0 | ||||
|     Here comes Santa             0 | ||||
|     (budget:food)          $-20.00 | ||||
|     (budget:food)          $-30.00 | ||||
|     (budget:misc)          $-15.00 | ||||
|     Here comes Santa               0 | ||||
|     Here comes Santa               0 | ||||
|     Here comes Santa               0 | ||||
|     Here comes Santa               0 | ||||
|     (budget:food)            $-20.00 | ||||
|     (budget:food)            $-30.00 | ||||
|     (budget:misc)            $-15.00 | ||||
| 
 | ||||
| 2017/01/02 | ||||
|     assets:cash            $200.00 | ||||
|     assets:cash              $200.00 | ||||
|     assets:bank | ||||
|     Here comes Santa             0 | ||||
|     Here comes Santa             0 | ||||
|     assets:bank             $-1.60 | ||||
|     expenses:fee             $1.60    ; cash withdraw fee | ||||
|     (budget:misc)           $-1.60 | ||||
|     Here comes Santa               0 | ||||
|     Here comes Santa               0 | ||||
|     assets:bank               $-1.60 | ||||
|     expenses:fee               $1.60    ; cash withdraw fee | ||||
|     (budget:misc)             $-1.60 | ||||
| 
 | ||||
| 2017/02/01 | ||||
|     assets:cash       $100.00 | ||||
|     assets:cash         $100.00 | ||||
|     assets:bank | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| 
 | ||||
| # Rewrite using diff output | ||||
| ../../bin/hledger-rewrite --diff -f- assets:bank and 'amt:<0' --add-posting 'expenses:fee  $5'  --add-posting 'assets:bank  $-5' | ||||
| ../../bin/hledger-rewrite.hs --diff -f- assets:bank and 'amt:<0' --add-posting 'expenses:fee  $5'  --add-posting 'assets:bank  $-5' | ||||
| <<< | ||||
| 2016/01/01 withdraw | ||||
|     assets:cash            $20 | ||||
|     assets:cash              $20 | ||||
|     assets:bank | ||||
| 
 | ||||
| 2016/01/02 withdraw | ||||
|     assets:cash | ||||
|     assets:bank           $-30 | ||||
|     assets:bank             $-30 | ||||
| >>> | ||||
| --- - | ||||
| +++ - | ||||
| @@ -1,3 +1,5 @@ | ||||
|  2016/01/01 withdraw | ||||
|      assets:cash            $20 | ||||
|      assets:cash              $20 | ||||
|      assets:bank | ||||
| +    expenses:fee            $5 | ||||
| +    assets:bank            $-5 | ||||
| +    expenses:fee              $5 | ||||
| +    assets:bank              $-5 | ||||
| @@ -5,3 +7,5 @@ | ||||
|  2016/01/02 withdraw | ||||
|      assets:cash | ||||
|      assets:bank           $-30 | ||||
| +    expenses:fee            $5 | ||||
| +    assets:bank            $-5 | ||||
|      assets:bank             $-30 | ||||
| +    expenses:fee              $5 | ||||
| +    assets:bank              $-5 | ||||
| >>>2 | ||||
| >>>=0 | ||||
|  | ||||
| @ -24,15 +24,15 @@ Total: | ||||
| hledger print -f personal.journal -f business.journal -f alias.journal -f personal.journal | ||||
| >>> | ||||
| 2014/01/01 | ||||
|     expenses:office supplies            $1 | ||||
|     expenses:office supplies              $1 | ||||
|     assets:business checking | ||||
| 
 | ||||
| 2014/01/02 | ||||
|     expenses:food            $1 | ||||
|     expenses:food              $1 | ||||
|     assets:cash | ||||
| 
 | ||||
| 2014/01/02 | ||||
|     expenses:food            $1 | ||||
|     expenses:food              $1 | ||||
|     assets:cash | ||||
| 
 | ||||
| >>>2 | ||||
| @ -46,14 +46,14 @@ hledger print -f personal.journal -f business.journal -f alias.journal -f person | ||||
| hledger print -f personal.journal -f ../journal/a.timeclock -f ../journal/b.timedot | ||||
| >>> | ||||
| 2014/01/02 | ||||
|     expenses:food            $1 | ||||
|     expenses:food              $1 | ||||
|     assets:cash | ||||
| 
 | ||||
| 2016/01/01 * 12:00-16:00 | ||||
|     (a:aa)         4.00h | ||||
|     (a:aa)           4.00h | ||||
| 
 | ||||
| 2016/01/01 * | ||||
|     (b.bb)          1.00 | ||||
|     (b.bb)            1.00 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
|  | ||||
| @ -2,8 +2,8 @@ | ||||
|  rm -rf t.rules$$; printf 'fields date, description, amount\ndate-format %%d/%%Y/%%m\ncurrency $\naccount1 assets:myacct\n' >t.rules$$; echo '10/2009/09,Flubber Co,50' | hledger -f- print --rules-file t.rules$$; rm -rf t.rules$$ | ||||
| >>> | ||||
| 2009/09/10 Flubber Co | ||||
|     income:unknown          $-50 | ||||
|     assets:myacct            $50 | ||||
|     income:unknown            $-50 | ||||
|     assets:myacct              $50 | ||||
| 
 | ||||
| >>>2 /using conversion rules file.*t.rules/ | ||||
| >>>=0 | ||||
| @ -15,12 +15,12 @@ | ||||
| 11/2009/09,Flubber Co,,50 | ||||
| >>> | ||||
| 2009/09/10 Flubber Co | ||||
|     income:unknown            $-50 | ||||
|     Assets:MyAccount           $50 | ||||
|     income:unknown              $-50 | ||||
|     Assets:MyAccount             $50 | ||||
| 
 | ||||
| 2009/09/11 Flubber Co | ||||
|     expenses:unknown           $50 | ||||
|     Assets:MyAccount          $-50 | ||||
|     expenses:unknown             $50 | ||||
|     Assets:MyAccount            $-50 | ||||
| 
 | ||||
| >>>2 /using conversion rules file.*[0-9]+\.rules/ | ||||
| >>>=0 | ||||
| @ -39,8 +39,8 @@ | ||||
|  rm -rf t.rules$$; printf 'fields date, description, amount\ndate-format %%d/%%Y/%%m\ncurrency $\naccount1 assets:myacct\nif Flubber\n  account2 acct\n  comment cmt' >t.rules$$; echo '10/2009/09,Flubber Co,50' | hledger -f- print --rules-file t.rules$$; rm -rf t.rules$$ | ||||
| >>> | ||||
| 2009/09/10 Flubber Co    ; cmt | ||||
|     acct                   $-50 | ||||
|     assets:myacct           $50 | ||||
|     acct                     $-50 | ||||
|     assets:myacct             $50 | ||||
| 
 | ||||
| >>>2 /using conversion rules file.*t.rules/ | ||||
| >>>=0 | ||||
| @ -62,8 +62,8 @@ | ||||
|  rm -rf t.rules$$; printf 'fields date, description, amount, balance\ndate-format %%d/%%Y/%%m\ncurrency $\naccount1 assets:myacct\n' >t.rules$$; echo '10/2009/09,Flubber Co,50,123' | hledger -f- print --rules-file t.rules$$; rm -rf t.rules$$ | ||||
| >>> | ||||
| 2009/09/10 Flubber Co | ||||
|     income:unknown          $-50 | ||||
|     assets:myacct            $50 = $123 | ||||
|     income:unknown            $-50 | ||||
|     assets:myacct              $50 = $123 | ||||
| 
 | ||||
| >>>2 /using conversion rules file.*t.rules/ | ||||
| >>>=0 | ||||
| @ -71,12 +71,12 @@ | ||||
|  rm -rf t.rules$$; printf 'fields date, description, amount, balance\ndate-format %%d/%%Y/%%m\ncurrency $\naccount1 assets:myacct\n' >t.rules$$; echo '10/2009/09,Flubber Co,50,123\n11/2009/09,Blubber Co,60,' | hledger -f- print --rules-file t.rules$$; rm -rf t.rules$$ | ||||
| >>> | ||||
| 2009/09/10 Flubber Co | ||||
|     income:unknown          $-50 | ||||
|     assets:myacct            $50 = $123 | ||||
|     income:unknown            $-50 | ||||
|     assets:myacct              $50 = $123 | ||||
| 
 | ||||
| 2009/09/11 Blubber Co | ||||
|     income:unknown          $-60 | ||||
|     assets:myacct            $60 | ||||
|     income:unknown            $-60 | ||||
|     assets:myacct              $60 | ||||
| 
 | ||||
| >>>2 /using conversion rules file.*t.rules/ | ||||
| >>>=0 | ||||
| @ -84,12 +84,12 @@ | ||||
|  rm -rf t.rules$$; printf 'fields date, description, amount, balance\ndate-format %%d/%%Y/%%m\ncurrency $\naccount1 assets:myacct\n' >t.rules$$; echo '10/2009/09,Flubber Co,50,123\n11/2009/09,Blubber Co,60,   ' | hledger -f- print --rules-file t.rules$$; rm -rf t.rules$$ | ||||
| >>> | ||||
| 2009/09/10 Flubber Co | ||||
|     income:unknown          $-50 | ||||
|     assets:myacct            $50 = $123 | ||||
|     income:unknown            $-50 | ||||
|     assets:myacct              $50 = $123 | ||||
| 
 | ||||
| 2009/09/11 Blubber Co | ||||
|     income:unknown          $-60 | ||||
|     assets:myacct            $60 | ||||
|     income:unknown            $-60 | ||||
|     assets:myacct              $60 | ||||
| 
 | ||||
| >>>2 /using conversion rules file.*t.rules/ | ||||
| >>>=0 | ||||
| @ -97,12 +97,12 @@ | ||||
|  rm -rf t.rules$$; printf 'skip 1\n\ncurrency $\n\nfields date, payee, payment\n\namount -%%payment\naccount1 liabilities:bank\naccount2 expense:other' >t.rules$$; echo 'date,payee,amount\n2009/10/9,Flubber Co,50\n2009/11/09,Merchant Credit,-60' | hledger -f- print --rules-file t.rules$$; rm -rf t.rules$$ | ||||
| >>> | ||||
| 2009/10/09 | ||||
|     expense:other              $50 | ||||
|     liabilities:bank          $-50 | ||||
|     expense:other                $50 | ||||
|     liabilities:bank            $-50 | ||||
| 
 | ||||
| 2009/11/09 | ||||
|     expense:other             $-60 | ||||
|     liabilities:bank           $60 | ||||
|     expense:other               $-60 | ||||
|     liabilities:bank             $60 | ||||
| 
 | ||||
| >>>2 /using conversion rules file.*t.rules/ | ||||
| >>>=0 | ||||
|  | ||||
| @ -5,7 +5,7 @@ hledger -f - print | ||||
|  счёт:второй | ||||
| >>> | ||||
| 2009/01/01 проверка | ||||
|     счёт:первый             1 | ||||
|     счёт:первый               1 | ||||
|     счёт:второй | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -20,16 +20,16 @@ hledger -f - print | ||||
|   㐀                                            -1 | ||||
| >>> | ||||
| 2014/01/01 transaction 1 | ||||
|     㐀     㐃㐃1 @ 2 㐂㐂㐂㐂㐂㐂㐂㐂㐂㐂㐂 | ||||
|     㐀:㐁      ; 㐃㐃-1 | ||||
|     㐀       㐃㐃1 @ 2 㐂㐂㐂㐂㐂㐂㐂㐂㐂㐂㐂 | ||||
|     㐀:㐁        ; 㐃㐃-1 | ||||
| 
 | ||||
| 2014/01/02 transaction 2 | ||||
|     㐀:㐁:㐂            USD 1 | ||||
|     㐀:㐁:㐂:㐃        EUR -1 | ||||
|     㐀:㐁:㐂              USD 1 | ||||
|     㐀:㐁:㐂:㐃          EUR -1 | ||||
| 
 | ||||
| 2014/01/03 transaction 3 | ||||
|     㐀:㐁:㐂:㐃:㐄             1 | ||||
|     㐀                        -1 | ||||
|     㐀:㐁:㐂:㐃:㐄               1 | ||||
|     㐀                          -1 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
|  | ||||
| @ -12,7 +12,7 @@ hledger -f - print | ||||
| 2009/01/01 x | ||||
|     ; transaction comment 1 | ||||
|     ; transaction comment 2 | ||||
|     a             1 | ||||
|     a               1 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -26,7 +26,7 @@ hledger -f - print | ||||
| ; comment line after postings | ||||
| >>> | ||||
| 2009/01/01 x | ||||
|     a             1 | ||||
|     a               1 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -49,7 +49,7 @@ hledger -f - print | ||||
| >>> | ||||
| 2009/01/01 x    ; transaction same line comment | ||||
|     ; transaction new line comment | ||||
|     a             1    ; posting 1 same line comment | ||||
|     a               1    ; posting 1 same line comment | ||||
|     ; posting 1 new line comment | ||||
|     b | ||||
|     ; posting 2 new line comment | ||||
| @ -61,13 +61,13 @@ hledger -f - print | ||||
| hledger -f - print | ||||
| <<< | ||||
| 2010/01/01 x | ||||
|     a             1    ; comment | ||||
|     b            -1 | ||||
|     a               1    ; comment | ||||
|     b              -1 | ||||
| 
 | ||||
| >>> | ||||
| 2010/01/01 x | ||||
|     a             1    ; comment | ||||
|     b            -1 | ||||
|     a               1    ; comment | ||||
|     b              -1 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
|  | ||||
| @ -15,8 +15,8 @@ hledger -f- print --explicit | ||||
|    b | ||||
| >>> | ||||
| 2010/04/05 x | ||||
|     a   10 "DE 0002 635307" | ||||
|     b  -10 "DE 0002 635307" | ||||
|     a     10 "DE 0002 635307" | ||||
|     b    -10 "DE 0002 635307" | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -42,8 +42,8 @@ hledger -f- print -x | ||||
|     Equity:Unbalanced | ||||
| >>> | ||||
| 2016/01/01 | ||||
|     saving-card                 $-105 | ||||
|     snacks             95 EUR @@ $100 | ||||
|     Equity:Unbalanced              $5 | ||||
|     saving-card                   $-105 | ||||
|     snacks               95 EUR @@ $100 | ||||
|     Equity:Unbalanced                $5 | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -23,7 +23,7 @@ hledger -f- print | ||||
|    b | ||||
| >>> | ||||
| 2000/02/29 x | ||||
|     a             1 | ||||
|     a               1 | ||||
|     b | ||||
| 
 | ||||
| >>>= 0 | ||||
|  | ||||
| @ -11,7 +11,7 @@ hledger -f- print | ||||
|   b | ||||
| >>> | ||||
| 2010/01/01 | ||||
|     a          1000 | ||||
|     a            1000 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -25,7 +25,7 @@ D £1000.00 | ||||
|   b | ||||
| >>> | ||||
| 2010/01/01 | ||||
|     a      £1000.00 | ||||
|     a        £1000.00 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -39,7 +39,7 @@ D $1,000 | ||||
|   b | ||||
| >>> | ||||
| 2010/01/01 | ||||
|     a     $1000,000 | ||||
|     a       $1000,000 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -52,7 +52,7 @@ D $1,000.0 | ||||
|   (a)  1000000 | ||||
| >>> | ||||
| 2010/01/01 | ||||
|     (a)  $1,000,000.0 | ||||
|     (a)    $1,000,000.0 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -67,8 +67,8 @@ D $1,000.0 | ||||
|   (b)   1000000 | ||||
| >>> | ||||
| 2010/01/01 | ||||
|     (a)  $1,000,000.00 | ||||
|     (b)  $1,000,000.00 | ||||
|     (a)    $1,000,000.00 | ||||
|     (b)    $1,000,000.00 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
|  | ||||
| @ -2,16 +2,16 @@ | ||||
|  mkdir -p b/c/d ; printf '2010/1/1\n (D)  1\n' >b/c/d/d.journal ; printf '2010/1/1\n (C)  1\n!include d/d.journal\n' >b/c/c.journal ; printf '2010/1/1\n (B)  1\n!include c/c.journal\n' >b/b.journal ; printf '2010/1/1\n (A)  1\n!include b/b.journal\n' >a.journal ; hledger -f a.journal print; rm -rf a.journal b | ||||
| >>> | ||||
| 2010/01/01 | ||||
|     (A)             1 | ||||
|     (A)               1 | ||||
| 
 | ||||
| 2010/01/01 | ||||
|     (B)             1 | ||||
|     (B)               1 | ||||
| 
 | ||||
| 2010/01/01 | ||||
|     (C)             1 | ||||
|     (C)               1 | ||||
| 
 | ||||
| 2010/01/01 | ||||
|     (D)             1 | ||||
|     (D)               1 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -26,12 +26,12 @@ include a.timeclock | ||||
| include b.timedot | ||||
| >>> | ||||
| 2016/01/01 | ||||
|     (x)          1.00 | ||||
|     (x)            1.00 | ||||
| 
 | ||||
| 2016/01/01 * 12:00-16:00 | ||||
|     (a:aa)         4.00h | ||||
|     (a:aa)           4.00h | ||||
| 
 | ||||
| 2016/01/01 * | ||||
|     (b.bb)          1.00 | ||||
|     (b.bb)            1.00 | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -6,8 +6,8 @@ hledger -f - print | ||||
|   c | ||||
| >>> | ||||
| 2009/01/01 x | ||||
|     a                   2 | ||||
|     b (b) b            -1 | ||||
|     a                     2 | ||||
|     b (b) b              -1 | ||||
|     c | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -9,8 +9,8 @@ hledger -f - print | ||||
|    A  -1712 D | ||||
| >>> | ||||
| 2010/01/01 x | ||||
|     A  55.3653 C @ 30.92189512 D | ||||
|     A                    -1712 D | ||||
|     A    55.3653 C @ 30.92189512 D | ||||
|     A                      -1712 D | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -40,9 +40,9 @@ hledger -f - print --explicit | ||||
|    a | ||||
| >>> | ||||
| 2010/01/01 | ||||
|     a             0 | ||||
|     a  1C @ $1.0049 | ||||
|     a      $-1.0049 | ||||
|     a               0 | ||||
|     a    1C @ $1.0049 | ||||
|     a        $-1.0049 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -138,9 +138,9 @@ hledger -f- print --explicit | ||||
|     d  D -320.00 | ||||
| >>> | ||||
| 2015/01/01 | ||||
|     c  C 10.00 @ D 15.2381 | ||||
|     c  C 11.00 @ D 15.2381 | ||||
|     d            D -320.00 | ||||
|     c    C 10.00 @ D 15.2381 | ||||
|     c    C 11.00 @ D 15.2381 | ||||
|     d              D -320.00 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -155,8 +155,8 @@ hledger -f- print --explicit | ||||
|     f  F -320.000 | ||||
| >>> | ||||
| 2015/01/01 | ||||
|     e  E 10.0000 @ F 15.2380952 | ||||
|     e  E 11.0000 @ F 15.2380952 | ||||
|     f                F -320.000 | ||||
|     e    E 10.0000 @ F 15.2380952 | ||||
|     e    E 11.0000 @ F 15.2380952 | ||||
|     f                  F -320.000 | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -5,7 +5,7 @@ hledger -f- print | ||||
|   (a)  1 | ||||
| >>> | ||||
| 2015/01/01 x | ||||
|     (a)             1 | ||||
|     (a)               1 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -16,7 +16,7 @@ hledger -f- print | ||||
|   (a)  1 | ||||
| >>> | ||||
| 2015/01/01 ! x | ||||
|     (a)             1 | ||||
|     (a)               1 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -27,7 +27,7 @@ hledger -f- print | ||||
|   (a)  1 | ||||
| >>> | ||||
| 2015/01/01 * x | ||||
|     (a)             1 | ||||
|     (a)               1 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -42,7 +42,7 @@ hledger -f- print --cleared | ||||
|   (c)  1 | ||||
| >>> | ||||
| 2015/01/01 * x | ||||
|     (c)             1 | ||||
|     (c)               1 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -57,7 +57,7 @@ hledger -f- print --pending | ||||
|   (c)  1 | ||||
| >>> | ||||
| 2015/01/01 ! x | ||||
|     (b)             1 | ||||
|     (b)               1 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -72,9 +72,9 @@ hledger -f- print --uncleared | ||||
|   (c)  1 | ||||
| >>> | ||||
| 2015/01/01 x | ||||
|     (a)             1 | ||||
|     (a)               1 | ||||
| 
 | ||||
| 2015/01/01 ! x | ||||
|     (b)             1 | ||||
|     (b)               1 | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -14,10 +14,10 @@ hledger -f - print | ||||
| >>> | ||||
| 2010/01/01    ; txntag1: txn val 1 | ||||
|     ; txntag2: txn val 2 | ||||
|     a             1 | ||||
|     a               1 | ||||
|     ; posting1tag1: posting 1 val 1 | ||||
|     ; posting1tag2: | ||||
|     b            -1    ; posting-2-tag-1: posting 2 val 1 | ||||
|     b              -1    ; posting-2-tag-1: posting 2 val 1 | ||||
|     ; posting-2-tag-2: | ||||
| 
 | ||||
| >>>2 | ||||
| @ -39,12 +39,12 @@ hledger -f - print tag:foo | ||||
|     f            -1 | ||||
| >>> | ||||
| 2010/01/01    ; foo:bar | ||||
|     a             1 | ||||
|     b            -1 | ||||
|     a               1 | ||||
|     b              -1 | ||||
| 
 | ||||
| 2010/01/02    ; foo:baz | ||||
|     c             1 | ||||
|     d            -1 | ||||
|     c               1 | ||||
|     d              -1 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -66,8 +66,8 @@ hledger -f - print tag:foo=bar | ||||
|     f            -1 | ||||
| >>> | ||||
| 2010/01/01    ; foo:bar | ||||
|     a             1 | ||||
|     b            -1 | ||||
|     a               1 | ||||
|     b              -1 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -114,16 +114,16 @@ hledger -f - print not:tag:. | ||||
|     h            -4 | ||||
| >>> | ||||
| 2010/01/01 desc | ||||
|     a             1 | ||||
|     b            -1 | ||||
|     a               1 | ||||
|     b              -1 | ||||
| 
 | ||||
| 2010/01/03 | ||||
|     e             3 | ||||
|     f            -3 | ||||
|     e               3 | ||||
|     f              -3 | ||||
| 
 | ||||
| 2010/01/04 (code) | ||||
|     g             4 | ||||
|     h            -4 | ||||
|     g               4 | ||||
|     h              -4 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
|  | ||||
| @ -7,8 +7,8 @@ hledger -f- print --explicit | ||||
|     assets | ||||
| >>> | ||||
| 2011/01/01 | ||||
|     expenses:foreign currency  €100 @ $1.35 | ||||
|     assets                         $-135.00 | ||||
|     expenses:foreign currency    €100 @ $1.35 | ||||
|     assets                           $-135.00 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -20,8 +20,8 @@ hledger -f- print --explicit --cost | ||||
|     assets | ||||
| >>> | ||||
| 2011/01/01 | ||||
|     expenses:foreign currency       $135.00 | ||||
|     assets                         $-135.00 | ||||
|     expenses:foreign currency         $135.00 | ||||
|     assets                           $-135.00 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -33,8 +33,8 @@ hledger -f - print --explicit | ||||
|     assets | ||||
| >>> | ||||
| 2011/01/01 | ||||
|     expenses:foreign currency  €100 @@ $135 | ||||
|     assets                            $-135 | ||||
|     expenses:foreign currency    €100 @@ $135 | ||||
|     assets                              $-135 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -51,12 +51,12 @@ hledger -f - print --explicit | ||||
|     misc                             $-2.1 | ||||
| >>> | ||||
| 2011/01/01 | ||||
|     expenses:foreign currency  €100 @ $1.35 | ||||
|     misc                              $2.10 | ||||
|     assets                         $-135.00 | ||||
|     misc                         €1 @ $1.35 | ||||
|     misc                        €-1 @ $1.35 | ||||
|     misc                             $-2.10 | ||||
|     expenses:foreign currency    €100 @ $1.35 | ||||
|     misc                                $2.10 | ||||
|     assets                           $-135.00 | ||||
|     misc                           €1 @ $1.35 | ||||
|     misc                          €-1 @ $1.35 | ||||
|     misc                               $-2.10 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -68,8 +68,8 @@ hledger -f - print --explicit | ||||
|     a35e82730cf91569c302b313780e5895f75a62b9   $-17,783.72 | ||||
| >>> | ||||
| 2002/09/30 * 1a1a6305d06ce4b284dba0d267c23f69d70c20be | ||||
|     c56a21d23a6535184e7152ee138c28974f14280c  866.231000 GGGGG @@ $17,783.72 | ||||
|     a35e82730cf91569c302b313780e5895f75a62b9                     $-17,783.72 | ||||
|     c56a21d23a6535184e7152ee138c28974f14280c    866.231000 GGGGG @@ $17,783.72 | ||||
|     a35e82730cf91569c302b313780e5895f75a62b9                       $-17,783.72 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -77,9 +77,9 @@ hledger -f - print --explicit | ||||
| hledger -f - print | ||||
| <<< | ||||
| 2011/01/01 | ||||
|     expenses:foreign currency       €100 | ||||
|     assets                         $-135 | ||||
|     expenses:other                  £200 | ||||
|     expenses:foreign currency         €100 | ||||
|     assets                           $-135 | ||||
|     expenses:other                    £200 | ||||
| >>>= !0 | ||||
| 
 | ||||
| # 7. another | ||||
|  | ||||
| @ -71,13 +71,13 @@ alias /A (.)/=\1 | ||||
| 
 | ||||
| >>> | ||||
| 2011/01/01 | ||||
|     b b             1 | ||||
|     b b             2 | ||||
|     b b               1 | ||||
|     b b               2 | ||||
|     c | ||||
| 
 | ||||
| 2011/01/01 | ||||
|     b             1 | ||||
|     b             2 | ||||
|     b               1 | ||||
|     b               2 | ||||
|     c | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -96,8 +96,8 @@ hledger -f- print --alias '/A (.)/=a' --alias /a/=b | ||||
| 
 | ||||
| >>> | ||||
| 2011/01/01 | ||||
|     b             1 | ||||
|     b             2 | ||||
|     b               1 | ||||
|     b               2 | ||||
|     c | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -116,7 +116,7 @@ alias E=F | ||||
| 
 | ||||
| >>> | ||||
| 2011/01/01 | ||||
|     [E:x]               1 | ||||
|     [E:x]                 1 | ||||
|     [x:A:x] | ||||
| 
 | ||||
| >>>2 | ||||
|  | ||||
| @ -8,10 +8,10 @@ hledger -f - print --explicit | ||||
|     c           ; a euro and a dollar | ||||
| >>> | ||||
| 2010/01/01 | ||||
|     a         EUR 1    ; a euro | ||||
|     b         USD 1    ; a dollar | ||||
|     c        EUR -1    ; a euro and a dollar | ||||
|     c        USD -1    ; a euro and a dollar | ||||
|     a           EUR 1    ; a euro | ||||
|     b           USD 1    ; a dollar | ||||
|     c          EUR -1    ; a euro and a dollar | ||||
|     c          USD -1    ; a euro and a dollar | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -54,8 +54,8 @@ hledger -f- print --explicit --empty | ||||
|   b | ||||
| >>> | ||||
| 2010/03/01 x | ||||
|     a      0 @ 3EUR | ||||
|     b             0 | ||||
|     a        0 @ 3EUR | ||||
|     b               0 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
|  | ||||
| @ -9,8 +9,8 @@ hledger -f- --pivot TAG print | ||||
|     ; TAG: value | ||||
| >>> | ||||
| 2016/02/16 Test Transaction | ||||
|                   2 EUR | ||||
|     value        -2 EUR | ||||
|                     2 EUR | ||||
|     value          -2 EUR | ||||
|     ; TAG: value | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -16,11 +16,11 @@ hledger -f- print --cleared | ||||
|   b | ||||
| >>> | ||||
| 2010/01/02 * x | ||||
|     a             1 | ||||
|     a               1 | ||||
|     b | ||||
| 
 | ||||
| 2010/01/03 * | ||||
|     a             1 | ||||
|     a               1 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
| @ -41,7 +41,7 @@ hledger -f- print --uncleared | ||||
|   b | ||||
| >>> | ||||
| 2010/01/01 x | ||||
|     a             1 | ||||
|     a               1 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -9,10 +9,10 @@ hledger -f - print | ||||
| 
 | ||||
| >>> | ||||
| 2000/01/01=2000/03/03 | ||||
|     (a)             1 | ||||
|     (a)               1 | ||||
| 
 | ||||
| 2000/01/02=2000/02/02 | ||||
|     (b)             1 | ||||
|     (b)               1 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>= 0 | ||||
| @ -28,10 +28,10 @@ hledger -f - print --date2 | ||||
| 
 | ||||
| >>> | ||||
| 2000/01/02=2000/02/02 | ||||
|     (b)             1 | ||||
|     (b)               1 | ||||
| 
 | ||||
| 2000/01/01=2000/03/03 | ||||
|     (a)             1 | ||||
|     (a)               1 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>= 0 | ||||
|  | ||||
| @ -8,7 +8,7 @@ hledger -f - print | ||||
|     assets | ||||
| >>> | ||||
| 2017/01/01 | ||||
|     expenses            $5 | ||||
|     expenses              $5 | ||||
|     assets | ||||
| 
 | ||||
| >>>2 | ||||
| @ -22,8 +22,8 @@ hledger -f - print --explicit | ||||
|     assets | ||||
| >>> | ||||
| 2017/01/01 | ||||
|     expenses            $5 | ||||
|     assets             $-5 | ||||
|     expenses              $5 | ||||
|     assets               $-5 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -36,8 +36,8 @@ hledger -f - print | ||||
|     assets  $-5 | ||||
| >>> | ||||
| 2017/01/01 | ||||
|     expenses         4 EUR | ||||
|     assets             $-5 | ||||
|     expenses           4 EUR | ||||
|     assets               $-5 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -50,8 +50,8 @@ hledger -f - print --explicit | ||||
|     assets  $-5 | ||||
| >>> | ||||
| 2017/01/01 | ||||
|     expenses   4 EUR @@ $5 | ||||
|     assets             $-5 | ||||
|     expenses     4 EUR @@ $5 | ||||
|     assets               $-5 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -64,7 +64,7 @@ hledger -f - print | ||||
|     equity | ||||
| >>> | ||||
| 2017/01/01 | ||||
|     assets   = $100 | ||||
|     assets     = $100 | ||||
|     equity | ||||
| 
 | ||||
| >>>2 | ||||
| @ -78,8 +78,8 @@ hledger -f - print --explicit | ||||
|     equity | ||||
| >>> | ||||
| 2017/01/01 | ||||
|     assets          $100 = $100 | ||||
|     equity         $-100 | ||||
|     assets            $100 = $100 | ||||
|     equity           $-100 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -93,7 +93,7 @@ D 1000.00 EUR | ||||
|     assets | ||||
| >>> | ||||
| 2017/01/01 | ||||
|     expenses    100.00 EUR | ||||
|     expenses      100.00 EUR | ||||
|     assets | ||||
| 
 | ||||
| >>>2 | ||||
| @ -107,8 +107,8 @@ hledger -f - print --explicit | ||||
|     equity | ||||
| >>> | ||||
| 2017/01/01 | ||||
|     assets             0 | ||||
|     equity             0 | ||||
|     assets               0 | ||||
|     equity               0 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
|  | ||||
| @ -5,7 +5,7 @@ hledger -f - print | ||||
|  b | ||||
| >>> | ||||
| 2009/01/01 x | ||||
|     aaaaabbbbbcccccdddddeeeeefffffggggghhhhh             1 | ||||
|     aaaaabbbbbcccccdddddeeeeefffffggggghhhhh               1 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -10,7 +10,7 @@ hledger -f - print desc:x | ||||
| 
 | ||||
| >>> | ||||
| 2009/01/01 x | ||||
|     a             1 | ||||
|     a               1 | ||||
|     b | ||||
| 
 | ||||
| >>>=0 | ||||
|  | ||||
| @ -10,13 +10,13 @@ i 2009/1/3 08:00:00 some:account name  and a description | ||||
| o 2009/1/3 09:00:00 | ||||
| >>> | ||||
| 2009/01/01 * 08:00-09:00 | ||||
|     ()         1.00h | ||||
|     ()           1.00h | ||||
| 
 | ||||
| 2009/01/02 * 08:00-09:00 | ||||
|     (account name)         1.00h | ||||
|     (account name)           1.00h | ||||
| 
 | ||||
| 2009/01/03 * and a description | ||||
|     (some:account name)         1.00h | ||||
|     (some:account name)           1.00h | ||||
| 
 | ||||
| >>>2 | ||||
| >>>= 0 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user