Adding a "payroll" functionality

115 views
Skip to first unread message

Ian Soboroff

unread,
May 12, 2017, 10:39:01 AM5/12/17
to Beancount
I am looking for advice on the following design for a payroll module.

I have this data model in mind:

1. employees.  This is basically a list of accounts that receive payroll payments.

2. cost centers.  This is a list of accounts that employees get paid from, they correspond to projects with their own budgets.

3. a labor distribution.  For a given payroll period, this spells out what fraction of each employee's time is paid from each cost center.  So Joe Cool's time is 50% on project A and 50% on project B, so when he gets paid, I want to automatically generate the two transactions from the correct accounts.

Then, in the beancount file, I imagine having a directive called "payroll" which would generate all the appropriate transactions following the labor distribution.

I'm not sure the best way to integrate this idea into Beancount.  The data is hard to represent directly in the data file (or I don't see the right way to do it), so I have in mind a plugin where the labor distribution is defined in the Python module, and the "payroll" directives would be dummy transactions that the plugin would substitute out when mapping over the entries list.

Does that make sense, and does it seem the right way to approach this?

Ian

Jason Chu

unread,
May 12, 2017, 12:10:26 PM5/12/17
to Beancount
I feel like you have another problem though.  Once something has been paid out, it's a concrete transaction and you don't want it to ever change.  If you're using a plugin, there is a very real possibility that you accidentally change some metadata that retroactively changes a transaction.

I would imagine using metadata to represent current/projected project time and a script that uses the beancount modules to read your file and generate concrete transactions for a pay period (probably porting the metadata snapshot to the generated transactions).  That way you can keep a concrete list of transactions representing real movements of money and use the metadata to represent the proportional contributes of your employees.


--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/65952064-c7ed-4610-8084-cfe5dd76d8e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ian Soboroff

unread,
May 12, 2017, 2:02:03 PM5/12/17
to Beancount
That's a very good point, and anyway the allocations change over time, and I want to run projections with hypothetical allocations.

Ian
Reply all
Reply to author
Forward
0 new messages