On Wed, Nov 15, 2023, at 12:41 PM, John Wiegley wrote:
>>>>>> "OČ" == Ondřej Čertík <[email protected]> writes:
>
> OČ> Does anybody know how to do that?
>
> Does something like `--display-total account.total` help?

It doesn't seem to show the correct totals. Consider:

test/input(master) $ python process.py 
      Date                  Name                    Account      Amount  
Account Balance
2010/12/01      Checking balance            Assets:Checking     1000.00     
1000.00
2010/12/01      Checking balance    Equity:Opening Balances    -1000.00    
-1000.00
2010/12/20         Organic Co-op    Expenses:Food:Groceries       37.50       
37.50
2010/12/20         Organic Co-op    Expenses:Food:Groceries       37.50       
75.00
2010/12/20         Organic Co-op    Expenses:Food:Groceries       37.50      
112.50
2010/12/20         Organic Co-op    Expenses:Food:Groceries       37.50      
150.00
2010/12/20         Organic Co-op    Expenses:Food:Groceries       37.50      
187.50
2010/12/20         Organic Co-op    Expenses:Food:Groceries       37.50      
225.00
2010/12/20         Organic Co-op            Assets:Checking     -225.00      
775.00
2010/12/28         Acme Mortgage  Liabilities:Mortgage:Principal      200.00    
  200.00
2010/12/28         Acme Mortgage  Expenses:Interest:Mortgage      500.00      
500.00
2010/12/28         Acme Mortgage            Expenses:Escrow      300.00      
300.00
2010/12/28         Acme Mortgage            Assets:Checking    -1000.00     
-225.00
2011/01/02         Grocery Store    Expenses:Food:Groceries       65.00      
290.00
2011/01/02         Grocery Store            Assets:Checking      -65.00     
-290.00
2011/01/05              Employer            Assets:Checking     2000.00     
1710.00
2011/01/05              Employer              Income:Salary    -2000.00    
-2000.00
2011/01/14                  Bank             Assets:Savings      300.00      
300.00
2011/01/14                  Bank            Assets:Checking     -300.00     
1410.00
2011/01/19         Grocery Store    Expenses:Food:Groceries       44.00      
334.00
2011/01/19         Grocery Store            Assets:Checking      -44.00     
1366.00
2011/01/25                  Bank            Assets:Checking     5500.00     
6866.00
2011/01/25                  Bank             Assets:Savings    -5500.00    
-5200.00
2011/01/25       Tom's Used Cars              Expenses:Auto     5500.00     
5500.00
2011/01/25       Tom's Used Cars            Assets:Checking    -5500.00     
1366.00
2011/01/27            Book Store             Expenses:Books       20.00       
20.00
2011/01/27            Book Store     Liabilities:MasterCard      -20.00      
-20.00
2011/04/25       Tom's Used Cars              Expenses:Auto     5500.00    
11000.00
2011/04/25       Tom's Used Cars            Assets:Checking    -5500.00    
-4134.00
2011/04/27             Bookstore             Expenses:Books       20.00       
40.00
2011/04/27             Bookstore            Assets:Checking      -20.00    
-4154.00
2011/12/01                  Sale            Assets:Checking       30.00    
-4124.00
2011/12/01                  Sale               Income:Sales      -30.00      
-30.00

test/input(master) $ ledger -f demo.ledger reg --display-total account.total
10-Dec-01 Checking balance                      Assets:Checking                 
                       $ 1,000.00             $ 1,000.00
                                                Equity:Opening Balances         
                      $ -1,000.00            $ -1,000.00
10-Dec-20 Organic Co-op                         Expenses:Food:Groceries         
                          $ 37.50                $ 37.50
                                                Expenses:Food:Groceries         
                          $ 37.50                $ 37.50
                                                Expenses:Food:Groceries         
                          $ 37.50                $ 37.50
                                                Expenses:Food:Groceries         
                          $ 37.50                $ 37.50
                                                Expenses:Food:Groceries         
                          $ 37.50                $ 37.50
                                                Expenses:Food:Groceries         
                          $ 37.50                $ 37.50
                                                Assets:Checking                 
                        $ -225.00             $ 1,000.00
10-Dec-28 Acme Mortgage                         Liabilities:Mortgage:Principal  
                         $ 200.00               $ 200.00
                                                Expenses:Interest:Mortgage      
                         $ 500.00               $ 500.00
                                                Expenses:Escrow                 
                         $ 300.00               $ 300.00
                                                Assets:Checking                 
                      $ -1,000.00             $ 1,000.00
11-Jan-02 Grocery Store                         Expenses:Food:Groceries         
                          $ 65.00                $ 37.50
                                                Assets:Checking                 
                         $ -65.00             $ 1,000.00
11-Jan-05 Employer                              Assets:Checking                 
                       $ 2,000.00             $ 1,000.00
                                                Income:Salary                   
                      $ -2,000.00            $ -2,000.00
11-Jan-14 Bank                                  Assets:Savings                  
                         $ 300.00               $ 300.00
                                                Assets:Checking                 
                        $ -300.00             $ 1,000.00
11-Jan-19 Grocery Store                         Expenses:Food:Groceries         
                          $ 44.00                $ 37.50
                                                Assets:Checking                 
                         $ -44.00             $ 1,000.00
11-Jan-25 Bank                                  Assets:Checking                 
                       $ 5,500.00             $ 1,000.00
                                                Assets:Savings                  
                      $ -5,500.00               $ 300.00
11-Jan-25 Tom's Used Cars                       Expenses:Auto                   
                       $ 5,500.00             $ 5,500.00
                                                Assets:Checking                 
                      $ -5,500.00             $ 1,000.00
11-Jan-27 Book Store                            Expenses:Books                  
                          $ 20.00                $ 20.00
                                                Liabilities:MasterCard          
                         $ -20.00               $ -20.00
11-Apr-25 Tom's Used Cars                       Expenses:Auto                   
                       $ 5,500.00             $ 5,500.00
                                                Assets:Checking                 
                      $ -5,500.00             $ 1,000.00
11-Apr-27 Bookstore                             Expenses:Books                  
                          $ 20.00                $ 20.00
                                                Assets:Checking                 
                         $ -20.00             $ 1,000.00
11-Dec-01 Sale                                  Assets:Checking                 
                          $ 30.00             $ 1,000.00
                                                Income:Sales                    
                         $ -30.00               $ -30.00

$ ledger -f demo.ledger reg Assets:Checking              
10-Dec-01 Checking balance                      Assets:Checking                 
                       $ 1,000.00             $ 1,000.00
10-Dec-20 Organic Co-op                         Assets:Checking                 
                        $ -225.00               $ 775.00
10-Dec-28 Acme Mortgage                         Assets:Checking                 
                      $ -1,000.00              $ -225.00
11-Jan-02 Grocery Store                         Assets:Checking                 
                         $ -65.00              $ -290.00
11-Jan-05 Employer                              Assets:Checking                 
                       $ 2,000.00             $ 1,710.00
11-Jan-14 Bank                                  Assets:Checking                 
                        $ -300.00             $ 1,410.00
11-Jan-19 Grocery Store                         Assets:Checking                 
                         $ -44.00             $ 1,366.00
11-Jan-25 Bank                                  Assets:Checking                 
                       $ 5,500.00             $ 6,866.00
11-Jan-25 Tom's Used Cars                       Assets:Checking                 
                      $ -5,500.00             $ 1,366.00
11-Apr-25 Tom's Used Cars                       Assets:Checking                 
                      $ -5,500.00            $ -4,134.00
11-Apr-27 Bookstore                             Assets:Checking                 
                         $ -20.00            $ -4,154.00
11-Dec-01 Sale                                  Assets:Checking                 
                          $ 30.00            $ -4,124.00



For example, the `Assets:Checking` checking balance at the end is $ -4,124.00. 
The same number reported using my Python script:

2011/12/01                  Sale            Assets:Checking       30.00    
-4124.00

But --display-total account.total reports:

11-Dec-01 Sale                                  Assets:Checking                 
                          $ 30.00             $ 1,000.00



Ondrej

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/25064101-9158-4292-a02f-ba494470deda%40app.fastmail.com.

Reply via email to