IMO you're going about this the wrong way: By double-posting to another
Income account, you're screwing up your income statement - "net income"
won't produce the correct amount since you're posting twice the same
amounts. You're using the wrong solution by generating postings where all
you really need is some way to perform a reporting aggregation.

Think about it differently: conceptually, you have a large set of postings,
or "rows" which you'd like to aggregate according to some criteria. In your
case this criteria is "by payee" where the name of the payee is defined by
matching against some regular expression because the values are approximate
(manually entered). The right thing to do is to (1) have the software clean
up the payee column so that they're all matching a single distinct and
clean payee name, and then (2) perform a simple aggregation grouping by
that column.

In Beancount that's how you'd achieve this. You'd write or use a simple
plugin to clean up your payee names according to rules you set, like this:
https://bitbucket.org/blais/beancount/src/980927838bb34401ccbad82f7a7c73c037bcc362/src/python/beancount/plugins/fix_payees.py?fileviewer=file-view-default

And then you could run your aggregation using a SQL query, like this:
bean-query <filename> "select payee, sum(posting) group by payee"

Your net income would still be correct on the income statement, and the
trial balance wouldn't be off. Your journals would show the clean payee
name on the web interface and everywhere else.



On Mon, May 16, 2016 at 2:10 PM, Josh Hanson <surely.you.j...@gmail.com>
wrote:

> Thanks for the prompt response, John. This is how I started out doing it -
> the problem is that I have lots of repeat customers. Every time someone
> comes back, I have to go check a previous transaction to see how they were
> referred before I can write the new transaction.
>
> So you see, my metadata really wants to be per *payee*, not per
> *transaction.*
>
> In an ideal world there'd be a "tag" sub-directive for the "payee"
> directive, that automatically tags each transaction with that payee. This
> would do exactly what I want. I could just write:
>
> payee Alice
>   tag Source: Yelp
>
> payee Bob
>   tag Source: Facebook
>
> Then I'd not only get properly tagged transactions, but ledger could warn
> me if I mistype a payee, too.
>
>
> On Sunday, May 15, 2016 at 4:59:14 PM UTC-4, John Wiegley wrote:
>
>> >>>>> Josh Hanson <surely....@gmail.com> writes:
>>
>> > How have other people addressed this situation?
>>
>> I would use metadata:
>>
>>     5/15 Alice
>>       Income           $100.00   ; Source: Facebook
>>       Assets:Checking
>>
>>     5/15 Bob
>>       Income           $100.00
>>       Assets:Checking
>>
>> You can now use the metadata tag in various ways:
>>
>>     %Source                       any entry that has a known Source
>>     %Source=Facebook              query for a specific Source
>>     --group-by=tag("Source")      group the register by source
>>     --payee=tag("Source")         change the payee to the Source
>>     --account=tag("Source")       change the account to the Source
>>     --pivot=tag("Source")
>>
>> And to be even fancier:
>>
>>     --account='account + ":" + tag("Source")'
>>
>> For accounts that have a source, it will append the source; otherwise,
>> only
>> the account name is used. This will reproduce something very close to the
>> balance reports you're now using.
>>
>> --
>> John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
>> http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2
>>
> --
>
> ---
> 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 ledger-cli+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to