Hi guys,

I'm yet another noob trying to figure out if ledger fulfills his needs. I 
want to track for what I pay money in an item-wise manner. For example in 
one week I went to the grocery two times and bought this (receipt sample 
data):


2016/06/13 Grocery Store
  Eggs (6 pack)  $1.20
  Milk
     2 x $0.46   $0.92
  Water          $0.19

2016/06/16 Grocery Store
  Milk           $0.46
  Water          $0.19

How can I put that into my journal that I'm able to extract the following 
information:

   - How many of each item did I buy in a period of time
   - What did a single item of each cost in average (when I buy eggs at the 
   store or at the market they have different prices which shouldn't result in 
   a revaluing)
   - How much did I spend for each item in total

Yet I've tried two approaches, but I weren't able yield the result I 
wanted. First is to give every item it's own account like this:

alias Food=Expenses:Food

2016/06/13 Grocery Store
    Food:Eggs                                            $1.20
    Food:Milk                                            $0.92
    Food:Water                                           $0.19
    Assets:Checking

2016/06/16 Grocery Store
    Food:Milk                                            $0.46
    Food:Water                                           $0.19
    Assets:Checking

That way I have a nice balance view (ledger -f byaccount.ledger bal -b 
2016/06/13 -e 2016/06/19):
              $-2.96  Assets:Checking
               $2.96  Expenses:Food
               $1.20    Eggs
               $1.38    Milk
               $0.38    Water
--------------------
                   0

I know how much I spend in total on an item but I have no clue how many of 
them I bought and what a single one cost in average.
Another idea was to exploit the commodity system so every item has it's own 
commodity.

2016/06/13 Grocery Store
    Expenses:Food                                            6 eggs @@ $1.20
    Expenses:Food                                            2 Milk @ $0.46
    Expenses:Food                                            1 Water @ $0.19

2016/06/16 Grocery Store
    Expenses:Food                                            1 Milk @ $0.46
    Expenses:Food                                            1 Water @ $0.19


In theory all the information needed should be in the file but I'm lost 
querying it...
Here the balance with just a few items:

ledger -f bycommodity.ledger bal -b 2016/06/13 -e 2016/06/19
                 $-3  Assets:Checking
              3 Milk
             2 Water
              6 eggs  Expenses:Food
--------------------
                 $-3
              3 Milk
             2 Water
              6 eggs

As the commodity gets repeated in the super accounts that view gets 
unreadable pretty fast. So in the long run all thats left is how much I 
spend in total for food:

ledger -f bycommodity.ledger bal -b 2016/06/13 -e 2016/06/19 -V
                 $-3  Assets:Checking
                  $3  Expenses:Food
--------------------
                   0
(Sidequest: where does the rounding come from?)

I tried all ways I could imagine to query registers, commodities and 
balances to get what I want but the result isn't really usable. How can I 
query the file to get an result like this?

| item  | total count | count per day | cost per one | cost per day | total 
|
|-------+-------------+---------------+--------------+--------------+-------|
| Eggs  |           6 |          0.86 |         0.20 |         0.17 |  1.20 
|
| Milk  |           3 |          0.42 |         0.46 |         0.20 |  1.38 
|
| Water |           2 |          0.28 |         0.19 |         0.06 |  0.38 
|
|-------+-------------+---------------+--------------+--------------+-------|
|       |             |               |        total |         0.43 |  2.96 
|

The "per day" columns are optional and I won't mind if I have to use two or 
three different views to get the information I want. Is there a way to do 
this in ledger? And to create such a report on a weekly basis without me 
specifying the exact dates, like the weekly register except it contains the 
upper information?

Thanks a lot and kind regards

Mario

-- 

--- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to