News for hackers. Stuff that matters.
Re:Double Entry Accounting for Developers by navaati on Tuesday July 28, 2020 @10:15AM (#23975991)
It doesn't, the Equity account displays a negative number if the company is in the green (it decreases when you emit stocks), the Expense account displays positive numbers (it increases when you spend money), the Income account displays negative numbers (it decreases when you earn money).

In beancount, the accounting equation is Expense+Income+Equity=0 and all signs are always left intact (there is only addition).

So you start a company with a seed capital of $5. You borrow $5 to the bank, buy an expensive apple for $10, sell it for $15 and give the money back to the bank with an interest of $1, then close the exercise and carry the profits (don't distribute dividends). Your ledger is:

  Initial capital
    Assets:Cash +5 USD
    Equity:Seed -5 USD
  
  Borrow to the bank
    Assets:Cash +5 USD
    Liabilities:Bank -5 USD
  
  Buy an apple
    Assets:Apples +10 USD
    Assets:Cash -10 USD
  
  Sell the apple
    Income:Sales -5 USD
    Assets:Apples -10 USD
    Assets:Cash +15 USD
  
  Reimburse the bank
    Liabilities:Bank +5 USD
    Expenses:Interest +1 USD
    Assets:Cash -6 USD
  
  Close the exercise # beancount does that for you for any time period btw
    Expenses:Interest -1 USD
    Income:Sales +5 USD
    Equity:PreviousProfit +4 USD
Notice how every transaction balances to 0 just by summing it, no need to remember anything.

Now, you're at the beginning of the next exercise. To know your accounts you just compute a sum of every operation to it, again no special case. So your accounts are:

  Expenses 0 USD
  Income 0 USD # as expected at beginning of exercise
  Assets:Apples 0 USD
  Assets:Cash 9 USD
  Liabilities:Bank 0 USD
  Equity:Seed -5 USD
  Equity:PreviousProfits -4 USD
And yet again, the sum of all of that is 0.

Personally I like it, not having any special cases. Yes, it may confused an accountant (because they learned the special cases by heart ! Somebody coming with a fresh mind has no reason to be confused, it's all just conventions !) but it's simpler for me and just as consistent.

Re:Double Entry Accounting for Developers by verytrivial on Tuesday July 28, 2020 @11:33AM (#23976818)
FWIW I did an accounting elective at college and ran the books for a small business for a couple of years. I'm comfortable with the conventions :-) I was just saying OP was choosing to encode the conventions differently internally and display them a different way to meet the external convention, like GMT+TZ. You need never known your computer stores time in GMT and most people don't, even the accountants.