Could you implement something by simply using metadata?

John

On Apr 11, 2010, at 5:20 PM, David Glasser wrote:

> I'm just starting to use ledger to implement finances for an
> organization.  The organization is a home with a bunch of folks where
> we share costs.  I'm thinking that the virtual transactions will work
> great for budgeting; for example I'm thinking of doing something like
> this to track utilities bills:
> 
> 4/1 Pay electric
>  Expenses:Utilities:Electric   $100
>  Housebills:Dave    ; because I'm the one who actually paid it
>  (Budget:Utilities:2010-04)  $100
> 
> 4/1 Pay gas for April and May
>  Expenses:Utilities:Water   $100
>  Housebills:Jane    ; Maybe she paid the water bill
>  (Budget:Utilities:2010-04)  $50
>  (Budget:Utilities:2010-05)  $50
> 
> ; ... etc for all the utilities
> 
> ; Then when it's time to issue housebill, I can use
> ;   ledger bal budget:utilities:2010-04
> ; to find out that the total utilities for the month were $150
> 
> 4/15 Charge utilities
>  Income:Utilities Collected   $-150
>  (Budget:Utilities:2010-04)  $-150
>  Housebills:Dave  $50
>  Housebills:Jane  $50
>  Housebills:Alex  $50
> 
> splitting the costs evenly among my housemates
> 
> 
> 
> So there are two features that would be nice here:
> 
> 1: For many instances of the virtual posting (the first and the last,
> specifically) I want the posting to the budget to be the exact same as
> some real posting.  For example, I'd like to add the exact value I
> spent on electricity to the utilities budget and having to type the
> same number twice leaves room for error.
> 
> 2: There are a bunch of cases where I want to divide a charge evenly
> among a bunch of postings.  Both in the "Take the utilities budget for
> this month and divide it evenly among my housemates" case (all
> non-virtual) and in the "Take the water bill (real charge) and divide
> it evenly among virtual budget charges for two months" cases.
> 
> 
> Maybe these can be implemented by allowing some sort of special syntax
> in the amount field?  So I could write something like:
> 
> 
> 4/1 Pay electric
>  Expenses:Utilities:Electric   $100
>  (Budget:Utilities:2010-04)  ^=^
>  Housebills:Dave    ; because I'm the one who actually paid it
> 
> 4/1 Pay gas for April and May
>  Expenses:Utilities:Water   $100
>  (Budget:Utilities:2010-04)  ^/^
>  (Budget:Utilities:2010-05)  ^/^
>  Housebills:Jane    ; Maybe she paid the water bill
> 
> 4/15 Charge utilities
>  Income:Utilities Collected   $-150
>  (Budget:Utilities:2010-04)  ^=^
>  Housebills:Dave  ^-/^
>  Housebills:Jane  ^-/^
>  Housebills:Alex  ^-/^
> 
> This is not necessarily the best syntax.  The semantics would basically be:
> 
> - When you read a ^=^, interpret it as equal to whatever is written
> immediately above it.
> 
> - When you read a ^-=^, interpret it as the negative of whatever is
> written immediately above it.
> 
> - When you read a ^/^, hold off on calculating its value and keep
> reading until you find a posting that isn't ^/^.  Then take the value
> immediately above the first ^/^, divide it by the number of ^/^s, and
> assign that it all of them.  ^-/^ is the same but assigns the
> negative.
> 
> ^^ elements perhaps can't be after a posting with an empty amount.  If
> you place a ^=^ after a ^/^ it copies the value of the ^/^ not the
> total that it was adding up to.
> 
> Would something like this be reasonable? I'd be interesting in helping
> implement too, although I'll admit that I've had some difficulty
> getting a build environment for ledger (I can probably build based on
> whatever is in MacPorts but that isn't git master, I think).
> 
> --dave
> 
> -- 
> [email protected] | langtonlabs.org | flickr.com/photos/glasser/



-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to